Skip to main content
Glama
talhaorak

Taiga MCP Bridge

by talhaorak

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
NameRequiredDescriptionDefault
estimated_finishYes
estimated_startYes
nameYes
project_idYes
session_idYes

Implementation Reference

  • 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}")
  • 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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/talhaorak/pytaiga-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server