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