delete_task_tool
Remove tasks from the task management system by specifying their unique ID to clear completed or unnecessary items.
Instructions
Delete a task by ID. Args: task_id (int): The ID of the task to delete.
Returns: None
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes |
Implementation Reference
- src/tools/tasks.py:94-108 (handler)The async handler function for the 'delete_task_tool' that retrieves the database from context, calls delete_task on it, and returns a success message.@mcp.tool() async def delete_task_tool( ctx: Context[ServerSession, AppContext], task_id: int ) -> str: """Delete a task by ID. Args: task_id (int): The ID of the task to delete. Returns: None """ database: DatabaseABC = ctx.request_context.lifespan_context.db database.delete_task(task_id=task_id) return f"Task {task_id} deleted successfully."
- src/config/server.py:35-35 (registration)The call to create_tasks_tools(mcp) which registers the delete_task_tool among other tasks tools on the FastMCP server instance.create_tasks_tools(mcp)