Skip to main content
Glama
rodcar

BCRP-MCP

by rodcar

search_time_series_by_group

Find economic time series data from Peru's Central Reserve Bank by filtering within specific categories or groups to identify relevant indicators for analysis.

Instructions

Search for time series within a specific group from the BCRP database.

This function retrieves time series metadata from the BCRP (Banco Central de Reserva del Perú) database and filters it to find all time series that belong to a specific group. It returns a list of dictionaries containing the code and name of each matching time series.

Args: time_series_group (str): The name of the time series group to search within. This should match or be contained within the "Grupo de serie" field in the BCRP metadata.

Returns: List[Dict[str, str]]: A list of dictionaries where each dictionary contains: - "code": The unique identifier code for the time series - "name": The descriptive name of the time series If an error occurs, returns a list with a single dictionary containing an "error" key with the error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
time_series_groupYes

Implementation Reference

  • main.py:43-70 (handler)
    The handler function for the 'search_time_series_by_group' tool, decorated with @mcp.tool() for registration. It fetches BCRP time series metadata, filters by the provided group name using pandas, and returns up to 50 matching time series as dictionaries with 'code' and 'name'. The type hints and docstring define the input schema and output format.
    @mcp.tool()
    def search_time_series_by_group(time_series_group: str) -> Any:
        """
        Search for time series within a specific group from the BCRP database.
        
        This function retrieves time series metadata from the BCRP (Banco Central de Reserva del Perú)
        database and filters it to find all time series that belong to a specific group. It returns
        a list of dictionaries containing the code and name of each matching time series.
        
        Args:
            time_series_group (str): The name of the time series group to search within.
                                    This should match or be contained within the "Grupo de serie"
                                    field in the BCRP metadata.
        
        Returns:
            List[Dict[str, str]]: A list of dictionaries where each dictionary contains:
                                 - "code": The unique identifier code for the time series
                                 - "name": The descriptive name of the time series
                                 If an error occurs, returns a list with a single dictionary
                                 containing an "error" key with the error message.
        """
        try:
            metadata = pd.read_csv(METADATA_ENDPOINT, delimiter=';', encoding='latin-1')
            result_list = metadata[metadata[TIME_SERIES_GROUP].str.contains(time_series_group, na=False)].iloc[:, [0, 3]].values.tolist()
            return [{"code": row[0], "name": row[1]} for row in result_list[:50]]
        except Exception as e:
            return [{"error": str(e)}]
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses that the tool retrieves metadata (not actual data), describes the return format in detail, and mentions error handling. However, it doesn't cover important behavioral aspects like rate limits, authentication requirements, or whether this is a read-only operation.

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 well-structured with clear sections (purpose, Args, Returns), front-loads the core functionality, and every sentence adds value. No redundant information or unnecessary elaboration.

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 no annotations and no output schema, the description does an excellent job explaining the tool's purpose, parameters, and return format. It could be more complete by addressing behavioral aspects like authentication or rate limits, but for a search tool with one parameter, it provides substantial context.

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

Parameters5/5

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

The schema has 0% description coverage, so the description must compensate fully. It provides excellent parameter semantics: explains what 'time_series_group' represents, specifies it should match the 'Grupo de serie' field, and clarifies matching/containment logic. This adds substantial value beyond the bare schema.

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 ('search for time series within a specific group'), identifies the resource (BCRP database), and distinguishes from siblings by focusing on group-based filtering rather than data retrieval (get_time_series_data) or group searching (search_time_series_groups).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool (searching within a specific group from BCRP database) but doesn't explicitly state when not to use it or name specific alternatives. The sibling tools suggest natural alternatives but aren't explicitly mentioned in the description.

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/rodcar/bcrp-mcp'

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