Skip to main content
Glama
GJakobi

Hatchet MCP Server

by GJakobi

search_runs

Search workflow runs by metadata key-value pairs like audit_id, patient_id, or rule_id to monitor and debug Hatchet workflows.

Instructions

Search runs by metadata key-value pairs.

Common metadata keys:

  • audit_id: The audit being processed

  • audit_type: Type of audit (e.g., 'standard', 'express')

  • patient_id: Patient being processed

  • application_id: Application ID

  • rule_id: Rule being processed

Args: metadata_key: The metadata key to search (e.g., 'audit_id') metadata_value: The value to match status: Optional status filter since_hours: How many hours back to search (default: 24) limit: Maximum runs to return (default: 50)

Returns matching runs with their full metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metadata_keyYes
metadata_valueYes
statusNo
since_hoursNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `search_runs` tool is defined here, decorated with `@mcp.tool()`. It takes metadata key-value pairs and other filters to search for Hatchet workflow runs.
    async def search_runs(
        metadata_key: str,
        metadata_value: str,
        status: str | None = None,
        since_hours: int = 24,
        limit: int = 50,
    ) -> list[dict]:
        """
        Search runs by metadata key-value pairs.
    
        Common metadata keys:
        - audit_id: The audit being processed
        - audit_type: Type of audit (e.g., 'standard', 'express')
        - patient_id: Patient being processed
        - application_id: Application ID
        - rule_id: Rule being processed
    
        Args:
            metadata_key: The metadata key to search (e.g., 'audit_id')
            metadata_value: The value to match
            status: Optional status filter
            since_hours: How many hours back to search (default: 24)
            limit: Maximum runs to return (default: 50)
    
        Returns matching runs with their full metadata.
        """
        try:
            hatchet = get_hatchet_client()
            params: dict[str, Any] = {
                "since": datetime.now(tz=timezone.utc) - timedelta(hours=since_hours),
                "limit": limit,
                "additional_metadata": {metadata_key: metadata_value},
            }
    
            if status and status.lower() in STATUS_MAP:
                params["statuses"] = [STATUS_MAP[status.lower()]]
    
            runs = await hatchet.runs.aio_list(**params)
            return [_serialize_run(r) for r in (runs.rows or [])]
        except Exception as e:
            return [{"error": str(e)}]
Behavior3/5

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

No annotations provided. Description mentions time-bounded search (since_hours) and that it returns full metadata, but does not explicitly confirm read-only nature, rate limits, or behavior when no matches exist.

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?

Well-structured with distinct sections for purpose, common keys, and arguments. Metadata key list is domain-specific and valuable. Slightly verbose but every section earns its place by aiding correct invocation.

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?

With output schema present, description adequately covers all inputs and provides crucial domain context (common keys). Sufficient for correct invocation though could clarify what constitutes a 'run' in this system.

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 has 0% description coverage, but the Args section fully compensates by documenting all 5 parameters with clear semantics, optionality, and default values (e.g., since_hours defaults to 24).

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?

Clear specific verb (Search) + resource (runs) + method (by metadata key-value pairs). Effectively distinguishes from sibling list_runs (unfiltered listing) and get_run_* tools (direct ID lookup).

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?

Provides valuable 'Common metadata keys' section (audit_id, patient_id, etc.) implying search capabilities, but does not explicitly contrast with list_runs or state when to prefer this tool over alternatives.

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/GJakobi/hatchet-mcp'

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