Skip to main content
Glama

create_task

Automate task creation in Taiga projects using AI systems by specifying project ID, subject, and session details. Streamline project management workflows efficiently.

Instructions

Creates a new task within a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes
project_idYes
session_idYes
subjectYes

Implementation Reference

  • The core handler function for the 'create_task' MCP tool. It retrieves the authenticated Taiga client, creates a task using the pytaigaclient API's tasks.create method, and handles errors.
    @mcp.tool("create_task", description="Creates a new task within a project.") def create_task(session_id: str, project_id: int, subject: str, **kwargs) -> Dict[str, Any]: """Creates a task. Requires project_id and subject. Optional fields (description, milestone_id, status_id, user_story_id, assigned_to_id, etc.) via kwargs.""" logger.info( f"Executing create_task '{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("Task subject cannot be empty.") try: # Use pytaigaclient syntax: client.resource.create(project=..., subject=..., **kwargs) task = taiga_client_wrapper.api.tasks.create(project=project_id, subject=subject, **kwargs) logger.info(f"Task '{subject}' created successfully (ID: {task.get('id', 'N/A')}).") # return task.to_dict() # Remove .to_dict() return task # Return directly except TaigaException as e: logger.error( f"Taiga API error creating task '{subject}': {e}", exc_info=False) raise e except Exception as e: logger.error( f"Unexpected error creating task '{subject}': {e}", exc_info=True) raise RuntimeError(f"Server error creating task: {e}")
  • src/server.py:469-469 (registration)
    MCP tool registration decorator that registers the create_task function as an MCP tool named 'create_task'.
    @mcp.tool("create_task", description="Creates a new task within a project.")
  • Helper function used by create_task (and other tools) to retrieve and validate the TaigaClientWrapper instance for the given 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

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