createTask
Create and manage tasks within Godspeed by specifying title, due date, duration, labels, and metadata. Simplifies task organization and tracking using structured input schema.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| due_at | No | ||
| duration_minutes | No | ||
| label_ids | No | ||
| label_names | No | ||
| list_id | No | ||
| location | No | ||
| metadata | No | ||
| notes | No | ||
| starts_at | No | ||
| timeless_due_at | No | ||
| timeless_starts_at | No | ||
| title | Yes |
Implementation Reference
- src/index.ts:87-115 (registration)MCP server.tool registration for the 'createTask' tool, including Zod input schema validation and a thin async handler that delegates to godspeedApi.createTask and formats the response.server.tool( "createTask", { title: z.string(), list_id: z.string().optional(), location: z.enum(["start", "end"]).optional(), notes: z.string().optional(), due_at: z.date().optional(), timeless_due_at: z.string().optional(), starts_at: z.date().optional(), timeless_starts_at: z.string().optional(), duration_minutes: z.number().int().nonnegative().optional(), label_names: z.array(z.string()).optional(), label_ids: z.array(z.string()).optional(), metadata: z.record(z.any()).optional() }, async (params) => { try { const result = await godspeedApi.createTask(params); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }] }; } } );
- src/types.ts:25-38 (schema)TypeScript interface defining the CreateTaskParams used by the createTask functions in GodspeedAPI and matching the MCP tool input schema.export interface CreateTaskParams { title: string; list_id?: string; location?: 'start' | 'end'; notes?: string; due_at?: Date; timeless_due_at?: string; starts_at?: Date; timeless_starts_at?: string; duration_minutes?: number; label_names?: string[]; label_ids?: string[]; metadata?: Record<string, any>; }
- src/godspeed.ts:59-79 (handler)Core handler implementation in GodspeedAPI class that executes the HTTP POST request to the Godspeed API /tasks endpoint to create a new task, handles auth, errors, and returns ApiResponse<Task>.async createTask(params: CreateTaskParams): Promise<ApiResponse<Task>> { try { const headers = this.getAuthHeaders(); const response = await fetch(`${API_BASE_URL}/tasks`, { method: 'POST', headers, body: JSON.stringify(params), }); const data = await response.json(); if (!response.ok) { throw new Error(data.error || 'Failed to create task'); } return data; } catch (error) { throw new Error(`Create task error: ${error instanceof Error ? error.message : String(error)}`); } }