Skip to main content
Glama
knishioka

Treasure Data MCP Server

by knishioka

td_get_session

Retrieve workflow session details by ID to verify execution status, schedule timing, and attempt information for scheduled Treasure Data workflow runs.

Instructions

Get workflow session details by ID to check execution status and timing.

A session is a scheduled workflow run. Use when you have a session ID and need
to check if it ran successfully, when it was scheduled, or get attempt details.

Common scenarios:
- Verify if a scheduled workflow executed at the expected time
- Get the attempt ID to investigate execution details
- Check overall success/failure status

Returns session info with workflow name, schedule time, and latest attempt status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes

Implementation Reference

  • The main handler function for the 'td_get_session' tool. It takes a session_id parameter, fetches the session details from the Treasure Data client, formats the response with session and last_attempt information, and handles errors.
    async def td_get_session(session_id: str) -> dict[str, Any]:
        """Get workflow session details by ID to check execution status and timing.
    
        A session is a scheduled workflow run. Use when you have a session ID and need
        to check if it ran successfully, when it was scheduled, or get attempt details.
    
        Common scenarios:
        - Verify if a scheduled workflow executed at the expected time
        - Get the attempt ID to investigate execution details
        - Check overall success/failure status
    
        Returns session info with workflow name, schedule time, and latest attempt status.
        """
        if not session_id or not session_id.strip():
            return _format_error_response("Session ID cannot be empty")
    
        client = _create_client(include_workflow=True)
        if isinstance(client, dict):
            return client
    
        try:
            session = client.get_session(session_id)
    
            if session:
                result = {
                    "type": "session",
                    "session": {
                        "id": session.id,
                        "project": session.project,
                        "workflow": session.workflow,
                        "session_uuid": session.session_uuid,
                        "session_time": session.session_time,
                        "last_attempt": {
                            "id": session.last_attempt.id,
                            "done": session.last_attempt.done,
                            "success": session.last_attempt.success,
                            "status": session.last_attempt.status,
                            "created_at": session.last_attempt.created_at,
                            "finished_at": session.last_attempt.finished_at,
                        },
                    },
                }
                return result
            else:
                return _format_error_response(f"Session with ID '{session_id}' not found")
    
        except Exception as e:
            return _format_error_response(f"Failed to get session: {str(e)}")
  • Registration of the 'td_get_session' tool (along with related execution tools) using the mcp.tool() decorator within the register_execution_tools function.
    # Register all tools
    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?

No annotations are provided, so the description carries the full burden. It describes the tool as a read operation ('Get') and outlines what information is returned, but it lacks details on error handling, rate limits, or authentication requirements. The behavioral context is adequate but not comprehensive for a tool with no annotation coverage.

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 guidelines and common scenarios. Each sentence adds value without redundancy, making it efficient and easy to parse for an AI agent.

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 no annotations and no output schema, the description does a good job covering the tool's purpose, usage, and return values ('Returns session info with workflow name, schedule time, and latest attempt status.'). However, it could be more complete by addressing potential errors or limitations, but it's sufficient for basic understanding.

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 1 parameter with 0% description coverage, so the description must compensate. It explains that the parameter 'session_id' is used to 'Get workflow session details by ID,' adding semantic meaning beyond the schema. However, it doesn't specify format or constraints for the ID, leaving some gaps.

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 verb+resource: 'Get workflow session details by ID to check execution status and timing.' It distinguishes from sibling tools like td_list_sessions (which lists sessions) and td_get_attempt (which gets attempt details), making the scope and differentiation explicit.

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: 'Use when you have a session ID and need to check if it ran successfully, when it was scheduled, or get attempt details.' It also lists common scenarios that clarify the context, such as verifying execution times or getting attempt IDs for investigation.

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