Skip to main content
Glama
rodcar

BCRP-MCP

by rodcar

search_time_series_groups

Search Peru's central bank economic data by keywords to find relevant time series groups for analysis.

Instructions

Search for time series groups using one or multiple keywords.

This function searches the BCRP (Banco Central de Reserva del Perú) database for time series groups that match the provided keywords. It returns a list of unique time series group names that contain or relate to the search terms.

Args: keywords (List[str]): A list containing one or more keywords to search for. Each keyword should be a single word without spaces.

Returns: List[str]: A list of unique time series group names that match the search criteria. Returns an empty list if no matches are found.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:17-42 (handler)
    The main handler function for the 'search_time_series_groups' tool. It is decorated with @mcp.tool(), which registers it in the FastMCP server. The function fetches metadata from BCRP, searches for matching time series groups using fuzzy matching with difflib.get_close_matches, and returns unique group names.
    @mcp.tool()
    def search_time_series_groups(keywords: List[str]) -> List[str]:
        """
        Search for time series groups using one or multiple keywords.
        
        This function searches the BCRP (Banco Central de Reserva del Perú) database
        for time series groups that match the provided keywords. It returns a list
        of unique time series group names that contain or relate to the search terms.
        
        Args:
            keywords (List[str]): A list containing one or more keywords to search for.
                                 Each keyword should be a single word without spaces.
        
        Returns:
            List[str]: A list of unique time series group names that match the
                      search criteria. Returns an empty list if no matches are found.
        """
        try:
            df = pd.read_csv(METADATA_ENDPOINT, delimiter=';', encoding='latin-1')
            # index 3 is the column index for the time series group
            # search based on wordsearch from bcrpy
            matches = df[df.iloc[:, 3].apply(lambda x: any(get_close_matches(k, str(x).split(), n=1, cutoff=CUTOFF) for k in keywords))]
            return list(set(matches[TIME_SERIES_GROUP]))
        except Exception as e:
            return [f"error: {e}"]
  • main.py:17-17 (registration)
    Registration of the 'search_time_series_groups' tool using the FastMCP @mcp.tool() decorator.
    @mcp.tool()
  • main.py:14-16 (helper)
    Constants used by the search_time_series_groups handler: column name for time series group and fuzzy matching cutoff.
    TIME_SERIES_GROUP = "Grupo de serie"
    CUTOFF = 0.65
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 it returns a list of unique group names (not the data itself) and returns empty list for no matches, which is useful behavioral context. However, it doesn't mention performance characteristics, rate limits, authentication needs, or whether results are paginated/sorted.

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 a clear purpose statement, detailed parameter explanation, and return value description. Every sentence adds value - no wasted words. It's appropriately sized for a single-parameter search tool.

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 moderate complexity (search operation), no annotations, and the presence of an output schema (which covers return values), the description is mostly complete. It explains the purpose, parameters, and basic behavior well. Minor gaps include lack of information about search algorithm (exact match, partial, case sensitivity) and result limitations.

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?

With 0% schema description coverage, the description fully compensates by explaining the 'keywords' parameter in detail: it's a list of strings, each keyword should be a single word without spaces, and multiple keywords can be used. This adds crucial meaning 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 tool's purpose: 'Search for time series groups using one or multiple keywords' and specifies it searches the BCRP database. It distinguishes from siblings by focusing on groups rather than individual time series data (get_time_series_data) or searching within groups (search_time_series_by_group).

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 for time series groups by keywords in the BCRP database), but doesn't explicitly state when not to use it or directly compare it to sibling tools. It implies usage through its specific focus on groups rather than data or within-group searches.

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