Skip to main content
Glama

get_step_log_artifact

Check whether a managed step log artifact exists for a given build step. Uses deterministic artifact ID; does not fetch from Codemagic.

Instructions

Check whether a managed step log artifact exists for a build step.

This tool only inspects the local managed artifact created by get_step_logs(..., delivery="file"). It does not fetch from Codemagic, recreate missing files, or return log contents inline.

The returned artifact metadata includes a deterministic artifact_id: artifact_<build_id>_<step_id>

Args: build_id: The Codemagic build ID. step_id: The step ID (from get_build_logs output).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
build_idYes
step_idYes

Implementation Reference

  • Client-side handler that delegates to _inspect_step_log_artifact to check if a step log file exists locally and return its metadata or a 'missing' status.
    def get_step_log_artifact(self, build_id: str, step_id: str) -> dict[str, Any]:
        return self._inspect_step_log_artifact(build_id, step_id)
  • Internal inspection logic that checks file existence, expiration, and returns the artifact metadata schema (available or missing status, artifact_id, file_path, bytes, line_count, expires_at).
    def _inspect_step_log_artifact(self, build_id: str, step_id: str) -> dict[str, Any]:
        destination = self._build_log_file_path(build_id, step_id)
        if not destination.exists():
            return self._build_missing_step_log_artifact_response(build_id, step_id)
    
        try:
            modified_at = datetime.fromtimestamp(destination.stat().st_mtime, tz=UTC)
        except FileNotFoundError:
            return self._build_missing_step_log_artifact_response(build_id, step_id)
    
        expires_at = self._get_expiration_time(modified_at)
        if expires_at <= datetime.now(UTC):
            try:
                destination.unlink()
            except FileNotFoundError:
                pass
            return self._build_missing_step_log_artifact_response(build_id, step_id)
    
        with destination.open("r", encoding="utf-8") as log_file:
            line_count = sum(1 for _ in log_file)
    
        return {
            "status": "available",
            "artifact_id": self._get_step_log_artifact_id(build_id, step_id),
            "file_path": str(destination),
            "bytes": destination.stat().st_size,
            "line_count": line_count,
            "expires_at": expires_at.isoformat().replace("+00:00", "Z"),
        }
  • MCP tool registration via @mcp.tool() decorator inside the builds module's register() function. The tool is registered under the name 'get_step_log_artifact'.
    @mcp.tool()
    async def get_step_log_artifact(build_id: str, step_id: str) -> Any:
        """Check whether a managed step log artifact exists for a build step.
    
        This tool only inspects the local managed artifact created by
        get_step_logs(..., delivery="file"). It does not fetch from Codemagic,
        recreate missing files, or return log contents inline.
    
        The returned artifact metadata includes a deterministic artifact_id:
        artifact_<build_id>_<step_id>
    
        Args:
            build_id: The Codemagic build ID.
            step_id: The step ID (from get_build_logs output).
        """
        async with CodemagicClient() as client:
            return client.get_step_log_artifact(build_id, step_id)
  • Helper that generates the deterministic artifact ID in the format artifact_<build_id>_<step_id>.
    def _get_step_log_artifact_id(self, build_id: str, step_id: str) -> str:
        return f"artifact_{build_id}_{step_id}"
  • Helper that builds the 'missing' response dict when a step log artifact file does not exist or has expired.
    def _build_missing_step_log_artifact_response(
        self,
        build_id: str,
        step_id: str,
    ) -> dict[str, str]:
        return {
            "status": "missing",
            "artifact_id": self._get_step_log_artifact_id(build_id, step_id),
            "reason": "not_generated_or_expired",
            "message": (
                "The step log artifact was not found. "
                "It may not have been generated, or it may have expired and been deleted."
            ),
        }
Behavior5/5

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

With no annotations, the description fully discloses behavioral traits: only inspects local artifact, no fetches, no recreation, no inline contents. It also describes the deterministic artifact_id format, adding valuable context beyond the schema.

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 and well-structured: a clear header, limitations list, and parameter details. Every sentence adds value, with no redundancy or waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple (2 params, no output schema), and the description covers all necessary aspects: purpose, usage, parameter meanings, behavioral traits, and return value (metadata with artifact_id). No gaps.

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

Parameters5/5

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

Schema description coverage is 0%, but the Args section explains both parameters: build_id as 'Codemagic build ID' and step_id as 'step ID from get_build_logs output'. This adds meaning beyond the schema's titles and types.

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's purpose: 'Check whether a managed step log artifact exists for a build step.' It specifies the action (check existence), resource (managed step log artifact), and context, distinguishing it from siblings like get_step_logs and get_build_logs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool: to inspect the local managed artifact created by get_step_logs(delivery='file'). It also clarifies limitations: does not fetch from Codemagic, recreate missing files, or return log contents inline, providing clear when-not-to-use guidance.

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