Skip to main content
Glama

clean_ws

Cleans Xcode build products for a specific workspace using xcodebuild. Specify workspace path; scheme and configuration are optional.

Instructions

Cleans build products for a specific workspace using xcodebuild. IMPORTANT: Requires workspacePath. Scheme/Configuration are optional. Example: clean_ws({ workspacePath: '/path/to/MyProject.xcworkspace', scheme: 'MyScheme' })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspacePathYesPath to the .xcworkspace file (Required)
schemeNoOptional: The scheme to clean
configurationNoOptional: Build configuration to clean (Debug, Release, etc.)
derivedDataPathNoOptional: Path where derived data might be located
extraArgsNoAdditional xcodebuild arguments

Implementation Reference

  • Core handler function that executes the xcodebuild clean command for workspaces or projects.
    async function _handleCleanLogic(params: {
      workspacePath?: string;
      projectPath?: string;
      scheme?: string;
      configuration?: string;
      derivedDataPath?: string;
      extraArgs?: string[];
    }): Promise<ToolResponse> {
      log('info', 'Starting xcodebuild clean request (internal)');
    
      // For clean operations, we need to provide a default platform and configuration
      return executeXcodeBuildCommand(
        {
          ...params,
          scheme: params.scheme || '', // Empty string if not provided
          configuration: params.configuration || 'Debug', // Default to Debug if not provided
        },
        {
          platform: XcodePlatform.macOS, // Default to macOS, but this doesn't matter much for clean
          logPrefix: 'Clean',
        },
        false,
        'clean', // Specify 'clean' as the build action
      );
    }
  • Zod input schema defining parameters for the clean_ws tool, including required workspacePath.
      workspacePath: z.string().describe('Path to the .xcworkspace file (Required)'),
      scheme: z.string().optional().describe('Optional: The scheme to clean'),
      configuration: z
        .string()
        .optional()
        .describe('Optional: Build configuration to clean (Debug, Release, etc.)'),
      derivedDataPath: z
        .string()
        .optional()
        .describe('Optional: Path where derived data might be located'),
      extraArgs: z.array(z.string()).optional().describe('Additional xcodebuild arguments'),
    },
  • Direct registration of the 'clean_ws' tool on the MCP server, specifying name, description, input schema, and handler function.
      'clean_ws',
      "Cleans build products for a specific workspace using xcodebuild. IMPORTANT: Requires workspacePath. Scheme/Configuration are optional. Example: clean_ws({ workspacePath: '/path/to/MyProject.xcworkspace', scheme: 'MyScheme' })",
      {
        workspacePath: z.string().describe('Path to the .xcworkspace file (Required)'),
        scheme: z.string().optional().describe('Optional: The scheme to clean'),
        configuration: z
          .string()
          .optional()
          .describe('Optional: Build configuration to clean (Debug, Release, etc.)'),
        derivedDataPath: z
          .string()
          .optional()
          .describe('Optional: Path where derived data might be located'),
        extraArgs: z.array(z.string()).optional().describe('Additional xcodebuild arguments'),
      },
      (params) => _handleCleanLogic(params),
    );
  • Configuration entry in toolRegistrations array that enables registration of the clean_ws tool via registerCleanWorkspaceTool when the corresponding environment variable is set.
    register: registerCleanWorkspaceTool,
    groups: [
      ToolGroup.MACOS_WORKFLOW,
      ToolGroup.IOS_SIMULATOR_WORKFLOW,
      ToolGroup.IOS_DEVICE_WORKFLOW,
    ],
    envVar: 'XCODEBUILDMCP_TOOL_CLEAN_WORKSPACE',
Behavior2/5

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

With no annotations provided, the description carries full burden of behavioral disclosure. While it mentions the required workspacePath parameter, it doesn't describe what 'clean' actually does (deletes derived data, build artifacts), whether it's destructive (it is), what permissions are needed, or what happens on success/failure. The example shows syntax but lacks behavioral context.

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 efficiently structured with two sentences: first states purpose and key requirement, second provides example usage. Every element earns its place with no redundant information. The example is appropriately brief and illustrative.

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

Completeness3/5

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

For a destructive operation tool with no annotations and no output schema, the description is adequate but incomplete. It covers the basic purpose and parameter requirements but lacks critical behavioral information about what 'clean' entails, success/failure outcomes, or system impact. Given the complexity of a build system tool, more context would be helpful.

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 100%, so the schema already documents all 5 parameters thoroughly. The description adds minimal value beyond the schema by emphasizing workspacePath as required and scheme/configuration as optional, but doesn't provide additional semantic context about parameter usage or interactions.

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 ('Cleans build products'), target resource ('for a specific workspace'), and implementation method ('using xcodebuild'). It distinguishes from sibling tools like 'clean_proj' by specifying workspace cleaning rather than project cleaning.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool (when cleaning workspace build products) and explicitly states that workspacePath is required while scheme/configuration are optional. However, it doesn't explicitly mention when NOT to use it or name specific alternatives like 'clean_proj' for project cleaning.

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

Install Server

Other Tools

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/SampsonKY/XcodeBuildMCP'

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