get_task_tool
Retrieve a specific task by its ID to view details or check status within the Tasks MCP Server's management system.
Instructions
Get a task by ID. Args: task_id (int): The ID of the task to retrieve.
Returns: Task: The task object if found, otherwise None.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes |
Implementation Reference
- src/tools/tasks.py:25-38 (handler)The handler function that implements the logic for the 'get_task_tool' MCP tool. It retrieves a task from the database by ID and returns a Task object or None.@mcp.tool() async def get_task_tool( ctx: Context[ServerSession, AppContext], task_id: int ) -> Task | None: """Get a task by ID. Args: task_id (int): The ID of the task to retrieve. Returns: Task: The task object if found, otherwise None. """ database: DatabaseABC = ctx.request_context.lifespan_context.db task = database.get_task(task_id=task_id) return Task(**task.__dict__) if task else None
- src/config/server.py:35-35 (registration)The call to create_tasks_tools(mcp) which invokes the decorators to register the get_task_tool (and other task tools) with the FastMCP server.create_tasks_tools(mcp)
- src/config/server.py:10-10 (registration)Import of the create_tasks_tools function used to register the task tools including get_task_tool.from tools.tasks import create_tasks_tools