Skip to main content
Glama
yvanfreitas

MCP Test Server

by yvanfreitas

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
NameRequiredDescriptionDefault
titleYesTask title
statusNoTask statuspending
assignedToNoID of user assigned to this task

Implementation Reference

  • 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
      };
    }
  • 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
      ]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yvanfreitas/MCP-test'

If you have feedback or need assistance with the MCP directory API, please join our Discord server