Skip to main content
Glama
talhaorak

Taiga MCP Bridge

by talhaorak

create_epic

Create a new epic in a Taiga project by specifying session ID, project ID, subject, and additional parameters. Facilitates project management through the Taiga MCP Bridge.

Instructions

Creates a new epic within a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes
project_idYes
session_idYes
subjectYes

Implementation Reference

  • The handler function for the 'create_epic' MCP tool. It authenticates the session, validates input, and uses the TaigaClientWrapper to create an epic via the pytaigaclient API.
    @mcp.tool("create_epic", description="Creates a new epic within a project.")
    def create_epic(session_id: str, project_id: int, subject: str, **kwargs) -> Dict[str, Any]:
        """Creates an epic. Requires project_id and subject. Optional fields (description, status_id, assigned_to_id, color, etc.) via kwargs."""
        logger.info(
            f"Executing create_epic '{subject}' in project {project_id}, session {session_id[:8]}...")
        taiga_client_wrapper = _get_authenticated_client(session_id) # Use wrapper variable name
        if not subject:
            raise ValueError("Epic subject cannot be empty.")
        try:
            # Use pytaigaclient syntax: client.resource.create(project=..., subject=..., **kwargs)
            epic = taiga_client_wrapper.api.epics.create(project=project_id, subject=subject, **kwargs)
            logger.info(f"Epic '{subject}' created successfully (ID: {epic.get('id', 'N/A')}).")
            # return epic.to_dict() # Remove .to_dict()
            return epic # Return directly
        except TaigaException as e:
            logger.error(
                f"Taiga API error creating epic '{subject}': {e}", exc_info=False)
            raise e
        except Exception as e:
            logger.error(
                f"Unexpected error creating epic '{subject}': {e}", exc_info=True)
            raise RuntimeError(f"Server error creating epic: {e}")
  • Helper function used by create_epic (and other tools) to retrieve the authenticated TaigaClientWrapper instance from the active_sessions dictionary based on session_id.
    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
  • The TaigaClientWrapper class imported and used by create_epic handler to interact with the Taiga API via pytaigaclient. Handles login and provides the api.epics.create method.
    class TaigaClientWrapper:
        """
        A wrapper around the pytaiga-client library to manage API instance
        and authentication state.
        """
    
        def __init__(self, host: str):
            if not host:
                raise ValueError("Taiga host URL cannot be empty.")
            # Store host, but initialize client later during login/token auth
            self.host = host
            # Use the new client type
            self.api: Optional[TaigaClient] = None
            logger.info(f"TaigaClientWrapper initialized for host: {self.host}")
  • src/server.py:871-871 (registration)
    The @mcp.tool decorator registers the create_epic function as an MCP tool with the specified name and description.
    @mcp.tool("create_epic", description="Creates a new epic within a project.")

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