Skip to main content
Glama

get_cities

Retrieve cities for a specific state or province using its numeric ID. Supports pagination and customizable data fields for geographic information access.

Instructions

Get all cities for a state/province by state ID. Requires Starter plan or above.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
state_idYesNumeric state ID (from get_states response)
pageNo
limitNo
fieldsNo

Implementation Reference

  • The 'get_cities' tool is registered on the McpServer here, which includes both the tool definition (schema) and the execution logic (handler).
    server.tool(
      'get_cities',
      'Get all cities for a state/province by state ID. Requires Starter plan or above.',
      {
        state_id: z.number().int().positive().describe('Numeric state ID (from get_states response)'),
        page: z.number().int().positive().optional(),
        limit: z.number().int().min(1).max(100).optional(),
        fields: z.enum(['basic', 'standard', 'full']).optional(),
      },
      async ({ state_id, 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/states/${state_id}/cities${qs}`);
        return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
      }
    );
  • The execution handler for the 'get_cities' tool, which performs the API call to fetch city data.
    async ({ state_id, 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/states/${state_id}/cities${qs}`);
      return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
    }
  • The input schema definition for the 'get_cities' tool using Zod.
    {
      state_id: z.number().int().positive().describe('Numeric state ID (from get_states response)'),
      page: z.number().int().positive().optional(),
      limit: z.number().int().min(1).max(100).optional(),
      fields: z.enum(['basic', 'standard', 'full']).optional(),
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions a plan requirement ('Starter plan or above'), which is useful context about access control. However, it lacks critical behavioral details: whether this is a read-only operation, if it supports pagination (implied by 'page' parameter but not explained), rate limits, error handling, or what the output looks like (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—two short sentences with zero wasted words. It front-loads the core purpose and follows with a critical constraint. Every sentence earns its place by providing essential information without redundancy.

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 tool's complexity (4 parameters, no annotations, no output schema), the description is incomplete. It covers the basic purpose and a plan requirement but misses parameter explanations, behavioral traits like pagination or safety, and output details. For a data retrieval tool with multiple parameters, this leaves significant gaps for an AI agent.

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

Parameters2/5

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

Schema description coverage is only 25% (only 'state_id' has a description), so the description must compensate. It mentions 'state ID' but doesn't clarify its source ('from get_states response' is in the schema, not the description). It doesn't explain 'page', 'limit', or 'fields' parameters at all, leaving three of four parameters semantically undocumented in the description.

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 verb ('Get') and resource ('cities'), specifying they are retrieved 'for a state/province by state ID'. It distinguishes from siblings like 'get_states' by focusing on cities rather than states, though it doesn't explicitly contrast with 'list_countries' or 'search_countries' which might also return location data.

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 when needing cities for a specific state, but provides no explicit guidance on when to use this tool versus alternatives like 'global_search' or 'search_countries'. The 'Requires Starter plan or above' is a prerequisite, not a usage guideline. No when-not-to-use or alternative tool recommendations are included.

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