Skip to main content
Glama

update_variable

Update a Codemagic environment variable by specifying its app ID, variable ID, key, new value, group, and secure flag.

Instructions

Update an existing environment variable for a Codemagic application.

Args: app_id: The Codemagic application ID. variable_id: The variable ID to update. key: The variable name. value: The new variable value. group: The variable group name. secure: Whether the variable should be encrypted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
app_idYes
variable_idYes
keyYes
valueYes
groupYes
secureNo

Implementation Reference

  • MCP tool handler for update_variable - receives app_id, variable_id, key, value, group, secure and delegates to the CodemagicClient.
    @mcp.tool()
    async def update_variable(
        app_id: str,
        variable_id: str,
        key: str,
        value: str,
        group: str,
        secure: bool = False,
    ) -> Any:
        """Update an existing environment variable for a Codemagic application.
    
        Args:
            app_id: The Codemagic application ID.
            variable_id: The variable ID to update.
            key: The variable name.
            value: The new variable value.
            group: The variable group name.
            secure: Whether the variable should be encrypted.
        """
        async with CodemagicClient() as client:
            return await client.update_variable(
                app_id=app_id,
                variable_id=variable_id,
                key=key,
                value=value,
                group=group,
                secure=secure,
            )
  • Client method implementing the actual API call - sends PUT to /apps/{app_id}/variables/{variable_id} with the variable data.
    async def update_variable(
        self,
        app_id: str,
        variable_id: str,
        key: str,
        value: str,
        group: str,
        secure: bool = False,
    ) -> Any:
        return await self._put(
            f"/apps/{app_id}/variables/{variable_id}",
            json={"key": key, "value": value, "group": group, "secure": secure},
        )
  • Registration chain: register_all_tools -> variables.register(mcp) is called, which registers update_variable via @mcp.tool() decorator.
    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)
  • Entry point: server.py imports register_all_tools and calls it with the mcp instance, initiating tool registration.
    from codemagic_mcp.tools import register_all_tools
    
    
    async def _step_log_cleanup_loop() -> None:
        while True:
            async with CodemagicClient() as client:
                client.cleanup_step_log_artifacts()
            await asyncio.sleep(settings.codemagic_log_cleanup_interval_seconds)
    
    
    @asynccontextmanager
    async def lifespan(_: FastMCP):
        async with CodemagicClient() as client:
            client.cleanup_step_log_artifacts()
    
        cleanup_task = asyncio.create_task(_step_log_cleanup_loop())
        try:
            yield
        finally:
            cleanup_task.cancel()
            with suppress(asyncio.CancelledError):
                await cleanup_task
    
    
    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)
Behavior2/5

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

No annotations exist, and the description lacks behavioral details such as idempotency, error handling (e.g., if variable doesn't exist), authorization needs, or side effects beyond the basic update operation.

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 concise, front-loaded with the purpose, and lists parameters in a clean bullet-style format with no wasted words.

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?

Given the 6 parameters and no output schema or annotations, the description only covers basic purpose and parameter meanings, omitting details like update semantics (partial vs full) and success/failure scenarios.

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?

The description adds brief one-line explanations for each parameter, compensating for the 0% schema description coverage, but lacks constraints, examples, or additional context beyond the parameter names.

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 tool updates an existing environment variable for a Codemagic application, distinguishing it from sibling tools like add_variable and delete_variable.

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 through the verb 'update' but provides no explicit guidance on when to use this tool versus alternatives, nor any exclusions or prerequisites.

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/AgiMaulana/CodemagicMcp'

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