Fix type errors and remove trailing whitespace
- Add explicit type annotations for params dictionaries to resolve mypy errors - Remove trailing whitespace from blank lines (W293 ruff warnings) - Ensure type safety in task_tools.py and document_tools.py
This commit is contained in:
parent
d5bfaba3af
commit
e8cffde80e
@ -75,7 +75,7 @@ def register_document_tools(mcp: FastMCP):
|
|||||||
tags=["api", "backend"],
|
tags=["api", "backend"],
|
||||||
author="API Team"
|
author="API Team"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create design document
|
# Create design document
|
||||||
create_document(
|
create_document(
|
||||||
project_id="550e8400-e29b-41d4-a716-446655440000",
|
project_id="550e8400-e29b-41d4-a716-446655440000",
|
||||||
@ -227,7 +227,7 @@ def register_document_tools(mcp: FastMCP):
|
|||||||
timeout = httpx.Timeout(30.0, connect=5.0)
|
timeout = httpx.Timeout(30.0, connect=5.0)
|
||||||
|
|
||||||
# Build update fields
|
# Build update fields
|
||||||
update_fields = {}
|
update_fields: Dict[str, Any] = {}
|
||||||
if title is not None:
|
if title is not None:
|
||||||
update_fields["title"] = title
|
update_fields["title"] = title
|
||||||
if content is not None:
|
if content is not None:
|
||||||
|
|||||||
@ -33,7 +33,7 @@ def register_version_tools(mcp: FastMCP):
|
|||||||
) -> str:
|
) -> str:
|
||||||
"""
|
"""
|
||||||
Create a new version snapshot of project data.
|
Create a new version snapshot of project data.
|
||||||
|
|
||||||
Creates an immutable snapshot that can be restored later. The content format
|
Creates an immutable snapshot that can be restored later. The content format
|
||||||
depends on which field_name you're versioning.
|
depends on which field_name you're versioning.
|
||||||
|
|
||||||
@ -45,19 +45,19 @@ def register_version_tools(mcp: FastMCP):
|
|||||||
- "data": For general data objects
|
- "data": For general data objects
|
||||||
- "prd": For product requirement documents
|
- "prd": For product requirement documents
|
||||||
content: Complete content to snapshot. Format depends on field_name:
|
content: Complete content to snapshot. Format depends on field_name:
|
||||||
|
|
||||||
For "docs" - pass array of document objects:
|
For "docs" - pass array of document objects:
|
||||||
[{"id": "doc-123", "title": "API Guide", "content": {...}}]
|
[{"id": "doc-123", "title": "API Guide", "content": {...}}]
|
||||||
|
|
||||||
For "features" - pass dictionary of features:
|
For "features" - pass dictionary of features:
|
||||||
{"auth": {"status": "done"}, "api": {"status": "in_progress"}}
|
{"auth": {"status": "done"}, "api": {"status": "in_progress"}}
|
||||||
|
|
||||||
For "data" - pass any JSON object:
|
For "data" - pass any JSON object:
|
||||||
{"config": {"theme": "dark"}, "settings": {...}}
|
{"config": {"theme": "dark"}, "settings": {...}}
|
||||||
|
|
||||||
For "prd" - pass PRD object:
|
For "prd" - pass PRD object:
|
||||||
{"vision": "...", "features": [...], "metrics": [...]}
|
{"vision": "...", "features": [...], "metrics": [...]}
|
||||||
|
|
||||||
change_summary: Description of what changed (e.g., "Added OAuth docs")
|
change_summary: Description of what changed (e.g., "Added OAuth docs")
|
||||||
document_id: Optional - for versioning specific doc in docs array
|
document_id: Optional - for versioning specific doc in docs array
|
||||||
created_by: Who created this version (default: "system")
|
created_by: Who created this version (default: "system")
|
||||||
@ -78,7 +78,7 @@ def register_version_tools(mcp: FastMCP):
|
|||||||
content=[{"id": "doc-1", "title": "Guide", "content": {"text": "..."}}],
|
content=[{"id": "doc-1", "title": "Guide", "content": {"text": "..."}}],
|
||||||
change_summary="Updated user guide"
|
change_summary="Updated user guide"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Version features
|
# Version features
|
||||||
create_version(
|
create_version(
|
||||||
project_id="550e8400-e29b-41d4-a716-446655440000",
|
project_id="550e8400-e29b-41d4-a716-446655440000",
|
||||||
|
|||||||
@ -41,27 +41,27 @@ def register_feature_tools(mcp: FastMCP):
|
|||||||
],
|
],
|
||||||
"count": 3
|
"count": 3
|
||||||
}
|
}
|
||||||
|
|
||||||
Note: Returns empty array if no features are defined yet.
|
Note: Returns empty array if no features are defined yet.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
get_project_features(project_id="550e8400-e29b-41d4-a716-446655440000")
|
get_project_features(project_id="550e8400-e29b-41d4-a716-446655440000")
|
||||||
|
|
||||||
Feature Structure Examples:
|
Feature Structure Examples:
|
||||||
Features can have various structures depending on your needs:
|
Features can have various structures depending on your needs:
|
||||||
|
|
||||||
1. Simple status tracking:
|
1. Simple status tracking:
|
||||||
{"name": "feature_name", "status": "todo|in_progress|done"}
|
{"name": "feature_name", "status": "todo|in_progress|done"}
|
||||||
|
|
||||||
2. Component tracking:
|
2. Component tracking:
|
||||||
{"name": "auth", "status": "done", "components": ["oauth", "jwt", "sessions"]}
|
{"name": "auth", "status": "done", "components": ["oauth", "jwt", "sessions"]}
|
||||||
|
|
||||||
3. Progress tracking:
|
3. Progress tracking:
|
||||||
{"name": "api", "status": "in_progress", "endpoints_done": 12, "endpoints_total": 20}
|
{"name": "api", "status": "in_progress", "endpoints_done": 12, "endpoints_total": 20}
|
||||||
|
|
||||||
4. Metadata rich:
|
4. Metadata rich:
|
||||||
{"name": "payments", "provider": "stripe", "version": "2.0", "enabled": true}
|
{"name": "payments", "provider": "stripe", "version": "2.0", "enabled": true}
|
||||||
|
|
||||||
How Features Are Populated:
|
How Features Are Populated:
|
||||||
- Features are typically added via update_project() with features field
|
- Features are typically added via update_project() with features field
|
||||||
- Can be automatically populated by AI during project creation
|
- Can be automatically populated by AI during project creation
|
||||||
|
|||||||
@ -31,7 +31,7 @@ def register_project_tools(mcp: FastMCP):
|
|||||||
) -> str:
|
) -> str:
|
||||||
"""
|
"""
|
||||||
Create a new project with automatic AI assistance.
|
Create a new project with automatic AI assistance.
|
||||||
|
|
||||||
The project creation starts a background process that generates PRP documentation
|
The project creation starts a background process that generates PRP documentation
|
||||||
and initial tasks based on the title and description.
|
and initial tasks based on the title and description.
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ def register_project_tools(mcp: FastMCP):
|
|||||||
title="Task Management API",
|
title="Task Management API",
|
||||||
description="RESTful API for managing tasks and projects"
|
description="RESTful API for managing tasks and projects"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Project with GitHub integration
|
# Project with GitHub integration
|
||||||
create_project(
|
create_project(
|
||||||
title="OAuth2 Authentication System",
|
title="OAuth2 Authentication System",
|
||||||
|
|||||||
@ -7,7 +7,7 @@ Mirrors the functionality of the original manage_task tool but with individual t
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Optional, List, Dict
|
from typing import Any, Dict, List, Optional
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
@ -73,7 +73,7 @@ def register_task_tools(mcp: FastMCP):
|
|||||||
title="Add user authentication",
|
title="Add user authentication",
|
||||||
description="Implement JWT-based authentication with refresh tokens"
|
description="Implement JWT-based authentication with refresh tokens"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Task with sources and examples
|
# Task with sources and examples
|
||||||
create_task(
|
create_task(
|
||||||
project_id="550e8400-e29b-41d4-a716-446655440000",
|
project_id="550e8400-e29b-41d4-a716-446655440000",
|
||||||
@ -177,7 +177,7 @@ def register_task_tools(mcp: FastMCP):
|
|||||||
timeout = httpx.Timeout(30.0, connect=5.0)
|
timeout = httpx.Timeout(30.0, connect=5.0)
|
||||||
|
|
||||||
# Build URL and parameters based on filter type
|
# Build URL and parameters based on filter type
|
||||||
params = {
|
params: Dict[str, Any] = {
|
||||||
"page": page,
|
"page": page,
|
||||||
"per_page": per_page,
|
"per_page": per_page,
|
||||||
"exclude_large_fields": True, # Always exclude large fields in MCP responses
|
"exclude_large_fields": True, # Always exclude large fields in MCP responses
|
||||||
@ -314,7 +314,7 @@ def register_task_tools(mcp: FastMCP):
|
|||||||
async def delete_task(ctx: Context, task_id: str) -> str:
|
async def delete_task(ctx: Context, task_id: str) -> str:
|
||||||
"""
|
"""
|
||||||
Delete/archive a task.
|
Delete/archive a task.
|
||||||
|
|
||||||
This removes the task from active lists but preserves it in the database
|
This removes the task from active lists but preserves it in the database
|
||||||
for audit purposes (soft delete).
|
for audit purposes (soft delete).
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user