Skip to main content
Glama
wso2

FHIR MCP Server

by wso2

get_capabilities

Discover supported search parameters and operations for a specific FHIR resource type before performing any data operations.

Instructions

Retrieves metadata about a specified FHIR resource type, including its supported search parameters and custom operations. This tool MUST always be invoked before performing any resource operation (such as search, read, create, update, or delete) to discover the valid searchParams and operations permitted for that resource type. Do not use this tool to fetch actual resources.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesThe FHIR resource type name. Must exactly match one of the core or profile-defined resource types as per the FHIR specification.

Implementation Reference

  • The 'get_capabilities' function is defined as an MCP tool using the '@mcp.tool' decorator. It fetches FHIR CapabilityStatement metadata for a specified resource type and returns its search parameters, operations, interactions, and include/revinclude lists.
    async def get_capabilities(
        type: Annotated[
            str,
            Field(
                description=(
                    "The FHIR resource type name. Must exactly match one of the core or "
                    "profile-defined resource types as per the FHIR specification."
                ),
                examples=["Patient", "Observation", "Encounter"],
            ),
        ],
    ) -> Annotated[
        Dict[str, Any],
        Field(
            description=(
                "A dictionary containing: "
                "'type': The requested resource type (if supported by the system) or empty. "
                "'searchParam': A mapping of FHIR search parameter names to their descriptions. Each key is a parameter name "
                "(e.g., family, _id, _lastUpdated), and each value is a string describing the parameter's meaning and usage constraints. "
                "'operation': A mapping of custom FHIR operation names to their descriptions. Each key is an operation name "
                "(e.g., $validate), and each value is a string explaining the operation's purpose and usage. "
                "'interaction': A list of supported interactions for the resource type (e.g., read, search-type, create). "
                "'searchInclude': A list of supported _include parameters for the resource type, indicating which related resources can be included. "
                "'searchRevInclude': A list of supported _revinclude parameters for the resource type, indicating which reverse-included resources can be included."
            )
        ),
    ]:
        try:
            logger.debug(f"Invoked with resource_type='{type}'")
            data: Dict[str, Any] = await get_capability_statement(configs.metadata_url)
            for resource in data["rest"][0]["resource"]:
                if resource.get("type") == type:
                    logger.info(
                        f"Resource type '{type}' found in the CapabilityStatement."
                    )
                    return {
                        "type": resource.get("type"),
                        "searchParam": trim_resource_capabilities(
                            resource.get("searchParam", [])
                        ),
                        "operation": trim_resource_capabilities(
                            resource.get("operation", [])
                        ),
                        "interaction": resource.get("interaction", []),
                        "searchInclude": resource.get("searchInclude", []),
                        "searchRevInclude": resource.get("searchRevInclude", []),
                    }
            logger.info(f"Resource type '{type}' not found in the CapabilityStatement.")
            return await get_operation_outcome(
                code="not-supported",
                diagnostics=f"The interaction, operation, resource or profile {type} is not supported.",
            )
  • The tool 'get_capabilities' is registered with the MCP server using the '@mcp.tool' decorator, providing a description of its purpose and required parameters.
    @mcp.tool(
        description=(
            "Retrieves metadata about a specified FHIR resource type, including its supported search parameters and custom operations. "
            "This tool MUST always be invoked before performing any resource operation (such as search, read, create, update, or delete) "
            "to discover the valid searchParams and operations permitted for that resource type. "
            "Do not use this tool to fetch actual resources."
        )
    )
Behavior4/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 effectively describes the tool's purpose and constraints (e.g., it's for metadata discovery, not resource fetching), but lacks details on potential errors, rate limits, or authentication requirements. However, it adds significant context beyond basic functionality.

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 front-loaded with the core purpose, followed by usage rules and exclusions in two concise sentences. Every sentence earns its place by providing essential guidance without redundancy, making it highly efficient and well-structured.

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 complexity (metadata discovery for FHIR operations) and lack of annotations or output schema, the description is largely complete. It explains the tool's role and constraints clearly, though it could benefit from mentioning what the output includes (e.g., search parameters, operations) or error handling, which would enhance completeness.

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 input schema has 100% description coverage, clearly documenting the single required parameter 'type' with examples. The description adds no additional parameter-specific information beyond what the schema provides, such as format details or constraints, so it meets the baseline for high schema coverage.

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?

The description clearly states the specific action ('Retrieves metadata') and resource ('FHIR resource type'), distinguishing it from sibling tools like 'read' or 'search' that fetch actual resources. It explicitly contrasts with those operations by stating 'Do not use this tool to fetch actual resources.'

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 guidance on when to use this tool ('MUST always be invoked before performing any resource operation') and when not to use it ('Do not use this tool to fetch actual resources'). It implicitly positions this as a prerequisite for other operations like search, read, create, update, or delete, offering clear 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/wso2/fhir-mcp-server'

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