update_track
Update specific fields of a track, such as marking it complete, by providing only the fields to change using partial PUT semantics.
Instructions
Update a track instance. Capsule's PUT semantics are partial — provide only the fields you want to change in fields. Common: { complete: true } to mark a track completed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trackId | Yes | ||
| fields | Yes | Object of fields to update on the track. Capsule's PUT semantics are partial — only the fields you provide are changed. Common: { complete: true } to mark a track completed. Capsule rejects unknown keys; consult Capsule's docs for the full updatable set. |
Implementation Reference
- src/tools/tracks.ts:119-126 (handler)The core handler function that updates a track instance by sending a PUT request to Capsule CRM's /tracks/{trackId} endpoint. It validates that at least one field is provided, then passes the fields through to the Capsule API.
export async function updateTrack(input: z.infer<typeof updateTrackSchema>) { if (Object.keys(input.fields).length === 0) { throw new Error("update_track: provide at least one field in `fields`"); } return capsulePut<{ track: unknown }>(`/tracks/${input.trackId}`, { track: input.fields, }); } - src/tools/tracks.ts:108-117 (schema)Zod schema defining the input for update_track: requires a numeric trackId and a record of fields to update. The fields use partial PUT semantics (only provided fields are changed).
export const updateTrackSchema = z.object({ trackId: z.number().int().positive(), fields: z // zod 4: z.record requires an explicit key schema (was implicit // string in zod 3). Capsule field names are strings. .record(z.string(), z.unknown()) .describe( "Object of fields to update on the track. Capsule's PUT semantics are partial — only the fields you provide are changed. Common: { complete: true } to mark a track completed. Capsule rejects unknown keys; consult Capsule's docs for the full updatable set.", ), }); - src/server.ts:577-583 (registration)Registration of the 'update_track' tool with the MCP server, mapping the tool name to its schema and handler via the registerTool helper.
registerTool( server, "update_track", "Update a track instance. Capsule's PUT semantics are partial — provide only the fields you want to change in `fields`. Common: { complete: true } to mark a track completed.", updateTrackSchema, updateTrack, ); - src/server.ts:172-183 (registration)Import of updateTrackSchema and updateTrack from the tracks module into the server configuration.
import { listEntityTracksSchema, listEntityTracks, showTrackSchema, showTrack, applyTrackSchema, applyTrack, updateTrackSchema, updateTrack, removeTrackSchema, removeTrack, } from "./tools/tracks.js"; - src/server/register-tool.ts:39-59 (helper)Generic helper function used to register all tools (including update_track). It wraps the handler's return value in the standard MCP text-content response shape.
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); }); }