delete_code_examples
Remove specific programming language examples from stored coding patterns to maintain clean, relevant pattern libraries for AI-assisted development.
Instructions
Delete specific code examples from patterns
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deletions | Yes |
Implementation Reference
- src/index.ts:101-112 (handler)The deleteCodeExamples method in PatternsManager class that executes the tool logic - loads the database, iterates through deletions array, finds patterns by name, and deletes specified language code examples, then saves the database.
async deleteCodeExamples(deletions: { patternName: string; languages: string[] }[]): Promise<void> { const database = await this.loadDatabase(); deletions.forEach(d => { const pattern = database.patterns.find(p => p.name === d.patternName); if (pattern) { d.languages.forEach(language => { delete pattern.code_examples[language]; }); } }); await this.saveDatabase(database); } - src/index.ts:237-260 (schema)The input schema definition for delete_code_examples tool - defines the expected input structure with 'deletions' array containing objects with patternName and languages fields.
name: "delete_code_examples", description: "Delete specific code examples from patterns", inputSchema: { type: "object", properties: { deletions: { type: "array", items: { type: "object", properties: { patternName: { type: "string", description: "The name of the pattern containing the examples" }, languages: { type: "array", items: { type: "string" }, description: "An array of programming languages to remove examples for" }, }, required: ["patternName", "languages"], }, }, }, required: ["deletions"], }, }, - src/index.ts:237-260 (registration)Registration of the delete_code_examples tool in the ListToolsRequestSchema handler - defines tool name, description, and input schema.
name: "delete_code_examples", description: "Delete specific code examples from patterns", inputSchema: { type: "object", properties: { deletions: { type: "array", items: { type: "object", properties: { patternName: { type: "string", description: "The name of the pattern containing the examples" }, languages: { type: "array", items: { type: "string" }, description: "An array of programming languages to remove examples for" }, }, required: ["patternName", "languages"], }, }, }, required: ["deletions"], }, }, - src/index.ts:314-316 (handler)The case handler in CallToolRequestSchema that invokes the deleteCodeExamples method with the deletions argument and returns a success message.
case "delete_code_examples": await patternsManager.deleteCodeExamples(args.deletions as { patternName: string; languages: string[] }[]); return { content: [{ type: "text", text: "Code examples deleted successfully" }] };