get_parties
Batch fetch up to 10 parties by ID in a single API call, reducing round trips when multiple party IDs are known.
Instructions
Batch-fetch up to 10 parties by ID in a single call. Use this when Claude already knows several party IDs to avoid N round trips of get_party.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | Array of party IDs (1–10). Capsule caps batch fetches at 10. | |
| embed | No | Comma-separated embeds, e.g. 'tags,fields' |
Implementation Reference
- src/tools/parties.ts:186-191 (handler)The handler function that executes the 'get_parties' tool logic. It makes a Capsule API GET request to /parties/<id1,id2,...> with an optional embed parameter, returning the batch of parties.
export async function getParties(input: z.infer<typeof getPartiesSchema>) { const { data } = await capsuleGet<{ parties: unknown[] }>(`/parties/${input.ids.join(",")}`, { embed: input.embed, }); return data; } - src/tools/parties.ts:177-184 (schema)Zod schema defining the input for getParties: an array of 1-10 positive integers (IDs) and an optional embed string for tags/fields.
export const getPartiesSchema = z.object({ ids: z .array(z.number().int().positive()) .min(1) .max(10) .describe("Array of party IDs (1–10). Capsule caps batch fetches at 10."), embed: z.string().optional().describe(EMBED_TAGS_FIELDS_DESCRIPTION), }); - src/server.ts:253-259 (registration)Registration of the 'get_parties' tool with the MCP server, providing its name, description, schema, and handler.
registerTool( server, "get_parties", "Batch-fetch up to 10 parties by ID in a single call. Use this when Claude already knows several party IDs to avoid N round trips of get_party.", getPartiesSchema, getParties, ); - src/server/register-tool.ts:39-59 (helper)The registerTool helper that wraps the handler's return value in MCP text-content format and registers it via the SDK.
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); }); }