Skip to main content
Glama
parrotsoft

Lotería MCP

by parrotsoft

get_lotteries

Get a list of all available lotteries with names and countries. Queries the lottery API to return every registered lottery for reference.

Instructions

Obtiene el listado de todas las loterías disponibles.

Consulta el endpoint `/lotteries` de la API de resultados de loterías
y retorna la información de cada lotería registrada (nombre, país, etc.).

Returns:
    dict[str, Any] | None: Diccionario con la lista de loterías disponibles,
    o None si ocurre un error de red o la API no responde.

Example:
    >>> await get_lotteries()
    {"data": [{"id": 1, "name": "Lotería Nacional", ...}, ...]}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • loteria.py:1-39 (handler)
    Complete implementation of get_lotteries tool: includes FastMCP instance creation, API_BASE constant, helper call() function, and the @mcp.tool() decorated async handler that fetches /lotteries from the API.
    from typing import Any
    import httpx
    from mcp.server.fastmcp import FastMCP
    
    mcp = FastMCP("loteria")
    
    API_BASE = "https://api-resultadosloterias.com/api/"
    USER_AGENT = "loteria-app/1.0"
    
    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
            
    @mcp.tool()
    async def get_lotteries() -> dict[str, Any] | None:
        """Obtiene el listado de todas las loterías disponibles.
    
        Consulta el endpoint `/lotteries` de la API de resultados de loterías
        y retorna la información de cada lotería registrada (nombre, país, etc.).
    
        Returns:
            dict[str, Any] | None: Diccionario con la lista de loterías disponibles,
            o None si ocurre un error de red o la API no responde.
    
        Example:
            >>> await get_lotteries()
            {"data": [{"id": 1, "name": "Lotería Nacional", ...}, ...]}
        """
        url = f"{API_BASE}lotteries"
        data = await call(url)
    
        return data
Behavior4/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 explicitly states the tool returns a dict or None on network error, and that it queries an API. It does not mention auth or rate limits, but for a read-only list tool, this is adequate.

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 concise with three parts: purpose, endpoint, and return type with example. Each sentence adds value without redundancy, making it well-structured and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity, no parameters, and existence of an output schema, the description fully suffices. It explains the return structure and includes an example, meeting completeness requirements.

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?

The input schema has no parameters, and schema coverage is 100%. Per the guidelines, a baseline of 4 is assigned for zero parameters, and the description adds no further parameter info, which is appropriate.

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 it obtains the list of all available lotteries by querying the /lotteries endpoint, providing specific verb and resource. The sibling tool 'get_resultados' is for results, so this tool is distinct.

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 does not provide explicit guidance on when to use this tool versus alternatives, nor does it mention prerequisites or exclusions. Usage is implied by the tool's purpose but not articulated.

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