Skip to main content
Glama

get_table

Retrieve formatted economic data tables from Peru's central bank by specifying series codes, custom column names, and date ranges.

Instructions

Get a formatted table with custom column names.

Args: series_codes: List of BCRP series codes to retrieve names: Optional custom names for columns (must match series_codes length) period: Date range in format 'YYYY-MM/YYYY-MM' or 'YYYY'

Returns: JSON string with formatted table data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
series_codesYes
namesNo
periodNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `get_table` tool handler function retrieves data for BCRP series, formats it into a table with optional custom names using pandas, and returns the result as a JSON string.
    @mcp.tool()
    async def get_table(
        series_codes: list[str], 
        names: list[str] = None, 
        period: str = None
    ) -> str:
        """
        Get a formatted table with custom column names.
        
        Args:
            series_codes: List of BCRP series codes to retrieve
            names: Optional custom names for columns (must match series_codes length)
            period: Date range in format 'YYYY-MM/YYYY-MM' or 'YYYY'
        
        Returns:
            JSON string with formatted table data.
        """
        try:
            # 1. Fetch Data
            data_json = await _get_data(series_codes, period)
            if data_json.startswith("Error") or data_json.startswith("No data"):
                return data_json
                
            import pandas as pd
            df = pd.read_json(data_json, orient='records')
            if df.empty:
                return "No data found."
                
            # 2. Resolve Names if not provided
            if not names:
                await metadata_client.load()
                names = metadata_client.get_series_names(series_codes)
                
            # 3. Rename columns
            mapping = {code: name for code, name in zip(series_codes, names)}
            df.rename(columns=mapping, inplace=True)
                
            return df.to_json(orient='records', date_format='iso', indent=2)
            
    
        except Exception as e:
            return f"Table generation failed: {str(e)}"
Behavior3/5

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

With no annotations provided, the description must carry the full behavioral burden. It successfully discloses the return format ('JSON string with formatted table data') and important constraints (names 'must match series_codes length'), but fails to declare safety properties (read-only status), rate limits, or what 'formatted' specifically entails.

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 follows a clean docstring structure with front-loaded purpose ('Get a formatted table...') followed by Args and Returns sections. Despite the parameter documentation being lengthy, it is necessary given the schema lacks descriptions. No sentences appear wasted or redundant.

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?

The description covers basic operation, parameters, and return values, which suffices for simple usage. However, it lacks context on the BCRP domain, does not differentiate functionality from get_data, and provides no safety/authorization guidance expected for a data retrieval tool with no annotations.

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?

Given 0% schema description coverage, the Args section effectively compensates by documenting all three parameters: series_codes (identifying them as BCRP codes), names (with the length constraint), and period (with specific format examples 'YYYY-MM/YYYY-MM' or 'YYYY'). This provides the semantic meaning missing from the structured schema.

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 retrieves a 'formatted table with custom column names,' specifying both the action (Get) and distinguishing feature (custom column names) that differentiates it from sibling tools like plot_chart and search_series. However, it omits the domain context (BCRP) from the main sentence, only mentioning it in the Args section.

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 explicit guidance on when to use this tool versus siblings like get_data (likely for raw data retrieval) or plot_chart. There are no 'when to use' or 'when not to use' statements, forcing the agent to infer suitability based solely on the 'formatted table' keyword.

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/MaykolMedrano/mcp_bcrp'

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