Skip to main content
Glama
parrotsoft

Lotería MCP

by parrotsoft

get_resultados

Retrieve lottery results for a specific date in YYYY-MM-DD format, or leave date empty to get the most recent results. Returns data from multiple lotteries.

Instructions

Obtiene los resultados de loterías para una fecha específica.

Consulta el endpoint `/results/{date}` de la API cuando se proporciona
una fecha, o `/results` para obtener los resultados más recientes.

Args:
    date (str): Fecha en formato `YYYY-MM-DD` para filtrar los resultados.
        Si se pasa una cadena vacía, retorna los resultados más recientes.

Returns:
    dict[str, Any] | None: Diccionario con los resultados de loterías
    para la fecha indicada, o None si ocurre un error de red o la API
    no responde.

Example:
    >>> await get_resultados("2026-04-24")
    {"data": [{"lottery": "Lotería Nacional", "result": "1234", ...}]}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler for the 'get_resultados' tool. Accepts a date string (YYYY-MM-DD), calls the external lottery results API at /results/{date} or /results if empty, and returns the JSON response or None on error.
    async def get_resultados(date: str) -> dict[str, Any] | None:
        """Obtiene los resultados de loterías para una fecha específica.
    
        Consulta el endpoint `/results/{date}` de la API cuando se proporciona
        una fecha, o `/results` para obtener los resultados más recientes.
    
        Args:
            date (str): Fecha en formato `YYYY-MM-DD` para filtrar los resultados.
                Si se pasa una cadena vacía, retorna los resultados más recientes.
    
        Returns:
            dict[str, Any] | None: Diccionario con los resultados de loterías
            para la fecha indicada, o None si ocurre un error de red o la API
            no responde.
    
        Example:
            >>> await get_resultados("2026-04-24")
            {"data": [{"lottery": "Lotería Nacional", "result": "1234", ...}]}
        """
        if date:
            url = f"{API_BASE}results/{date}"
        else:
            url = f"{API_BASE}results"
    
        data = await call(url)
    
        return data
  • loteria.py:40-41 (registration)
    The @mcp.tool() decorator registers get_resultados as an MCP tool on the FastMCP server instance.
    @mcp.tool()
    async def get_resultados(date: str) -> dict[str, Any] | None:
  • Helper function 'call' used by get_resultados to perform HTTP GET requests with a user-agent header and timeout, returning JSON or None on failure.
    async def call(url: str) -> dict[str, Any] | None:
        headers = {"User-Agent": USER_AGENT, "Accept": "application/json"}
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, timeout=30.0)
                response.raise_for_status()
                return response.json()
            except Exception:
                return None
  • FastMCP server instance and API constants (API_BASE, USER_AGENT) used by get_resultados.
    mcp = FastMCP("loteria")
    
    API_BASE = "https://api-resultadosloterias.com/api/"
    USER_AGENT = "loteria-app/1.0"
Behavior4/5

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

With no annotations, the description fully carries the burden. It explains that it queries an API endpoint, returns a dict or None on network error, and includes an example. This is adequate disclosure of behavior.

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?

Description is structured in sections (Args, Returns, Example) and front-loaded. It is slightly verbose but still efficient for the information provided.

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 simplicity (1 param, output schema present), the description covers purpose, parameter semantics, return type, and error cases. It does not mention the sibling tool, but completeness is acceptable.

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?

Schema coverage is 0%, but the description contains an extensive 'Args' section explaining the single parameter 'date'—format, behavior when empty, and example. It adds significant meaning beyond the 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 obtains lottery results for a specific date ('Obtiene los resultados de loterías para una fecha específica'). It distinguishes from the sibling tool 'get_lotteries' which likely lists lotteries, but does not explicitly contrast them.

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?

No guidance on when to use this tool instead of the sibling 'get_lotteries'. The description provides parameter usage (empty string for most recent) but not tool selection context.

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/parrotsoft/loteria-mcp'

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