Skip to main content
Glama
mstfe

Google Tasks MCP Server

by mstfe

create_task

Add a new task to Google Tasks by specifying a title and optional notes, enabling efficient task management and organization.

Instructions

Create a new task in Google Tasks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
notesNoNotes for the task
titleYesTitle of the task

Implementation Reference

  • The execution handler for the 'create_task' tool within the CallToolRequestSchema handler. It validates the input arguments, calls the Google Tasks API to insert a new task into the default tasklist, and returns the created task data.
    if (request.params.name === "create_task") { if (!isValidCreateTaskArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, "Invalid arguments for creating a task. 'title' must be a string, and 'notes' must be a string or undefined." ); } const args = request.params.arguments; try { const response = await tasks.tasks.insert({ tasklist: "@default", requestBody: { title: args.title, notes: args.notes, }, }); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Tasks API error: ${error}` ); } }
  • src/index.ts:142-153 (registration)
    Registration of the 'create_task' tool in the ListToolsRequestSchema handler, including its name, description, and input schema.
    { name: "create_task", description: "Create a new task in Google Tasks", inputSchema: { type: "object", properties: { title: { type: "string", description: "Title of the task" }, notes: { type: "string", description: "Notes for the task" }, }, required: ["title"], }, },
  • JSON Schema definition for the input arguments of the 'create_task' tool.
    inputSchema: { type: "object", properties: { title: { type: "string", description: "Title of the task" }, notes: { type: "string", description: "Notes for the task" }, }, required: ["title"], },
  • TypeScript interface defining the expected arguments for create_task.
    interface CreateTaskArgs { title: string; notes?: string; taskId?: string; status?: string; }
  • Type guard function used to validate CreateTaskArgs in the handler.
    // Type guard for CreateTaskArgs export function isValidCreateTaskArgs(args: any): args is CreateTaskArgs { return ( typeof args === "object" && args !== null && (args.title === undefined || typeof args.title === "string") && (args.notes === undefined || typeof args.notes === "string") && (args.taskId === undefined || typeof args.taskId === "string") && (args.status === undefined || typeof args.status === "string") ); }

Other Tools

Related Tools

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/mstfe/mcp-google-tasks'

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