create_milestone
Creates a new milestone (sprint) within a Taiga project by specifying session ID, project ID, milestone name, and estimated start and finish dates.
Instructions
Creates a new milestone (sprint) within a project.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| estimated_finish | Yes | ||
| estimated_start | Yes | ||
| name | Yes | ||
| project_id | Yes | ||
| session_id | Yes |
Implementation Reference
- src/server.py:1027-1056 (handler)The handler function for the 'create_milestone' MCP tool. It authenticates the session, validates inputs, and calls the Taiga API via pytaigaclient to create a new milestone (sprint) in the specified project. The @mcp.tool decorator registers it as a tool.@mcp.tool("create_milestone", description="Creates a new milestone (sprint) within a project.") def create_milestone(session_id: str, project_id: int, name: str, estimated_start: str, estimated_finish: str) -> Dict[str, Any]: """Creates a milestone. Requires project_id, name, estimated_start (YYYY-MM-DD), and estimated_finish (YYYY-MM-DD).""" logger.info( f"Executing create_milestone '{name}' in project {project_id}, session {session_id[:8]}...") taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name if not all([name, estimated_start, estimated_finish]): raise ValueError( "Milestone requires name, estimated_start, and estimated_finish.") try: # Use pytaigaclient syntax: client.resource.create(...) milestone = taiga_client_wrapper.api.milestones.create( project=project_id, # Changed project_id to project name=name, estimated_start=estimated_start, estimated_finish=estimated_finish ) logger.info( f"Milestone '{name}' created successfully (ID: {milestone.get('id', 'N/A')}).") # return milestone.to_dict() # Remove .to_dict() return milestone # Return directly except TaigaException as e: logger.error( f"Taiga API error creating milestone '{name}': {e}", exc_info=False) raise e except Exception as e: logger.error( f"Unexpected error creating milestone '{name}': {e}", exc_info=True) raise RuntimeError(f"Server error creating milestone: {e}")
- src/server.py:39-52 (helper)Helper function used by create_milestone (and other tools) to retrieve and validate the authenticated TaigaClientWrapper from the session store.def _get_authenticated_client(session_id: str) -> TaigaClientWrapper: """ Retrieves the authenticated TaigaClientWrapper for a given session ID. Raises PermissionError if the session is invalid or not found. """ client = active_sessions.get(session_id) # Also check if the client object itself exists and is authenticated if not client or not client.is_authenticated: logger.warning(f"Invalid or expired session ID provided: {session_id}") # Raise PermissionError - FastMCP will map this to an appropriate error response raise PermissionError( f"Invalid or expired session ID: '{session_id}'. Please login again.") logger.debug(f"Retrieved valid client for session ID: {session_id}") return client