get_project
Retrieve a specific project (case) by providing its numeric ID. Optionally include related data such as tags and fields using comma-separated embeds.
Instructions
Fetch a single project (case) by its numeric ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| embed | No | Comma-separated embeds, e.g. 'tags,fields' |
Implementation Reference
- src/tools/projects.ts:38-43 (handler)The main handler for the get_project tool. Takes an object with `id` (positive integer) and optional `embed` string, and fetches a single project (case) from Capsule's API via GET /kases/{id}. Returns the `data` containing the `kase` object.
export async function getProject(input: z.infer<typeof getProjectSchema>) { const { data } = await capsuleGet<{ kase: unknown }>(`/kases/${input.id}`, { embed: input.embed, }); return data; } - src/tools/projects.ts:33-36 (schema)Zod schema for the get_project tool input: requires a positive integer `id` and an optional `embed` string (for embedding tags/fields in the response).
export const getProjectSchema = z.object({ id: z.number().int().positive(), embed: z.string().optional().describe(EMBED_TAGS_FIELDS_DESCRIPTION), }); - src/server.ts:502-508 (registration)Registration of the get_project tool on the MCP server via the registerTool helper, with name 'get_project', description 'Fetch a single project (case) by its numeric ID.', and the exported schema and handler from projects.ts.
registerTool( server, "get_project", "Fetch a single project (case) by its numeric ID.", getProjectSchema, getProject, ); - The fieldsArrayDescriptor helper function used to generate per-tool descriptions for the 'fields' parameter. Called with 'get_project' in updateProjectSchema to reference get_project in the field-setting description.
export function fieldsArrayDescriptor(entityToolName: string): string { return ( "Set custom field values on this record. PARTIAL UPDATE: only the definitions you list are touched; any field NOT in this array is left unchanged. " + `Discover available definitions via list_custom_fields; read current values via ${entityToolName} with embed='fields'.` ); } - src/server/register-tool.ts:13-39 (helper)Generic registerTool helper that wraps a handler's return value in MCP text-content response format and registers it with the server.
* while editing description text. * * The exception is `get_attachment` — its handler does * content-type-aware response shaping (image vs text vs binary) and * needs the raw `server.tool(...)` call. That registration stays * inline. */ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import type { z, ZodRawShape } from "zod"; /** Wrap a handler's return value in the MCP `content: [{text}]` shape. */ function wrapAsText(result: unknown): { content: Array<{ type: "text"; text: string }>; } { return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; } /** * Register an MCP tool whose handler takes a zod-typed input and * returns any JSON-serialisable value. The value gets wrapped in the * standard MCP text-content response. */ export function registerTool<Schema extends z.ZodObject<ZodRawShape>>(