Skip to main content
Glama
knishioka

Treasure Data MCP Server

by knishioka

td_find_workflow

Find Treasure Data workflows by name to get IDs, project information, and check execution status for monitoring or troubleshooting.

Instructions

Find workflows by name to get IDs and check execution status.

Essential for locating specific workflows when you know the name.
Returns workflow IDs, project info, and latest execution status.

Common scenarios:
- User mentions workflow name, need to find details
- Looking for failing workflows with specific names
- Finding workflows within a specific project
- Getting workflow ID before detailed analysis
- Checking if a named workflow is running/failed

Filters: project_name (optional), status ('success', 'error', 'running').
Use exact_match=True for precise names, False for partial matches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_termYes
project_nameNo
exact_matchNo
status_filterNo

Implementation Reference

  • The handler function that executes the td_find_workflow tool. It searches for workflows matching the search_term, optionally filtered by project_name, exact_match, and status_filter. Returns matching workflows with details including project info and latest execution status.
    async def td_find_workflow(
        search_term: str,
        project_name: str | None = None,
        exact_match: bool = False,
        status_filter: str | None = None,
    ) -> dict[str, Any]:
        """Find workflows by name to get IDs and check execution status.
    
        Essential for locating specific workflows when you know the name.
        Returns workflow IDs, project info, and latest execution status.
    
        Common scenarios:
        - User mentions workflow name, need to find details
        - Looking for failing workflows with specific names
        - Finding workflows within a specific project
        - Getting workflow ID before detailed analysis
        - Checking if a named workflow is running/failed
    
        Filters: project_name (optional), status ('success', 'error', 'running').
        Use exact_match=True for precise names, False for partial matches.
        """
        if not search_term or not search_term.strip():
            return _format_error_response("Search term cannot be empty")
    
        client = _create_client(include_workflow=True)
        if isinstance(client, dict):
            return client
    
        try:
            # Get workflows (up to 1000)
            workflows = client.get_workflows(count=1000, all_results=True)
    
            found_workflows = []
            search_lower = search_term.lower()
            project_lower = project_name.lower() if project_name else None
    
            for workflow in workflows:
                workflow_name = workflow.name.lower()
                workflow_project = workflow.project.name.lower()
    
                # Check workflow name match
                name_match = False
                if exact_match:
                    name_match = workflow_name == search_lower
                else:
                    name_match = search_lower in workflow_name
    
                if not name_match:
                    continue
    
                # Check project filter if specified
                if project_lower:
                    if project_lower not in workflow_project:
                        continue
    
                # Check status filter if specified
                if status_filter:
                    if workflow.latest_sessions:
                        last_status = workflow.latest_sessions[0].last_attempt.status
                        if last_status != status_filter:
                            continue
                    else:
                        # No sessions means no status, skip if filtering by status
                        continue
    
                # Prepare workflow info
                workflow_info = {
                    "id": workflow.id,
                    "name": workflow.name,
                    "project": {
                        "id": workflow.project.id,
                        "name": workflow.project.name,
                    },
                    "timezone": workflow.timezone,
                    "scheduled": workflow.schedule is not None,
                }
    
                # Add latest status if available
                if workflow.latest_sessions:
                    latest = workflow.latest_sessions[0]
                    workflow_info["latest_session"] = {
                        "session_time": latest.session_time,
                        "status": latest.last_attempt.status,
                        "success": latest.last_attempt.success,
                    }
                else:
                    workflow_info["latest_session"] = None
    
                found_workflows.append(workflow_info)
    
            if found_workflows:
                return {
                    "found": True,
                    "count": len(found_workflows),
                    "workflows": found_workflows,
                }
    
            message = f"No workflows found matching '{search_term}'"
            if project_name:
                message += f" in project '{project_name}'"
            if status_filter:
                message += f" with status '{status_filter}'"
    
            return {"found": False, "count": 0, "message": message}
    
        except Exception as e:
            return _format_error_response(f"Failed to search workflows: {str(e)}")
  • The registration of the td_find_workflow tool using the mcp.tool() decorator within the register_mcp_tools function.
    mcp.tool()(td_find_project)
    mcp.tool()(td_find_workflow)
    mcp.tool()(td_get_project_by_name)
    mcp.tool()(td_smart_search)
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses key behavioral traits: it returns 'workflow IDs, project info, and latest execution status' and explains filtering options. However, it doesn't mention pagination, rate limits, authentication needs, or error handling, leaving gaps for a search tool.

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. Each sentence adds value: purpose statement, importance, return values, scenarios, and parameter guidance. There's no redundancy, and the bulleted scenarios efficiently convey usage without verbosity.

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 4 parameters, 0% schema coverage, no annotations, and no output schema, the description does a strong job. It explains purpose, usage, parameters, and return values. However, it doesn't fully describe output structure (e.g., format of returned data) or error cases, leaving minor gaps for a tool with no structured support.

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 description coverage is 0%, so the description must compensate. It adds significant meaning: it explains that 'project_name' is optional, 'status' filter accepts specific values ('success', 'error', 'running'), and clarifies 'exact_match' parameter usage ('True for precise names, False for partial matches'). This covers 3 of 4 parameters well, though 'search_term' semantics are implied but not detailed.

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: 'Find workflows by name to get IDs and check execution status.' It specifies the verb ('find'), resource ('workflows'), and distinguishes from siblings like td_list_workflows (which likely lists all workflows) by focusing on search-by-name functionality.

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: 'Essential for locating specific workflows when you know the name.' It lists five common scenarios (e.g., 'User mentions workflow name, need to find details') and distinguishes from alternatives by emphasizing name-based search rather than listing or analyzing.

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