Skip to main content
Glama

get_root

Retrieve the root catalog document to access geospatial datasets through STAC APIs for satellite imagery and weather data.

Instructions

Return the STAC root document for a catalog.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function that implements the core logic for the 'get_root' tool. It fetches the STAC root document using the provided client, handles various fallback methods, formats the output as text or JSON based on arguments, and ensures robustness by never raising exceptions.
    def handle_get_root(
        client: STACClient,
        arguments: dict[str, Any],
    ) -> list[TextContent] | dict[str, Any]:
        # Be robust: the execution layer might pass either our STACClient wrapper
        # or the underlying pystac_client.Client. Use isinstance to prefer our
        # wrapper's helper; otherwise attempt to use to_dict() on whatever was
        # provided. Never raise from this handler — return a helpful text
        # fallback on error so the tool returns a friendly message.
        try:
            # Prefer calling get_root_document() if the client provides it (covers
            # STACClient wrapper, FakeClientRoot, MagicMock, and similar objects).
            if hasattr(client, "get_root_document") and callable(client.get_root_document):
                try:
                    doc = client.get_root_document()
                except (AttributeError, APIError):
                    # If that fails with a known client error, fall through and
                    # try to_dict() based fallbacks.
                    doc = None
            else:
                doc = None
    
            if not doc:
                # Try a couple of to_dict() fallbacks.
                # Prefer client.to_dict(), then client.client.to_dict().
                raw = {}
                try:
                    if hasattr(client, "to_dict") and callable(client.to_dict):
                        raw = client.to_dict() or {}
                    elif hasattr(client, "client") and hasattr(client.client, "to_dict"):
                        raw = client.client.to_dict() or {}
                except (AttributeError, APIError, RuntimeError, TypeError, ValueError):
                    # to_dict() may be missing or fail; treat as empty mapping.
                    raw = {}
                doc = {
                    "id": raw.get("id"),
                    "title": raw.get("title"),
                    "description": raw.get("description"),
                    "links": raw.get("links", []),
                    "conformsTo": raw.get("conformsTo", raw.get("conforms_to", [])),
                }
        except (AttributeError, APIError, RuntimeError, TypeError, ValueError) as exc:
            # Return a minimal root-like doc along with an explanatory message.
            doc = {
                "id": None,
                "title": None,
                "description": None,
                "links": [],
                "conformsTo": [],
                "_error": str(exc),
            }
        if arguments.get("output_format") == "json":
            return {"type": "root", "root": doc}
        conforms = doc.get("conformsTo", []) or []
        result_text = "**STAC Root Document**\n\n"
        result_text += f"ID: {doc.get('id')}\n"
        if doc.get("title"):
            result_text += f"Title: {doc.get('title')}\n"
        if doc.get("description"):
            result_text += f"Description: {doc.get('description')}\n"
        result_text += f"Links: {len(doc.get('links', []))}\n"
        result_text += f"Conformance Classes: {len(conforms)}\n"
        preview = conforms[:5]
        for c in preview:
            result_text += f"  - {c}\n"
        if len(conforms) > len(preview):
            result_text += f"  ... and {len(conforms) - len(preview)} more\n"
        return [TextContent(type="text", text=result_text)]
  • The registration of the 'get_root' tool using @app.tool decorator in the FastMCP server. This is a thin wrapper that delegates to the execution layer with default arguments.
    @app.tool
    async def get_root() -> list[dict[str, Any]]:
        """Return the STAC root document for a catalog."""
        return await execution.execute_tool(
            "get_root", arguments={}, catalog_url=None, headers=None
        )
Behavior2/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. While 'Return' implies a read-only operation, it doesn't specify whether this requires authentication, rate limits, or error conditions. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operational behavior.

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 a single, efficient sentence that directly states what the tool does without any wasted words. It's appropriately sized for a simple tool and front-loads the essential information.

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 simplicity (0 parameters, output schema exists), the description is reasonably complete. It explains what the tool returns, though it could benefit from more context about STAC catalogs. The existence of an output schema means the description doesn't need to detail return values.

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 parameters with 100% description coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose. This meets the baseline for tools with no parameters.

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 verb ('Return') and resource ('STAC root document for a catalog'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_collection' or 'get_conformance', which also retrieve STAC documents but for different resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention that this retrieves the top-level entry point for a STAC catalog, as opposed to sibling tools that fetch collections, items, or other specific components. No explicit when/when-not instructions or prerequisites are included.

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/Wayfinder-Foundry/stac-mcp'

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