delete_all_caches
Clear all build caches for a Codemagic app to free storage or force a fresh build.
Instructions
Delete all build caches for a Codemagic application.
Args: app_id: The Codemagic application ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes |
Implementation Reference
- codemagic_mcp/tools/caches.py:20-28 (handler)The tool handler function 'delete_all_caches' registered as an MCP tool with destructiveHint=True. It takes an app_id, creates a CodemagicClient, and calls client.delete_all_caches(app_id).
@mcp.tool(annotations=ToolAnnotations(destructiveHint=True)) async def delete_all_caches(app_id: str) -> Any: """Delete all build caches for a Codemagic application. Args: app_id: The Codemagic application ID. """ async with CodemagicClient() as client: return await client.delete_all_caches(app_id) - codemagic_mcp/client.py:478-479 (helper)Client method delete_all_caches that sends a DELETE HTTP request to '/apps/{app_id}/caches'.
async def delete_all_caches(self, app_id: str) -> Any: return await self._delete(f"/apps/{app_id}/caches") - codemagic_mcp/tools/caches.py:9-39 (registration)The register() function in caches.py that registers the tool with the MCP server via the @mcp.tool() decorator.
def register(mcp: FastMCP) -> None: @mcp.tool() async def list_caches(app_id: str) -> Any: """List all build caches for a Codemagic application. Args: app_id: The Codemagic application ID. """ async with CodemagicClient() as client: return await client.list_caches(app_id) @mcp.tool(annotations=ToolAnnotations(destructiveHint=True)) async def delete_all_caches(app_id: str) -> Any: """Delete all build caches for a Codemagic application. Args: app_id: The Codemagic application ID. """ async with CodemagicClient() as client: return await client.delete_all_caches(app_id) @mcp.tool(annotations=ToolAnnotations(destructiveHint=True)) async def delete_cache(app_id: str, cache_id: str) -> Any: """Delete a specific build cache for a Codemagic application. Args: app_id: The Codemagic application ID. cache_id: The cache ID to delete. """ async with CodemagicClient() as client: return await client.delete_cache(app_id, cache_id) - codemagic_mcp/tools/__init__.py:6-12 (registration)The register_all_tools function which calls caches.register(mcp) to register all cache tools including delete_all_caches.
def register_all_tools(mcp: FastMCP) -> None: apps.register(mcp) builds.register(mcp) artifacts.register(mcp) caches.register(mcp) variables.register(mcp) webhooks.register(mcp) - codemagic_mcp/server.py:32-43 (registration)Server initialization that calls register_all_tools(mcp) and mentions delete_all_caches in its instructions as a destructive operation.
mcp = FastMCP( name="Codemagic MCP", instructions=( "Codemagic CI/CD REST API: manage builds, apps, artifacts, caches, variables, and webhooks.\n\n" "Destructive ops (delete_app, cancel_build, delete_cache, delete_all_caches, delete_variable, delete_webhook): confirm before executing.\n\n" "App ID resolution: (1) use explicit app_id; (2) use CODEMAGIC_DEFAULT_APP_ID if set (exposed as `default_app_id`); " "(3) call list_apps — auto-select if one result, else ask user." ), lifespan=lifespan, ) register_all_tools(mcp)