Skip to main content
Glama
flydev-fr
by flydev-fr

delphi.clean

Clean Delphi project files (.dproj/.groupproj) using MSBuild with RAD Studio environment to remove intermediate build artifacts and prepare for fresh compilation.

Instructions

Clean a Delphi .dproj or .groupproj using MSBuild with RAD Studio environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesPath to a Delphi .dproj or .groupproj file
configurationNo
platformNoWin64
msbuildPathNo
rsvarsPathNo

Implementation Reference

  • The main handler function that performs the Delphi clean operation using MSBuild, including project validation, argument construction, and execution with optional RAD Studio environment setup via rsvars.bat.
    async function cleanWithMSBuild({ project, configuration, platform, msbuildPath, rsvarsPath }: { project: string; configuration?: string; platform?: string; msbuildPath?: string; rsvarsPath?: string; }) { const projPath = resolve(project); if (!existsSync(projPath)) { throw new Error(`Project not found: ${projPath}`); } if (!isDelphiProject(projPath)) { throw new Error('Unsupported project type. Provide a .dproj or .groupproj file'); } const { rsvars, msbuild } = resolveDefaults(); const rsvarsFinal = rsvarsPath || rsvars; const msbuildFinal = msbuildPath || msbuild || 'msbuild'; const args = [ '"' + projPath + '"', '/t:Clean', configuration ? `/p:Config=${configuration}` : '', platform ? `/p:Platform=${platform}` : '' ].filter(Boolean); if (rsvarsFinal && existsSync(rsvarsFinal)) { const cmd = 'cmd'; const composite = [ '/s', '/c', `"@echo off && call \"${rsvarsFinal}\" && ${msbuildFinal} ${args.join(' ')}"` ]; return await runCommand(cmd, composite); } return await runCommand(msbuildFinal, args); }
  • Zod-based input schema defining parameters for the delphi.clean tool: required project path and optional configuration, platform, msbuild path, and rsvars path.
    const CleanInput = { project: z.string().describe('Path to a Delphi .dproj or .groupproj file'), configuration: z.string().optional(), platform: z.string().optional().default(process.env.DELPHI_PLATFORM || 'Win32'), msbuildPath: z.string().optional(), rsvarsPath: z.string().optional() };
  • src/server.ts:233-248 (registration)
    Registers the delphi.clean tool with the MCP server, linking the schema and execution handler that formats the command output.
    mcpServer.registerTool('delphi.clean', { description: 'Clean a Delphi .dproj or .groupproj using MSBuild with RAD Studio environment', inputSchema: CleanInput, }, async (req: any) => { const { code, stdout, stderr } = await cleanWithMSBuild(req); const ok = code === 0; return { content: [ { type: 'text', text: ok ? `Clean succeeded for ${basename(req.project)}` : `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 }; });
  • Helper function used to validate if the provided project file is a Delphi project by checking extension.
    function isDelphiProject(file: string) { const ext = extname(file).toLowerCase(); return ext === '.dproj' || ext === '.groupproj'; }
  • Helper function to load default paths for rsvars.bat and MSBuild from environment variables.
    function resolveDefaults() { const rsvars = process.env.RSVARS_BAT || process.env.RSVARS_PATH; const msbuild = process.env.MSBUILD_PATH; return { rsvars, msbuild }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/flydev-fr/mcp-delphi'

If you have feedback or need assistance with the MCP directory API, please join our Discord server