Skip to main content
Glama

add_variable

Add an environment variable to a Codemagic app. Provide name, value, group, and optionally mark as secure for secrets.

Instructions

Add an environment variable to a Codemagic application.

Args: app_id: The Codemagic application ID. key: The variable name. value: The variable value. group: The variable group name. secure: Whether the variable should be encrypted (e.g. for secrets/tokens).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
app_idYes
keyYes
valueYes
groupYes
secureNo

Implementation Reference

  • MCP tool handler that adds an environment variable to a Codemagic app. Decorated with @mcp.tool() and registered via the variables.register() function.
    @mcp.tool()
    async def add_variable(
        app_id: str,
        key: str,
        value: str,
        group: str,
        secure: bool = False,
    ) -> Any:
        """Add an environment variable to a Codemagic application.
    
        Args:
            app_id: The Codemagic application ID.
            key: The variable name.
            value: The variable value.
            group: The variable group name.
            secure: Whether the variable should be encrypted (e.g. for secrets/tokens).
        """
        async with CodemagicClient() as client:
            return await client.add_variable(
                app_id=app_id,
                key=key,
                value=value,
                group=group,
                secure=secure,
            )
  • Input schema defined by function signature: app_id (str), key (str), value (str), group (str), secure (bool, default False). Return type is Any.
    @mcp.tool()
    async def add_variable(
        app_id: str,
        key: str,
        value: str,
        group: str,
        secure: bool = False,
    ) -> Any:
  • Registration orchestration: register_all_tools() in __init__.py imports and calls variables.register(mcp), which decorates add_variable with @mcp.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)
  • API client helper in CodemagicClient class. Sends POST /apps/{app_id}/variables with the variable data payload.
    async def add_variable(
        self,
        app_id: str,
        key: str,
        value: str,
        group: str,
        secure: bool = False,
    ) -> Any:
        return await self._post(
            f"/apps/{app_id}/variables",
            json={"key": key, "value": value, "group": group, "secure": secure},
        )
Behavior3/5

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

No annotations are provided, so the description carries the burden. It explains the secure parameter's encryption behavior but lacks details on idempotency, error handling if variable already exists, or limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a single introductory sentence followed by a bullet list of parameters. It is well-structured and front-loaded, though the 'Args:' marker is slightly redundant.

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?

The description covers all parameters but is missing information about return values (no output schema) and error conditions. For a non-trivial tool with 5 parameters, this is a gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% (generic titles only). The description adds clear semantic meaning for all 5 parameters, e.g., 'group: The variable group name' and 'secure: Whether the variable should be encrypted'. This compensates well for the low schema coverage.

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 states 'Add an environment variable to a Codemagic application.' This is a specific verb and resource, clearly distinguishing it from sibling tools like update_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 provides parameter details but no explicit guidance on when to use this tool versus alternatives like update_variable. It is implied for new variables, but not stated.

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