lazarus.clean
Clean Lazarus build artifacts to remove temporary files and reduce project size. Specify a Lazarus project file path to execute lazbuild --clean command.
Instructions
Clean Lazarus build artifacts using lazbuild --clean
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | Yes | Path to a Lazarus project file (.lpi) | |
| lazbuildPath | No | Path to lazbuild (defaults to "lazbuild") |
Implementation Reference
- src/server.ts:289-301 (handler)The inline asynchronous handler function for the 'lazarus.clean' MCP tool. It calls the lazarusClean helper, processes the result, and returns a formatted MCP response with stdout/stderr and success status.}, async (req: any) => { const { code, stdout, stderr } = await lazarusClean(req); const ok = code === 0; return { content: [ { type: 'text', text: ok ? `Lazarus clean succeeded for ${basename(req.project)}` : `Lazarus clean failed for ${basename(req.project)}` }, { type: 'text', text: `Exit code: ${code}` }, { type: 'text', text: '--- STDOUT ---\n' + stdout }, { type: 'text', text: '--- STDERR ---\n' + stderr } ], isError: !ok }; });
- src/server.ts:196-207 (helper)The main helper function implementing the clean logic by running 'lazbuild --clean' on the Lazarus project file (.lpi), with validation and proper working directory.async function lazarusClean({ project, lazbuildPath }: { project: string; lazbuildPath?: string; }) { const projPath = resolve(project); if (!existsSync(projPath)) { throw new Error(`Project not found: ${projPath}`); } if (!isLazarusProject(projPath)) { throw new Error('Unsupported project type. Provide a .lpi file'); } const args: string[] = ['--clean', '"' + projPath + '"']; const lazbuild = lazbuildPath || 'lazbuild'; return await runCommand(lazbuild, args, { cwd: dirname(projPath) }); }
- src/server.ts:64-67 (schema)Zod-based input schema defining the parameters for the lazarus.clean tool: required project path and optional lazbuild path.const LazarusCleanInput = { project: z.string().describe('Path to a Lazarus project file (.lpi)'), lazbuildPath: z.string().optional().describe('Path to lazbuild (defaults to "lazbuild")') };
- src/server.ts:286-289 (registration)The mcpServer.registerTool call that registers the 'lazarus.clean' tool with its description, input schema, and handler function.mcpServer.registerTool('lazarus.clean', { description: 'Clean Lazarus build artifacts using lazbuild --clean', inputSchema: LazarusCleanInput, }, async (req: any) => {