Skip to main content
Glama

get_collection

Retrieve a specific STAC Collection by its unique identifier to access metadata about geospatial datasets like satellite imagery or weather data.

Instructions

Fetch a single STAC Collection by id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idYes
catalog_urlNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function that executes the 'get_collection' tool: fetches the STAC collection by ID using STACClient and formats a textual or JSON response.
    def handle_get_collection(
        client: STACClient,
        arguments: dict[str, Any],
    ) -> list[TextContent] | dict[str, Any]:
        collection_id = arguments["collection_id"]
        collection = client.get_collection(collection_id)
        if collection is None:
            return {"type": "collection", "collection": None}
        if arguments.get("output_format") == "json":
            return {"type": "collection", "collection": collection}
        title = collection.get("title", collection.get("id", collection_id))
        result_text = f"**Collection: {title}**\n\n"
        identifier = collection.get("id", collection_id)
        result_text += f"ID: `{identifier}`\n"
        description = collection.get("description", "No description available")
        result_text += f"Description: {description}\n"
        license_value = collection.get("license", "unspecified")
        result_text += f"License: {license_value}\n\n"
        extent = collection.get("extent") or {}
        if extent:
            spatial = extent.get("spatial") or {}
            bbox_list = spatial.get("bbox") or []
            if bbox_list:
                bbox = bbox_list[0]
                if isinstance(bbox, list | tuple) and len(bbox) >= BBOX_MIN_COORDS:
                    result_text += (
                        "Spatial Extent: "
                        f"[{bbox[0]:.2f}, {bbox[1]:.2f}, {bbox[2]:.2f}, {bbox[3]:.2f}]\n"
                    )
            temporal = extent.get("temporal") or {}
            interval_list = temporal.get("interval") or []
            if interval_list:
                interval = interval_list[0]
                start = interval[0] if len(interval) > 0 else "unknown"
                end = interval[1] if len(interval) > 1 else "present"
                result_text += f"Temporal Extent: {start} to {end or 'present'}\n"
        providers = collection.get("providers") or []
        if providers:
            result_text += f"\nProviders: {len(providers)}\n"
            for provider in providers:
                name = provider.get("name", "Unknown")
                roles = provider.get("roles", [])
                result_text += f"  - {name} ({roles})\n"
        return [TextContent(type="text", text=result_text)]
  • Internal registry in execution.py that maps the tool name 'get_collection' to its handler function handle_get_collection.
    _TOOL_HANDLERS: dict[str, Handler] = {
        "search_collections": handle_search_collections,
        "get_collection": handle_get_collection,
        "search_items": handle_search_items,
        "get_item": handle_get_item,
        "estimate_data_size": handle_estimate_data_size,
        "get_root": handle_get_root,
        "get_conformance": handle_get_conformance,
        "get_queryables": handle_get_queryables,
        "get_aggregations": handle_get_aggregations,
        "sensor_registry_info": handle_sensor_registry_info,
    }
  • FastMCP server registration of the 'get_collection' tool, defining input schema via parameters (collection_id: str, catalog_url: str | None) and delegating to execution.execute_tool.
    @app.tool
    async def get_collection(
        collection_id: str, catalog_url: str | None = None
    ) -> list[dict[str, Any]]:
        """Fetch a single STAC Collection by id."""
        return await execution.execute_tool(
            "get_collection",
            arguments={"collection_id": collection_id},
            catalog_url=catalog_url,
            headers=None,
        )
  • Input schema for the tool derived from the registered function signature: requires collection_id (str), optional catalog_url (str). Output is list[dict[str, Any]]. Note: handler supports additional 'output_format' param.
    async def get_collection(
        collection_id: str, catalog_url: str | None = None
    ) -> list[dict[str, Any]]:
        """Fetch a single STAC Collection by id."""
        return await execution.execute_tool(
            "get_collection",
            arguments={"collection_id": collection_id},
            catalog_url=catalog_url,
            headers=None,
        )
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool fetches a collection, implying a read-only operation, but doesn't cover aspects like error handling (e.g., what happens if the ID is invalid), authentication needs, rate limits, or response format. This is a significant gap for a tool with potential complexity.

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, clear sentence with zero wasted words, making it highly efficient and front-loaded. It directly conveys the core purpose without unnecessary elaboration, earning full marks for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no annotations) and the presence of an output schema, the description is minimally adequate. It states what the tool does but lacks details on usage, behavior, and parameter semantics. The output schema helps, but the description doesn't fully compensate for missing context, resulting in a baseline score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'by id', which hints at the 'collection_id' parameter, but with 0% schema description coverage, it doesn't explain the 'catalog_url' parameter or provide details like format constraints or default behavior. Since schema coverage is low, the description adds minimal value beyond the basic hint, aligning with the baseline for partial compensation.

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 action ('Fetch') and resource ('a single STAC Collection by id'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'search_collections' or 'get_item', which would require more specific language about scope or use cases.

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 like 'search_collections' or 'get_item'. It lacks context about prerequisites, such as needing a valid collection ID, or exclusions, such as not being suitable for bulk retrieval. This leaves the agent without clear usage direction.

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