get_tasks
Retrieve and filter tasks from a database by status or assigned user to manage workflow and track progress.
Instructions
Get all tasks from the mock database
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_tasks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | No | Filter tasks by status | |
| assignedTo | No | Filter tasks by assigned user ID |
Implementation Reference
- src/domains/tasks.js:4-20 (handler)Executes the get_tasks tool logic by filtering tasks based on optional status and assignedTo parameters from mock data.
static getAll(filters = {}) { let filteredTasks = tasks; if (filters.status) { filteredTasks = filteredTasks.filter(task => task.status === filters.status); } if (filters.assignedTo) { filteredTasks = filteredTasks.filter(task => task.assignedTo === filters.assignedTo); } return { success: true, data: filteredTasks, total: filteredTasks.length }; } - src/domains/tasks.js:101-118 (schema)Defines the input schema for the get_tasks tool, specifying optional filters for status (enum) and assignedTo (number).
{ name: 'get_tasks', description: 'Get all tasks from the mock database', inputSchema: { type: 'object', properties: { status: { type: 'string', description: 'Filter tasks by status', enum: ['pending', 'in-progress', 'completed'] }, assignedTo: { type: 'number', description: 'Filter tasks by assigned user ID' } } } }, - mcp-server.js:38-46 (registration)Registers the get_tasks tool schema by including taskToolSchemas in the response to ListToolsRequest.
this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ ...userToolSchemas, ...taskToolSchemas, searchToolSchema ] }; }); - mcp-server.js:60-61 (registration)Handles incoming calls to the get_tasks tool by dispatching to TaskService.getAll with the provided arguments.
case 'get_tasks': return createMcpResponse(TaskService.getAll(args));