Skip to main content
Glama
Pradumnasaraf

Aviationstack MCP Server

random_countries_detailed_info

Obtain comprehensive metadata for a requested number of random countries, facilitating data sampling or geographical exploration.

Instructions

Return detailed metadata for random countries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
number_of_countriesYesNumber of random countries to return.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core handler function that fetches detailed info for random countries from the aviationstack API. Validates input, fetches country data, samples randomly, extracts and returns JSON with fields: country_name, capital, currency_code, fips_code, country_iso2, country_iso3, continent, country_id, currency_name, country_iso_numeric, phone_prefix, population.
    def random_countries_detailed_info(number_of_countries: int) -> str:
        """Get detailed info for random countries."""
        try:
            _validate_positive_int(number_of_countries, "number_of_countries")
            data = fetch_flight_data("countries", {"limit": number_of_countries})
            sampled_countries = _sample_data(data.get("data", []), number_of_countries)
    
            countries = []
            for country in sampled_countries:
                countries.append(
                    {
                        "country_name": country.get("name"),
                        "capital": country.get("capital"),
                        "currency_code": country.get("currency_code"),
                        "fips_code": country.get("fips_code"),
                        "country_iso2": country.get("country_iso2"),
                        "country_iso3": country.get("country_iso3"),
                        "continent": country.get("continent"),
                        "country_id": country.get("country_id"),
                        "currency_name": country.get("currency_name"),
                        "country_iso_numeric": country.get("country_iso_numeric"),
                        "phone_prefix": country.get("phone_prefix"),
                        "population": country.get("population"),
                    }
                )
            return json.dumps(countries)
        except requests.RequestException as exc:
            return _error_response("fetching countries", exc)
        except (KeyError, ValueError, TypeError) as exc:
            return _error_response("fetching countries", exc)
  • Tool wrapper/registration for 'random_countries_detailed_info' using @mcp.tool decorator. Defines the tool's name, description, input parameter (number_of_countries), validates via Pydantic schema, and delegates to the core handler function.
    @mcp.tool(
        name="random_countries_detailed_info",
        description="Return detailed metadata for random countries.",
    )
    def random_countries_detailed_info_tool(
        number_of_countries: Annotated[
            int, Field(description="Number of random countries to return.", gt=0)
        ],
    ) -> str:
        """Tool wrapper for random_countries_detailed_info."""
        validated_input = RandomCountriesDetailedInfoInput(
            number_of_countries=number_of_countries
        )
        return random_countries_detailed_info(
            number_of_countries=validated_input.number_of_countries
        )
  • Pydantic input schema (RandomCountriesDetailedInfoInput) for the tool. Validates number_of_countries as a positive integer.
    class RandomCountriesDetailedInfoInput(BaseModel):
        """Input schema for random_countries_detailed_info tool."""
    
        model_config = ConfigDict(extra="forbid")
    
        number_of_countries: int = Field(
            ...,
            description="Number of random countries to return.",
            gt=0,
        )
Behavior2/5

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

No annotations provided, and description only says 'Return', implying a read operation but does not explicitly state read-only nature or any other behavioral traits like side effects or limitations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Very concise single sentence, but under-specified for completeness. Front-loaded with purpose, but lacks necessary details about behavior and usage.

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

Completeness2/5

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

Despite simple input schema and existing output schema, description fails to clarify what 'detailed metadata' includes. Incomplete for an agent to fully understand the tool's output.

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

Parameters3/5

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

Schema coverage is 100% with clear parameter description. Description adds no extra meaning beyond the schema, but parameter is self-explanatory, meeting baseline.

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?

Description clearly states it returns detailed metadata for random countries, which is specific. However, it does not differentiate from sibling tools like random_cities_detailed_info, though the resource type 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 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 versus alternatives, such as for specific country lookups or other random data tools. Lacks context for selection.

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/Pradumnasaraf/aviationstack-mcp'

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