get_cities
Pack: country-state-city · Endpoint: https://gateway.pipeworx.io/country-state-city/mcp
Get cities for a country, optionally filtered by state. Pass country_code (e.g., “US”) and optionally state_code (e.g., “CA”) to narrow results.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
_apiKey | string | yes | CountryStateCity API key |
country_code | string | yes | ISO2 country code (e.g., “US”, “IN”) |
state_code | string | no | State/province code to filter by (e.g., “CA”, “NY”, “TX”) |
Example call
Arguments
{
"_apiKey": "your-country-state-city-api-key",
"country_code": "US",
"state_code": "CA"
}
curl
curl -X POST https://gateway.pipeworx.io/country-state-city/mcp \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_cities","arguments":{"_apiKey":"your-country-state-city-api-key","country_code":"US","state_code":"CA"}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('get_cities', {
"_apiKey": "your-country-state-city-api-key",
"country_code": "US",
"state_code": "CA"
});
More examples
{
"_apiKey": "your-country-state-city-api-key",
"country_code": "GB"
}
Response shape
Always returns: country_code, state_code, count, cities
| Field | Type | Description |
|---|---|---|
country_code | string | ISO2 country code provided |
state_code | string | null | State code filter if provided, null if not |
count | number | Total number of cities returned |
cities | array |
Full JSON Schema
{
"type": "object",
"properties": {
"country_code": {
"type": "string",
"description": "ISO2 country code provided"
},
"state_code": {
"type": [
"string",
"null"
],
"description": "State code filter if provided, null if not"
},
"count": {
"type": "number",
"description": "Total number of cities returned"
},
"cities": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "City name"
},
"latitude": {
"type": [
"string",
"null"
],
"description": "City latitude coordinate"
},
"longitude": {
"type": [
"string",
"null"
],
"description": "City longitude coordinate"
}
},
"required": [
"name",
"latitude",
"longitude"
]
}
}
},
"required": [
"country_code",
"state_code",
"count",
"cities"
]
}
Connect
Add this to your MCP client config, or use one-click install buttons:
{
"mcpServers": {
"country-state-city": {
"url": "https://gateway.pipeworx.io/country-state-city/mcp"
}
}
}
See Getting Started for client-specific install steps.