create_task
Add new tasks to the MCP Test Server by providing a title, optional status, and assigned user ID for task management.
Instructions
Create a new task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Task title | |
| status | No | Task status | pending |
| assignedTo | No | ID of user assigned to this task |
Implementation Reference
- src/domains/tasks.js:37-62 (handler)TaskService.create implements the core logic for the create_task tool: destructures input, validates title, generates new task ID, adds to mock data store, and returns success response with new task.static create(taskData) { const { title, status = 'pending', assignedTo } = taskData; if (!title) { return { success: false, message: 'Title is required' }; } const newTask = { id: Math.max(...tasks.map(t => t.id)) + 1, title, status, assignedTo: assignedTo || null }; tasks.push(newTask); return { success: true, message: 'Task created successfully', data: newTask }; }
- src/domains/tasks.js:133-156 (schema)Schema definition for create_task tool within taskToolSchemas array, defining input parameters (title required, status with default, assignedTo optional).{ name: 'create_task', description: 'Create a new task', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Task title' }, status: { type: 'string', description: 'Task status', enum: ['pending', 'in-progress', 'completed'], default: 'pending' }, assignedTo: { type: 'number', description: 'ID of user assigned to this task' } }, required: ['title'] } },
- mcp-server.js:62-63 (registration)In the MCP server's CallToolRequestSchema handler, the switch statement registers and dispatches create_task calls to TaskService.create.case 'create_task': return createMcpResponse(TaskService.create(args));
- mcp-server.js:39-44 (registration)In the ListToolsRequestSchema handler, taskToolSchemas (containing create_task schema) is included in the list of available tools.return { tools: [ ...userToolSchemas, ...taskToolSchemas, searchToolSchema ]