Skip to main content
Glama
aaronfeingold

MCP Project Context Server

add_task

Create a new task in your project by specifying title, priority, and optional details like description and tags.

Instructions

Add a new task to the project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
titleYesTask title
descriptionNoTask description
priorityYesTask priority
tagsNoTask tags

Implementation Reference

  • The handler function for the MCP 'add_task' tool. It takes input parameters, calls the ContextManager's addTask method, and returns a formatted response or error message.
    async ({ projectId, title, description, priority, tags }) => { try { const task = await this.contextManager.addTask(projectId, { title, description: description || "", status: "todo", priority, tags: tags || [], blockers: [], dependencies: [], }); return { content: [ { type: "text", text: `Task "${task.title}" added with ID: ${task.id}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error adding task: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } }
  • Zod input schema defining parameters for the 'add_task' tool: projectId, title, optional description, priority, and tags.
    { title: "Add Task", description: "Add a new task to the project", inputSchema: { projectId: z.string().describe("Project ID"), title: z.string().describe("Task title"), description: z.string().optional().describe("Task description"), priority: z .enum(["low", "medium", "high", "critical"]) .describe("Task priority"), tags: z.array(z.string()).default([]).describe("Task tags"), }, },
  • src/server.ts:174-220 (registration)
    Registration of the 'add_task' tool with the MCP server, including name, schema, and handler reference.
    "add_task", { title: "Add Task", description: "Add a new task to the project", inputSchema: { projectId: z.string().describe("Project ID"), title: z.string().describe("Task title"), description: z.string().optional().describe("Task description"), priority: z .enum(["low", "medium", "high", "critical"]) .describe("Task priority"), tags: z.array(z.string()).default([]).describe("Task tags"), }, }, async ({ projectId, title, description, priority, tags }) => { try { const task = await this.contextManager.addTask(projectId, { title, description: description || "", status: "todo", priority, tags: tags || [], blockers: [], dependencies: [], }); return { content: [ { type: "text", text: `Task "${task.title}" added with ID: ${task.id}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error adding task: ${ error instanceof Error ? error.message : "Unknown error" }`, }, ], }; } } );
  • Helper method in ContextManager that implements the core logic for adding a task: fetches project, creates task with UUID and timestamps, appends to tasks array, and persists via store.
    async addTask( projectId: string, taskData: Omit<Task, "id" | "createdAt" | "updatedAt"> ): Promise<Task> { const project = await this.store.getProject(projectId); if (!project) { throw new Error("Project not found"); } const now = new Date().toISOString(); const task: Task = { ...taskData, id: uuidv4(), createdAt: now, updatedAt: now, }; project.tasks.push(task); await this.store.updateProject(project); return task; }

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/aaronfeingold/mcp-project-context'

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