get_tasks
Retrieve tasks from the mock database by filtering based on status or assigned user ID. Use this tool to manage and organize task data efficiently in the MCP Test Server.
Instructions
Get all tasks from the mock database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignedTo | No | Filter tasks by assigned user ID | |
| status | No | Filter tasks by status |
Implementation Reference
- src/domains/tasks.js:3-20 (handler)TaskService.getAll static method implements the core logic for retrieving all tasks, optionally filtered by status or assignedTo user ID, returning a structured response with success flag, data array, and total count.export class TaskService { 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 an object with optional 'status' (string enum) and 'assignedTo' (number) properties for filtering tasks.{ 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:60-61 (registration)In the CallToolRequest handler's switch statement, registers and dispatches 'get_tasks' tool calls by invoking TaskService.getAll with the provided arguments and wrapping in MCP response.case 'get_tasks': return createMcpResponse(TaskService.getAll(args));
- mcp-server.js:40-44 (registration)In the ListToolsRequest handler, includes taskToolSchemas (containing 'get_tasks') in the list of available tools, effectively registering the tool for discovery.tools: [ ...userToolSchemas, ...taskToolSchemas, searchToolSchema ]