delete_task
Remove a task from the Task MCP Server by specifying its ID to manage your task list effectively.
Instructions
Delete a task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ID of the task to delete |
Implementation Reference
- src/task_mcp_server/server.py:142-159 (handler)Handler logic for delete_task tool: extracts task_id from arguments, checks if task exists in the global tasks dictionary, deletes it using pop if found, and returns a success or error message via TextContent.elif name == "delete_task": task_id = int(arguments.get("task_id", 0)) if task_id not in tasks: return [ types.TextContent( type="text", text=f"❌ Task {task_id} not found" ) ] deleted_task = tasks.pop(task_id) return [ types.TextContent( type="text", text=f"🗑️ Task deleted: {deleted_task['title']}" ) ]
- src/task_mcp_server/server.py:58-71 (registration)Registers the delete_task tool in the list_tools handler, providing name, description, and input schema expecting a numeric task_id.types.Tool( name="delete_task", description="Delete a task", inputSchema={ "type": "object", "properties": { "task_id": { "type": "number", "description": "ID of the task to delete" } }, "required": ["task_id"] } )
- src/task_mcp_server/server.py:61-70 (schema)Input schema for delete_task tool, defining an object with required numeric task_id property.inputSchema={ "type": "object", "properties": { "task_id": { "type": "number", "description": "ID of the task to delete" } }, "required": ["task_id"] }