get_projects
Retrieve up to 10 projects at once by providing an array of project IDs. Supports optional embeds like tags and fields.
Instructions
Batch-fetch up to 10 projects (cases) by ID in a single call.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | Array of project IDs (1–10). Capsule caps batch fetches at 10. | |
| embed | No | Comma-separated embeds, e.g. 'tags,fields' |
Implementation Reference
- src/tools/projects.ts:60-65 (handler)The actual handler function for the 'get_projects' tool. It takes an array of up to 10 project IDs and an optional embed parameter, and makes a GET request to /kases/<id1,id2,...> to batch-fetch projects.
export async function getProjects(input: z.infer<typeof getProjectsSchema>) { const { data } = await capsuleGet<{ kases: unknown[] }>(`/kases/${input.ids.join(",")}`, { embed: input.embed, }); return data; } - src/tools/projects.ts:51-58 (schema)Zod input schema for get_projects. Defines 'ids' (array of positive ints, min 1 max 10) and 'embed' (optional string).
export const getProjectsSchema = z.object({ ids: z .array(z.number().int().positive()) .min(1) .max(10) .describe("Array of project IDs (1–10). Capsule caps batch fetches at 10."), embed: z.string().optional().describe(EMBED_TAGS_FIELDS_DESCRIPTION), }); - src/server.ts:510-516 (registration)Registration of the 'get_projects' tool on the MCP server via the registerTool helper, with description 'Batch-fetch up to 10 projects (cases) by ID in a single call.'
registerTool( server, "get_projects", "Batch-fetch up to 10 projects (cases) by ID in a single call.", getProjectsSchema, getProjects, ); - src/server.ts:56-69 (registration)Import of getProjectsSchema and getProjects from src/tools/projects.ts into the server registration file.
import { listProjectsSchema, listProjects, getProjectSchema, getProject, getProjectsSchema, getProjects, createProjectSchema, createProject, updateProjectSchema, updateProject, deleteProjectSchema, deleteProject, } from "./tools/projects.js"; - src/server/register-tool.ts:39-59 (helper)Generic registerTool helper that wraps a handler's return value in the standard MCP text-content response shape and registers it on the McpServer.
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); }); }