delete_variable
Remove a specific environment variable from a Codemagic app using its app ID and variable ID.
Instructions
Delete an environment variable from a Codemagic application.
Args: app_id: The Codemagic application ID. variable_id: The variable ID to delete.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ||
| variable_id | Yes |
Implementation Reference
- codemagic_mcp/tools/variables.py:75-84 (handler)The MCP tool handler for 'delete_variable'. Registered as a tool with destructiveHint=True annotation. Calls client.delete_variable to execute the deletion.
@mcp.tool(annotations=ToolAnnotations(destructiveHint=True)) async def delete_variable(app_id: str, variable_id: str) -> Any: """Delete an environment variable from a Codemagic application. Args: app_id: The Codemagic application ID. variable_id: The variable ID to delete. """ async with CodemagicClient() as client: return await client.delete_variable(app_id, variable_id) - codemagic_mcp/client.py:456-457 (helper)The HTTP client method that executes the API call. Sends a DELETE request to /apps/{app_id}/variables/{variable_id}.
async def delete_variable(self, app_id: str, variable_id: str) -> Any: return await self._delete(f"/apps/{app_id}/variables/{variable_id}") - codemagic_mcp/tools/__init__.py:6-12 (registration)Registration entry point. register_all_tools calls variables.register(mcp) which registers the delete_variable tool.
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-41 (helper)Server initialization and instructions listing delete_variable as one of the destructive operations requiring user confirmation.
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, )