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

delphi.build

Build Delphi .dproj or .groupproj projects using MSBuild with RAD Studio environment configuration for Windows development workflows.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesPath to a Delphi .dproj or .groupproj file
configurationNoRelease
platformNoWin64
msbuildPathNoOptional path to msbuild.exe to use
rsvarsPathNoOptional path to rsvars.bat to initialize RAD Studio env

Implementation Reference

  • Core handler function that executes the Delphi project build using MSBuild, including environment setup with rsvars.bat, argument preparation, and command execution.
    async function buildWithMSBuild({ 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';
    
      // Prepare MSBuild arguments
      const args = [
        '"' + projPath + '"',
        '/t:Build',
        configuration ? `/p:Config=${configuration}` : '',
        platform ? `/p:Platform=${platform}` : ''
      ].filter(Boolean);
    
      // If rsvars is available, run in a single shell using cmd and call
      if (rsvarsFinal && existsSync(rsvarsFinal)) {
        const cmd = 'cmd';
        const composite = [
          '/s', '/c',
          `"@echo off && call \"${rsvarsFinal}\" && ${msbuildFinal} ${args.join(' ')}"`
        ];
        return await runCommand(cmd, composite);
      }
    
      // Otherwise, rely on msbuild directly (if in PATH or explicit)
      return await runCommand(msbuildFinal, args);
    }
  • Zod-based input schema defining parameters for the delphi.build tool: project path, configuration, platform, msbuild and rsvars paths.
    const BuildInput = {
      project: z.string().describe('Path to a Delphi .dproj or .groupproj file'),
      configuration: z.string().optional().default(process.env.DELPHI_CONFIG || 'Release'),
      platform: z.string().optional().default(process.env.DELPHI_PLATFORM || 'Win32'),
      msbuildPath: z.string().optional().describe('Optional path to msbuild.exe to use'),
      rsvarsPath: z.string().optional().describe('Optional path to rsvars.bat to initialize RAD Studio env')
    };
  • src/server.ts:216-231 (registration)
    MCP server registration of the 'delphi.build' tool, specifying description, input schema, and inline handler that calls buildWithMSBuild and formats the response.
    mcpServer.registerTool('delphi.build', {
      description: 'Build a Delphi .dproj or .groupproj using MSBuild with RAD Studio environment',
      inputSchema: BuildInput,
    }, async (req: any) => {
      const { code, stdout, stderr } = await buildWithMSBuild(req);
      const ok = code === 0;
      return {
        content: [
          { type: 'text', text: ok ? `Build succeeded for ${basename(req.project)}` : `Build 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
      };
    });
  • Utility function to spawn and manage child processes for running build commands, capturing stdout, stderr, and exit code.
    function runCommand(cmd: string, args: string[], options: { cwd?: string, env?: NodeJS.ProcessEnv } = {}) {
      return new Promise<{ code: number | null, stdout: string, stderr: string }>((resolvePromise) => {
        const child = spawn(cmd, args, {
          cwd: options.cwd,
          env: { ...process.env, ...options.env },
          shell: true, // allow .bat/.cmd wrappers on Windows
          windowsHide: true
        });
        let stdout = '';
        let stderr = '';
        child.stdout.on('data', (d) => { stdout += d.toString(); });
        child.stderr.on('data', (d) => { stderr += d.toString(); });
        child.on('close', (code) => resolvePromise({ code, stdout, stderr }));
      });
    }
  • Helper to check if a file is a Delphi project file (.dproj or .groupproj).
    function isDelphiProject(file: string) {
      const ext = extname(file).toLowerCase();
      return ext === '.dproj' || ext === '.groupproj';
  • Helper to resolve 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

B3.4/5.0
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions the build action but doesn't disclose behavioral traits like whether this is a long-running operation, what happens on failure, if it modifies source files, or what output is produced. For a build tool with zero annotation coverage, this is a significant gap in behavioral disclosure.

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 purpose. Every word earns its place: 'Build' (action), 'Delphi .dproj or .groupproj' (target), 'using MSBuild with RAD Studio environment' (method). No wasted words or redundant information.

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?

For a build tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, what happens during execution, error conditions, or dependencies. The description provides basic purpose but lacks the contextual information needed for effective tool invocation in a complex build scenario.

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

Parameters3/5

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

Schema description coverage is 60% (3 of 5 parameters have descriptions). The description adds no additional parameter semantics beyond what's in the schema. It mentions MSBuild and RAD Studio environment which relate to 'msbuildPath' and 'rsvarsPath' parameters, but doesn't explain their purpose or relationships. With moderate schema coverage, the baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the specific action ('Build'), target resources ('.dproj or .groupproj'), and method ('using MSBuild with RAD Studio environment'). It distinguishes from sibling tools like 'delphi.clean' by focusing on building rather than cleaning, and from 'fpc.build' and 'lazarus.build' by specifying Delphi/RAD Studio instead of Free Pascal/Lazarus.

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

Usage Guidelines3/5

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

The description implies usage context (building Delphi projects with MSBuild/RAD Studio) but doesn't explicitly state when to use this tool versus alternatives. It doesn't mention when to prefer 'delphi.clean' first or when to use 'fpc.build' for Free Pascal projects instead. The context is clear but lacks explicit guidance on tool selection.

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