get_tasks
Retrieve up to 10 tasks at once by providing an array of task IDs. Eliminates the need for multiple separate requests.
Instructions
Batch-fetch up to 10 tasks by ID in a single call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | Array of task IDs (1–10). Capsule caps batch fetches at 10. |
Implementation Reference
- src/tools/tasks.ts:63-66 (handler)Handler for the 'get_tasks' tool. Accepts an array of task IDs (1-10), makes a GET request to Capsule's batch endpoint using comma-separated IDs, and returns the fetched tasks.
export async function getTasks(input: z.infer<typeof getTasksSchema>) { const { data } = await capsuleGet<{ tasks: unknown[] }>(`/tasks/${input.ids.join(",")}`); return data; } - src/tools/tasks.ts:55-61 (schema)Zod schema for the 'get_tasks' tool input: validates an array of 1-10 positive integer task IDs.
export const getTasksSchema = z.object({ ids: z .array(z.number().int().positive()) .min(1) .max(10) .describe("Array of task IDs (1–10). Capsule caps batch fetches at 10."), }); - src/server.ts:612-618 (registration)Registration of the 'get_tasks' tool with the MCP server, linking the name, description, schema, and handler.
registerTool( server, "get_tasks", "Batch-fetch up to 10 tasks by ID in a single call.", getTasksSchema, getTasks, ); - src/server.ts:71-86 (registration)Import of getTasksSchema and getTasks from the tasks module into the server registration file.
import { listTasksSchema, listTasks, getTaskSchema, getTask, getTasksSchema, getTasks, createTaskSchema, createTask, updateTaskSchema, updateTask, completeTaskSchema, completeTask, deleteTaskSchema, deleteTask, } from "./tools/tasks.js"; - src/server/register-tool.ts:39-59 (helper)The registerTool helper that wraps the handler result in a JSON text content response and registers it with the MCP SDK server.
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); }); }