Skip to main content
Glama

swift_package_clean

Removes Swift Package build artifacts and derived data to free up storage and improve build performance. Specify the package root path to initiate the cleanup process.

Instructions

Cleans Swift Package build artifacts and derived data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packagePathYesPath to the Swift package root (Required)

Implementation Reference

  • Executes the 'swift package clean' command on the specified package path using a command executor. Handles success and error responses with formatted output.
    export async function swift_package_cleanLogic( params: SwiftPackageCleanParams, executor: CommandExecutor, ): Promise<ToolResponse> { const resolvedPath = path.resolve(params.packagePath); const swiftArgs = ['package', '--package-path', resolvedPath, 'clean']; log('info', `Running swift ${swiftArgs.join(' ')}`); try { const result = await executor(['swift', ...swiftArgs], 'Swift Package Clean', true, undefined); if (!result.success) { const errorMessage = result.error ?? result.output ?? 'Unknown error'; return createErrorResponse('Swift package clean failed', errorMessage); } return { content: [ { type: 'text', text: '✅ Swift package cleaned successfully.' }, { type: 'text', text: '💡 Build artifacts and derived data removed. Ready for fresh build.', }, { type: 'text', text: result.output || '(clean completed silently)' }, ], isError: false, }; } catch (error) { const message = error instanceof Error ? error.message : String(error); log('error', `Swift package clean failed: ${message}`); return createErrorResponse('Failed to execute swift package clean', message); } }
  • Zod schema defining the input parameters for the tool: packagePath (string, required).
    const swiftPackageCleanSchema = z.object({ packagePath: z.string().describe('Path to the Swift package root (Required)'), });
  • Registers the tool with name, description, schema, and wraps the handler using createTypedTool for MCP compatibility.
    export default { name: 'swift_package_clean', description: 'Cleans Swift Package build artifacts and derived data', schema: swiftPackageCleanSchema.shape, // MCP SDK compatibility handler: createTypedTool( swiftPackageCleanSchema, swift_package_cleanLogic, getDefaultCommandExecutor, ), };

Other Tools

Related 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/cameroncooke/XcodeBuildMCP'

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