Add milestone_type field to milestone queries that indicates whether
a milestone is a start milestone ('start') or finish milestone ('finish').
Changes:
- Add milestone_type column to activities table schema
- Parse milestone_type from XER TASK table (MS_Start/MS_Finish)
- Include milestone_type in list_milestones response
- Update contract tests for milestone_type field
- Update specs, contracts, and documentation
The milestone_type is determined by:
1. Explicit milestone_type field in XER (MS_Start -> 'start', MS_Finish -> 'finish')
2. Derived from task_type (TT_Mile -> 'start', TT_FinMile -> 'finish')
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""list_milestones MCP tool implementation."""
|
|
|
|
from xer_mcp.db.queries import query_milestones
|
|
from xer_mcp.server import is_file_loaded
|
|
|
|
|
|
async def list_milestones() -> dict:
|
|
"""List all milestone activities in the loaded project.
|
|
|
|
Returns both Start Milestones and Finish Milestones with their milestone_type.
|
|
|
|
Returns:
|
|
Dictionary with list of milestones, each containing:
|
|
- task_id: Activity ID
|
|
- task_code: Activity code
|
|
- task_name: Activity name
|
|
- target_start_date: Target start date
|
|
- target_end_date: Target end date
|
|
- status_code: Activity status
|
|
- milestone_type: 'start' for start milestones, 'finish' for finish milestones
|
|
"""
|
|
if not is_file_loaded():
|
|
return {
|
|
"error": {
|
|
"code": "NO_FILE_LOADED",
|
|
"message": "No XER file is loaded. Use the load_xer tool first.",
|
|
}
|
|
}
|
|
|
|
milestones = query_milestones()
|
|
|
|
return {
|
|
"milestones": milestones,
|
|
}
|