Skip to main content
Glama

get_result_id

Retrieve full opaque IDs for numbered references from EMS MCP Server search results to access detailed flight data records.

Instructions

DEPRECATED: query_database and get_field_info now accept [N] reference numbers and field names directly. This tool is no longer needed in the standard workflow.

Retrieve full opaque IDs for numbered [N] references from search results.

Args: result_numbers: Reference numbers from search results (e.g., [1, 3, 5]).

Returns: The name and full ID for each requested result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
result_numbersYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler function for get_result_id tool. Registered with @mcp.tool decorator. Takes a list of reference numbers and returns the full opaque IDs for each result stored in the result store. The function is marked as DEPRECATED since query_database and get_field_info now accept [N] references directly.
    @mcp.tool
    async def get_result_id(
        result_numbers: list[int],
    ) -> str:
        """DEPRECATED: query_database and get_field_info now accept [N] reference
        numbers and field names directly. This tool is no longer needed in the
        standard workflow.
    
        Retrieve full opaque IDs for numbered [N] references from search results.
    
        Args:
            result_numbers: Reference numbers from search results (e.g., [1, 3, 5]).
    
        Returns:
            The name and full ID for each requested result.
        """
        if not result_numbers:
            return "Error: result_numbers cannot be empty."
    
        lines: list[str] = []
        not_found: list[int] = []
    
        for ref in result_numbers:
            entry = _get_stored_result(ref)
            if entry is not None:
                type_label = f" ({entry['type']})" if entry.get("type") else ""
                lines.append(f"[{ref}] {entry['name']}{type_label}")
                lines.append(f"  ID: {entry['id']}")
            else:
                not_found.append(ref)
    
        if not_found:
            lines.append(
                f"\nNot found: {not_found}. These may have been evicted or never existed. "
                "Re-run the search to get fresh references."
            )
    
        return "\n".join(lines) if lines else "No results found for the given reference numbers."
  • Tool registration via @mcp.tool decorator. This decorator registers the get_result_id function with the FastMCP server instance imported from ems_mcp.server.
    @mcp.tool
  • Helper function _get_stored_result that retrieves a stored result from the result store by reference number. Used by get_result_id to look up results that were previously stored from search operations.
    def _get_stored_result(ref: int) -> dict[str, str] | None:
        """Look up a stored result by reference number.
    
        Args:
            ref: The reference number returned by ``_store_result``.
    
        Returns:
            Dict with ``name`` and ``id`` keys, or ``None`` if not found.
        """
        return _result_store.get(ref)
  • Helper function _store_result that stores a result and returns its reference number. This populates the _result_store that get_result_id queries. Implements eviction logic when the store exceeds maximum capacity.
    def _store_result(name: str, result_id: str, result_type: str = "field") -> int:
        """Store a result and return its reference number.
    
        Entries accumulate across searches so the agent can reference results
        from any prior search within the session. When the store exceeds
        ``_STORE_MAX_SIZE``, the oldest entries are evicted.
    
        Args:
            name: Human-readable name of the result.
            result_id: The full opaque ID string.
            result_type: Type of result: ``"field"`` or ``"analytic"``.
    
        Returns:
            The reference number assigned to this result.
        """
        global _next_ref  # noqa: PLW0603
    
        ref = _next_ref
        _next_ref += 1
        _result_store[ref] = {"name": name, "id": result_id, "type": result_type}
    
        # Evict oldest entries when over capacity
        if len(_result_store) > _STORE_MAX_SIZE:
            oldest_keys = sorted(_result_store.keys())[: len(_result_store) - _STORE_MAX_SIZE]
            for k in oldest_keys:
                del _result_store[k]
    
        return ref
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 of behavioral disclosure. It describes the tool as deprecated and explains its function, but lacks details on permissions, rate limits, error handling, or whether it's read-only. The description doesn't contradict annotations (since none exist), but it could provide more operational context beyond the basic purpose.

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 concise: it front-loads the deprecation warning, then states the purpose, followed by clear sections for Args and Returns. Every sentence earns its place, with no redundant information, making it easy for an agent to parse quickly.

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 has 1 parameter, no annotations, and an output schema (which handles return values), the description is fairly complete. It covers purpose, usage guidelines, parameter meaning, and return information. However, it could improve by mentioning any prerequisites or behavioral traits like idempotency, but the deprecation note reduces the need for full operational details.

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, but the description compensates well: it explains 'result_numbers: Reference numbers from search results (e.g., [1, 3, 5]).' This adds meaningful context about what the parameter represents and provides an example, which is valuable since the schema only indicates it's an array of integers. With 1 parameter and no schema descriptions, this is above the baseline.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: 'Retrieve full opaque IDs for numbered [N] references from search results.' This specifies the verb ('retrieve'), resource ('full opaque IDs'), and scope ('from search results'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_field_info' or 'query_database' beyond mentioning they now accept reference numbers directly.

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 usage guidance: it starts with 'DEPRECATED: query_database and get_field_info now accept [N] reference numbers and field names directly. This tool is no longer needed in the standard workflow.' This clearly states when not to use this tool and names specific alternatives, helping the agent avoid unnecessary calls.

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/mattsq/ems-mcp'

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