update_context
Update context files incrementally by analyzing code changes to maintain accurate project documentation and semantic understanding.
Instructions
Incrementally update existing context files based on code changes
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>",
"changed_files": "<changed_files>",
"context_format": "<context_format>"
},
"name": "update_context"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Root directory path | |
| changed_files | Yes | List of changed file paths | |
| context_format | Yes | Context format to update | |
| force_full_regeneration | No | Force complete regeneration instead of incremental update |
Implementation Reference
- src/tools/update-context.ts:12-30 (handler)The main handler function implementing the update_context tool logic. Currently a placeholder that returns a JSON message indicating pending implementation.
export async function updateContext( args: UpdateContextArgs ): Promise<{ content: Array<{ type: string; text: string }> }> { return { content: [ { type: "text", text: JSON.stringify( { message: "Context update - implementation pending", changed_files: args.changed_files.length, }, null, 2 ), }, ], }; } - src/tools/update-context.ts:5-10 (schema)TypeScript interface defining the input parameters for the updateContext handler function.
interface UpdateContextArgs { path: string; changed_files: string[]; context_format: string; force_full_regeneration?: boolean; } - src/tools/index.ts:46-47 (registration)Dispatch case in the CallToolRequestSchema handler that routes 'update_context' calls to the updateContext function.
case "update_context": return await updateContext(args as any); - src/index.ts:170-198 (schema)JSON Schema definition and metadata for the update_context tool, provided in the ListTools response.
{ name: "update_context", description: "Incrementally update existing context files based on code changes", inputSchema: { type: "object", properties: { path: { type: "string", description: "Root directory path", }, changed_files: { type: "array", items: { type: "string" }, description: "List of changed file paths", }, context_format: { type: "string", enum: ["cursorrules", "cursor_dir", "spec_md", "agents_md"], description: "Context format to update", }, force_full_regeneration: { type: "boolean", description: "Force complete regeneration instead of incremental update", default: false, }, }, required: ["path", "changed_files", "context_format"], }, }, - src/tools/index.ts:9-9 (registration)Import statement bringing the updateContext handler into the tools dispatcher module.
import { updateContext } from "./update-context.js";