Skip to main content
Glama
ESJavadex

REE MCP Server

by ESJavadex

search_indicators

Search for electricity grid indicators by keyword to find demand, generation, price, or emissions data from Spain's electrical system.

Instructions

Search for indicators by keyword in their names.

Searches through all available indicators and returns those matching the keyword in their name or short name.

Args: keyword: Keyword to search for (e.g., "demanda", "precio", "solar") limit: Maximum number of results (default: 20)

Returns: JSON string with matching indicator metadata.

Examples: Find all demand-related indicators: >>> await search_indicators("demanda", limit=10)

Find price indicators:
>>> await search_indicators("precio")

Find solar generation indicators:
>>> await search_indicators("solar")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler and registration for 'search_indicators'. Uses ToolExecutor to create use case, executes search, formats results as JSON or error response.
    @mcp.tool()
    async def search_indicators(keyword: str, limit: int | None = 20) -> str:
        """Search for indicators by keyword in their names.
    
        Searches through all available indicators and returns those matching
        the keyword in their name or short name.
    
        Args:
            keyword: Keyword to search for (e.g., "demanda", "precio", "solar")
            limit: Maximum number of results (default: 20)
    
        Returns:
            JSON string with matching indicator metadata.
    
        Examples:
            Find all demand-related indicators:
            >>> await search_indicators("demanda", limit=10)
    
            Find price indicators:
            >>> await search_indicators("precio")
    
            Find solar generation indicators:
            >>> await search_indicators("solar")
        """
        try:
            async with ToolExecutor() as executor:
                use_case = executor.create_search_indicators_use_case()
                indicators = await use_case.execute(keyword=keyword, limit=limit)
    
            result = {
                "keyword": keyword,
                "count": len(indicators),
                "indicators": [ind.model_dump() for ind in indicators],
            }
            return ResponseFormatter.success(result, ensure_ascii=False)
    
        except Exception as e:
            return ResponseFormatter.unexpected_error(e, context="Error searching indicators")
  • SearchIndicatorsUseCase: core business logic that calls repository.search_indicators() and maps results to IndicatorMetadataResponse DTOs.
    class SearchIndicatorsUseCase:
        """Use case for searching indicators by keyword.
    
        Attributes:
            repository: Indicator repository implementation
        """
    
        def __init__(self, repository: IndicatorRepository) -> None:
            """Initialize use case.
    
            Args:
                repository: Indicator repository
            """
            self.repository = repository
    
        async def execute(
            self, keyword: str, limit: int | None = None
        ) -> list[IndicatorMetadataResponse]:
            """Execute the use case.
    
            Args:
                keyword: Keyword to search for
                limit: Maximum number of results
    
            Returns:
                List of matching indicator metadata.
            """
            indicators = await self.repository.search_indicators(keyword=keyword, limit=limit)
    
            return [
                IndicatorMetadataResponse(
                    id=int(ind.id),
                    name=ind.name,
                    short_name=ind.short_name,
                    description=ind.description,
                    unit=ind.unit.value,
                    frequency=ind.frequency,
                    geo_scope=ind.geo_scope.value,
                )
                for ind in indicators
            ]
  • ToolExecutor.create_search_indicators_use_case(): factory method to instantiate the use case with injected repository.
    def create_search_indicators_use_case(self) -> SearchIndicatorsUseCase:
        """Create a SearchIndicatorsUseCase instance.
    
        Returns:
            Configured use case instance
        """
        return SearchIndicatorsUseCase(self.repository)
  • FastMCP server initialization where all @mcp.tool() decorators register the tools including search_indicators.
    mcp = FastMCP("REE MCP Server", dependencies=["httpx", "pydantic", "pydantic-settings"])
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool searches through all available indicators and returns matching metadata, but lacks details on permissions, rate limits, error handling, or pagination. The examples add some behavioral context, but key operational traits are missing.

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 well-structured with clear sections (purpose, args, returns, examples) and front-loaded key information. It is appropriately sized, though the examples section is slightly verbose; every sentence adds value without redundancy.

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, no annotations, and an output schema present (so return values need not be explained), the description is fairly complete. It covers purpose, parameters, and usage with examples, but could improve by addressing behavioral aspects like search scope or limitations.

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?

Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining 'keyword' is for searching names/short names with examples, and 'limit' defaults to 20 and sets maximum results. This clarifies beyond the bare schema, though it doesn't cover all potential nuances like format constraints.

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 searches for indicators by keyword in their names or short names, providing a specific verb ('search') and resource ('indicators'). It distinguishes from sibling 'list_indicators' by specifying keyword-based filtering, though not explicitly naming it as an alternative.

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

Usage Guidelines3/5

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

The description implies usage through examples (e.g., 'Find all demand-related indicators'), suggesting when to use it for keyword-based searches. However, it lacks explicit guidance on when to choose this over sibling tools like 'list_indicators' or 'get_indicator_data', and does not mention exclusions or prerequisites.

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/ESJavadex/ree-mcp'

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