Skip to main content
Glama
tomekkorbak

Oura MCP Server

by tomekkorbak

get_resilience_data

Retrieve resilience metrics from Oura data for a specified date range to analyze stress recovery and physical adaptation patterns.

Instructions

Get resilience data for a specific date range.

Args:
    start_date: Start date in ISO format (YYYY-MM-DD)
    end_date: End date in ISO format (YYYY-MM-DD)

Returns:
    Dictionary containing resilience data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYes
end_dateYes

Implementation Reference

  • MCP tool handler function for 'get_resilience_data'. Parses date inputs, delegates to OuraClient.get_resilience_data, and handles initialization and errors.
    @mcp.tool()
    def get_resilience_data(start_date: str, end_date: str) -> dict[str, Any]:
        """
        Get resilience data for a specific date range.
    
        Args:
            start_date: Start date in ISO format (YYYY-MM-DD)
            end_date: End date in ISO format (YYYY-MM-DD)
    
        Returns:
            Dictionary containing resilience data
        """
        if oura_client is None:
            return {"error": "Oura client not initialized. Please provide an access token."}
    
        try:
            start = parse_date(start_date)
            end = parse_date(end_date)
            return oura_client.get_resilience_data(start, end)
        except Exception as e:
            return {"error": str(e)}
  • OuraClient helper method that implements the core logic: queries the Oura API /daily_resilience endpoint, removes 'id' fields from data, and returns transformed data.
    def get_resilience_data(
        self, start_date: date, end_date: Optional[date] = None
    ) -> dict[str, Any]:
        """
        Get resilience data for a specific date range.
    
        Args:
            start_date: Start date for the query
            end_date: End date for the query (optional, defaults to start_date)
    
        Returns:
            Dictionary containing resilience data
        """
        if end_date is None:
            end_date = start_date
    
        params = {
            "start_date": start_date.isoformat(),
            "end_date": end_date.isoformat(),
        }
    
        url = f"{self.BASE_URL}/daily_resilience"
        response = self.client.get(url, headers=self.headers, params=params)
    
        if response.status_code != 200:
            error_msg = f"Error {response.status_code}: {response.text}"
            raise Exception(error_msg)
    
        # Get the raw response
        raw_data = response.json()
    
        # Transform the data - just return the data array directly
        transformed_data = []
    
        for item in raw_data.get("data", []):
            # Create transformed item without the id field
            transformed_item = {k: v for k, v in item.items() if k != "id"}
            transformed_data.append(transformed_item)
    
        # Return with the original structure but with transformed data
        return {"data": transformed_data}
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 this is a read operation ('Get'), but doesn't mention authentication requirements, rate limits, error conditions, or what 'resilience data' actually contains. The return format description ('Dictionary containing resilience data') is too vague to be helpful.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and well-structured with clear sections (Args, Returns). Each sentence adds value, though the return description could be more specific. It's front-loaded with the core purpose statement.

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 required parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and parameters but lacks details about what resilience data includes, how results are structured, or behavioral constraints. The absence of output schema means the return description should be more informative.

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 description adds significant value beyond the input schema, which has 0% description coverage. It specifies that both parameters are dates in ISO format (YYYY-MM-DD), clarifies they're required, and explains their purpose (defining a date range). This fully compensates for the schema's lack of descriptions.

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 with a specific verb ('Get') and resource ('resilience data'), and specifies the date range scope. However, it doesn't differentiate from sibling tools like 'get_today_resilience_data' or explain what distinguishes resilience data from readiness or sleep data.

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 'get_today_resilience_data' (which presumably fetches today's data without date parameters) or other sibling tools. There's no mention of prerequisites, constraints, or comparative use cases.

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/tomekkorbak/oura-mcp-server'

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