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 };
    }

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changedv1.0.0
    • changedInput schema / properties / platform / default
      Previous value: -"Win32"New value: +"Win64"
  2. First observed

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It mentions the method (MSBuild with RAD Studio environment) but doesn't describe effects (e.g., what files are deleted, whether it's destructive, permissions needed, or error handling). For a tool with potential file system impacts, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and resource. Every word earns its place by specifying the tool's purpose without redundancy, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, low schema coverage, no annotations, no output schema), the description is incomplete. It lacks details on behavioral traits, parameter meanings, and expected outcomes, making it inadequate for safe and effective use by an AI agent without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is low (20%), with only the 'project' parameter documented. The description adds no parameter details beyond implying the project type, failing to compensate for the coverage gap. It doesn't explain 'configuration', 'platform', 'msbuildPath', or 'rsvarsPath', leaving most parameters semantically unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Clean') and the target resource ('Delphi .dproj or .groupproj'), specifying the method ('using MSBuild with RAD Studio environment'). It distinguishes from siblings like 'delphi.build' by focusing on cleaning rather than building, though it doesn't explicitly contrast with 'lazarus.clean' for non-Delphi projects.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives is provided. It implies usage for Delphi projects but doesn't specify scenarios (e.g., before rebuilding, to remove temporary files) or differentiate from 'lazarus.clean' for Lazarus projects. The description lacks context on prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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