get_task
Fetch a single task by its numeric ID to get full task details including description, due date, owner, completion state, and linked entity (party, opportunity, project, or standalone).
Instructions
Fetch a single task by its numeric id. Returns the task's description, due date, owner, completion state, and the entity it's attached to (party / opportunity / project, if any — standalone tasks not tied to a record are also valid). For batch fetches of up to 10 tasks at once, use get_tasks instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Task ID |
Implementation Reference
- src/tools/tasks.ts:45-48 (handler)The actual handler function for the 'get_task' tool. It takes an input object with 'id', makes a GET request to Capsule's /tasks/{id} endpoint, and returns the task data.
export async function getTask(input: z.infer<typeof getTaskSchema>) { const { data } = await capsuleGet<{ task: unknown }>(`/tasks/${input.id}`); return data; } - src/tools/tasks.ts:41-43 (schema)Zod schema for get_task input validation. Defines a single required parameter: 'id' (positive integer).
export const getTaskSchema = z.object({ id: z.number().int().positive().describe("Task ID"), }); - src/server.ts:604-610 (registration)Registration of the 'get_task' tool with the MCP server. Calls registerTool with the name 'get_task', a description, the getTaskSchema, and the getTask handler.
registerTool( server, "get_task", "Fetch a single task by its numeric id. Returns the task's description, due date, owner, completion state, and the entity it's attached to (party / opportunity / project, if any — standalone tasks not tied to a record are also valid). For batch fetches of up to 10 tasks at once, use get_tasks instead.", getTaskSchema, getTask, ); - src/server/register-tool.ts:39-59 (helper)The generic registerTool helper function used to register all tools (including get_task). It wraps the handler's return value in MCP's standard text-content response format.
export function registerTool<Schema extends z.ZodObject<ZodRawShape>>( server: McpServer, name: string, description: string, schema: Schema, handler: (input: z.infer<Schema>) => Promise<unknown>, ): void { // Use the SDK config-form registerTool with the full Zod schema. The // deprecated shape overload rebuilds z.object(schema.shape), which drops // object-level refinements such as superRefine. const registerWithSchema = server.registerTool.bind(server) as ( toolName: string, config: { description: string; inputSchema: Schema }, callback: (input: z.infer<Schema>) => Promise<CallToolResult>, ) => void; registerWithSchema(name, { description, inputSchema: schema }, async (input) => { const result = await handler(input); return wrapAsText(result); }); }