Skip to main content
Glama
knishioka

Treasure Data MCP Server

by knishioka

td_get_attempt

Retrieve workflow execution details to investigate specific run instances, including status, timing, retry information, and parameters for debugging purposes.

Instructions

Get workflow attempt details to investigate specific execution instance.

An attempt is one execution try of a scheduled session. Use when you have an
attempt ID from error logs or td_get_session and need execution details.

Common scenarios:
- Investigate why a workflow execution failed
- Check how long the execution took
- See if this was a retry after previous failure
- Get execution parameters for debugging

Returns attempt status, timing, retry info, and safe execution parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
attempt_idYes

Implementation Reference

  • The handler function implementing the td_get_attempt tool. It retrieves workflow attempt details from the Treasure Data client, calculates duration, filters sensitive params, and handles errors.
    async def td_get_attempt(attempt_id: str) -> dict[str, Any]:
        """Get workflow attempt details to investigate specific execution instance.
    
        An attempt is one execution try of a scheduled session. Use when you have an
        attempt ID from error logs or td_get_session and need execution details.
    
        Common scenarios:
        - Investigate why a workflow execution failed
        - Check how long the execution took
        - See if this was a retry after previous failure
        - Get execution parameters for debugging
    
        Returns attempt status, timing, retry info, and safe execution parameters.
        """
        if not attempt_id or not attempt_id.strip():
            return _format_error_response("Attempt ID cannot be empty")
    
        client = _create_client(include_workflow=True)
        if isinstance(client, dict):
            return client
    
        try:
            attempt = client.get_attempt(attempt_id)
    
            if attempt:
                result = {
                    "type": "attempt",
                    "attempt": {
                        "id": attempt.id,
                        "index": attempt.index,
                        "project": attempt.project,
                        "workflow": attempt.workflow,
                        "session_id": attempt.session_id,
                        "session_time": attempt.session_time,
                        "retry_attempt_name": attempt.retry_attempt_name,
                        "done": attempt.done,
                        "success": attempt.success,
                        "status": attempt.status,
                        "created_at": attempt.created_at,
                        "finished_at": attempt.finished_at,
                    },
                }
    
                # Add duration if finished
                if attempt.created_at and attempt.finished_at:
                    try:
                        from datetime import datetime
    
                        created = datetime.fromisoformat(
                            attempt.created_at.replace("Z", "+00:00")
                        )
                        finished = datetime.fromisoformat(
                            attempt.finished_at.replace("Z", "+00:00")
                        )
                        duration = finished - created
                        result["attempt"]["duration_seconds"] = duration.total_seconds()
                    except Exception:
                        pass  # Ignore date parsing errors
    
                # Add non-sensitive parameters
                if attempt.params:
                    # Filter out sensitive parameters
                    safe_params = {
                        k: v
                        for k, v in attempt.params.items()
                        if not any(
                            sensitive in k.lower()
                            for sensitive in ["email", "ip", "user_id", "token", "key"]
                        )
                    }
                    if safe_params:
                        result["attempt"]["params"] = safe_params
    
                return result
            else:
                return _format_error_response(f"Attempt with ID '{attempt_id}' not found")
    
        except Exception as e:
            return _format_error_response(f"Failed to get attempt: {str(e)}")
  • Registration of execution tools including td_get_attempt using the mcp.tool() decorator within the register_execution_tools function.
    mcp.tool()(td_get_session)
    mcp.tool()(td_list_sessions)
    mcp.tool()(td_get_attempt)
    mcp.tool()(td_get_attempt_tasks)
    mcp.tool()(td_analyze_execution)
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's read-only nature (implied by 'get' and 'investigate') and specifies what information is returned ('attempt status, timing, retry info, and safe execution parameters'). However, it doesn't mention potential limitations like rate limits, authentication requirements, or error handling for invalid attempt IDs.

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 well-structured and front-loaded with the core purpose, followed by usage guidance and scenarios. Every sentence adds value: the first defines the tool, the second explains when to use it, the bullet points illustrate use cases, and the final sentence clarifies return values. There is no wasted text.

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

Completeness4/5

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

Given the tool's moderate complexity (single parameter, no annotations, no output schema), the description is largely complete. It covers purpose, usage, and return values adequately. However, without an output schema, it could benefit from more detail on the structure of returned data (e.g., specific fields in 'attempt status' or 'timing'), though the mention of 'safe execution parameters' hints at security considerations.

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?

The input schema has 0% description coverage (no parameter descriptions), but the description compensates by explaining the semantics of the single parameter 'attempt_id'—it's obtained 'from error logs or td_get_session' and used to 'investigate specific execution instance.' This adds meaningful context beyond the schema's basic type information, though it doesn't specify format constraints (e.g., UUID).

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 with specific verbs ('get', 'investigate') and resource ('workflow attempt details'), distinguishing it from siblings like td_get_session (which provides session info) and td_get_attempt_tasks (which focuses on tasks within an attempt). It explicitly defines what an attempt is ('one execution try of a scheduled session'), avoiding tautology.

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 provides explicit guidance on when to use this tool ('when you have an attempt ID from error logs or td_get_session and need execution details') and lists four common scenarios. It also distinguishes from alternatives by referencing td_get_session as a source for attempt IDs, though it doesn't explicitly say when not to use it.

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/knishioka/td-mcp-server'

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