Skip to main content
Glama
BnJam

STAC MCP Server

get_queryables

Retrieve queryable properties for STAC collections to enable filtering of geospatial datasets by spatial, temporal, and attribute parameters.

Instructions

Get the queryable properties for a specific STAC collection by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idYes
catalog_urlNo

Implementation Reference

  • The core handler function that executes the get_queryables tool logic: fetches queryables from STACClient and formats as preview text or JSON.
    def handle_get_queryables(
        client: STACClient,
        arguments: dict[str, Any],
    ) -> list[TextContent] | dict[str, Any]:
        collection_id = arguments.get("collection_id")
        data = client.get_queryables(collection_id=collection_id)
        if arguments.get("output_format") == "json":
            return {"type": "queryables", **data}
        props = data.get("queryables", {})
        result_text = "**Queryables**\n\n"
        if not props:
            result_text += data.get("message", "No queryables available") + "\n"
            return [TextContent(type="text", text=result_text)]
        result_text += f"Collection: {collection_id or 'GLOBAL'}\n"
        result_text += f"Count: {len(props)}\n\n"
        for name, spec in list(props.items())[:PREVIEW_LIMIT]:
            typ = spec.get("type", "unknown") if isinstance(spec, dict) else "unknown"
            result_text += f"  - {name}: {typ}\n"
        if len(props) > PREVIEW_LIMIT:
            result_text += f"  ... and {len(props) - PREVIEW_LIMIT} more\n"
        return [TextContent(type="text", text=result_text)]
  • JSON schema and prompt definition for the get_queryables tool, specifying input parameters (collection_id optional string).
    @app.prompt(
        name="tool_get_queryables_prompt",
        description="Usage for get_queryables tool",
        meta={
            "schema": {
                "type": "object",
                "properties": {
                    "collection_id": {"type": "string"},
                    "catalog_url": {"type": "string"},
                },
                "required": [],
            },
            "example": {"collection_id": "my-collection"},
        },
    )
    def _prompt_get_queryables() -> PromptMessage:
        schema = {
            "type": "object",
            "properties": {
                "collection_id": {"type": "string"},
                "catalog_url": {"type": "string"},
            },
            "required": [],
        }
        payload = {
            "name": "get_queryables",
            "description": "Fetch STAC API (or collection) queryables.",
            "parameters": schema,
            "example": {"collection_id": "my-collection"},
        }
        human = (
            f"Tool: get_queryables\nDescription: {payload['description']}\n\n"
            "Parameters:\n"
            f"{json.dumps(schema, indent=2)}\n\n"
            "Example:\n"
            f"{json.dumps(payload['example'], indent=2)}"
        )
        return PromptMessage(
            role="user",
            content=TextContent(type="text", text=human),
            _meta={"machine_payload": payload},
        )
  • Primary MCP server registration of the get_queryables tool using FastMCP @app.tool decorator, dispatching to execution layer.
    @app.tool
    async def get_queryables(
        collection_id: list[str],
        catalog_url: str | None = None,
    ) -> list[dict[str, Any]]:
        """Get the queryable properties for a specific STAC collection by its ID."""
        return await execution.execute_tool(
            "get_queryables",
            {"collection_id": collection_id},
            catalog_url=catalog_url,
            headers=None,
        )
  • Central tool handler registry dictionary mapping tool name 'get_queryables' to its handler function.
    _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,
    }
  • Import of the get_queryables handler into the execution module.
    from stac_mcp.tools.get_queryables import handle_get_queryables

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

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