clear_scratch
Remove temporary scratch notes from the MCP Contemplation server to reset or clear background cognitive processing data between Claude's interactions.
Instructions
Clear temporary scratch notes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:337-354 (handler)The core handler function in ContemplationManager class that implements the logic to clear temporary scratch notes by recursively deleting files in the contemplation tmp directory and returns the number of files cleared.async clearScratch(): Promise<number> { const scratchPath = '/Users/bard/Code/contemplation-loop/tmp/contemplation'; let count = 0; try { const days = fs.readdirSync(scratchPath); for (const day of days) { const dayPath = path.join(scratchPath, day); const files = fs.readdirSync(dayPath); count += files.length; fs.rmSync(dayPath, { recursive: true, force: true }); } } catch (e) { // Directory might not exist } return count; }
- src/index.ts:473-480 (registration)Registration of the 'clear_scratch' tool in the ListTools response, including name, description, and input schema (no parameters required).{ name: 'clear_scratch', description: 'Clear temporary scratch notes', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:476-479 (schema)Input schema definition for the clear_scratch tool: an empty object indicating no input parameters are required.inputSchema: { type: 'object', properties: {}, },
- src/index.ts:564-569 (handler)Top-level handler case in the CallToolRequestHandler switch statement that invokes the clearScratch method and returns a formatted text response with the count of cleared files.case 'clear_scratch': { const count = await contemplation.clearScratch(); return { content: [{ type: 'text', text: `Cleared ${count} scratch files` }], }; }
- src/index.ts:60-62 (helper)Documentation comment describing the clear_scratch tool functionality.### clear_scratch() Clears temporary scratch notes (keeps Obsidian permanent notes). Returns: Number of files cleared