Skip to main content
Glama

get_states

Retrieve all states or provinces for any country using ISO country codes. This tool provides geographic data through the ApogeoAPI MCP server for location-based applications.

Instructions

Get all states/provinces for a country. Requires Starter plan or above.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
country_codeYesISO2 or ISO3 country code
pageNo
limitNo
fieldsNo

Implementation Reference

  • The handler function that executes the logic for the 'get_states' tool, fetching data from the API.
    async ({ country_code, page, limit, fields }) => {
      const params = new URLSearchParams();
      if (page) params.set('page', String(page));
      if (limit) params.set('limit', String(limit));
      if (fields) params.set('fields', fields);
      const qs = params.toString() ? `?${params}` : '';
      const data = await apiGet(`/v1/api/geo/countries/${country_code.toUpperCase()}/states${qs}`);
      return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
    }
  • The registration of the 'get_states' tool with the MCP server, including its schema definition.
    server.tool(
      'get_states',
      'Get all states/provinces for a country. Requires Starter plan or above.',
      {
        country_code: z.string().min(2).max(3).describe('ISO2 or ISO3 country code'),
        page: z.number().int().positive().optional(),
        limit: z.number().int().min(1).max(100).optional(),
        fields: z.enum(['basic', 'standard', 'full']).optional(),
      },
      async ({ country_code, page, limit, fields }) => {
        const params = new URLSearchParams();
        if (page) params.set('page', String(page));
        if (limit) params.set('limit', String(limit));
        if (fields) params.set('fields', fields);
        const qs = params.toString() ? `?${params}` : '';
        const data = await apiGet(`/v1/api/geo/countries/${country_code.toUpperCase()}/states${qs}`);
        return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions a plan requirement ('Starter plan or above'), which is useful context, but fails to describe other key behaviors such as pagination handling (implied by 'page' and 'limit' parameters), rate limits, error conditions, or the format of returned data. This is inadequate for a tool with multiple parameters and no output schema.

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 extremely concise with two sentences that are front-loaded and waste no words. The first sentence states the core purpose, and the second adds essential context about plan requirements, making it efficient and well-structured.

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?

Given the complexity (4 parameters, low schema coverage, no annotations, no output schema), the description is incomplete. It lacks details on parameter usage, return values, error handling, and behavioral traits beyond the plan requirement. For a data retrieval tool with pagination and field options, this leaves significant gaps for an AI agent to understand how to invoke it correctly.

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 description coverage is low at 25%, with only 'country_code' having a description in the schema. The description does not add any parameter-specific information beyond what the schema provides, such as explaining the 'fields' enum options or pagination behavior. However, it implicitly supports the 'country_code' parameter by mentioning 'for a country', offering minimal compensation. This meets the baseline for partial coverage.

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's purpose: 'Get all states/provinces for a country.' It specifies the verb ('Get') and resource ('states/provinces'), and includes a scope ('for a country'). However, it does not explicitly differentiate from sibling tools like 'get_cities' or 'get_country', which reduces it from a perfect score.

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 provides some usage context: 'Requires Starter plan or above' indicates a prerequisite, but it does not specify when to use this tool versus alternatives like 'get_cities' or 'list_countries'. The guidance is implied rather than explicit, leaving gaps in distinguishing from siblings.

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/APOGEOAPI/apogeoapi-mcp'

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