get_states
Pack: country-state-city · Endpoint: https://gateway.pipeworx.io/country-state-city/mcp
Get all states or provinces for a country by ISO2 code (e.g., “US”, “IN”, “BR”). Returns state names, codes, and types.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
_apiKey | string | yes | CountryStateCity API key |
country_code | string | yes | ISO2 country code (e.g., “US”, “CA”, “GB”, “DE”) |
Example call
Arguments
{
"_apiKey": "your-country-state-city-api-key",
"country_code": "US"
}
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_states","arguments":{"_apiKey":"your-country-state-city-api-key","country_code":"US"}}}'
TypeScript (@pipeworx/sdk)
import { Pipeworx } from '@pipeworx/sdk';
const pipeworx = new Pipeworx();
const result = await pipeworx.call('get_states', {
"_apiKey": "your-country-state-city-api-key",
"country_code": "US"
});
More examples
{
"_apiKey": "your-country-state-city-api-key",
"country_code": "IN"
}
Response shape
Always returns: country_code, count, states
| Field | Type | Description |
|---|---|---|
country_code | string | ISO2 country code provided |
count | number | Total number of states returned |
states | array |
Full JSON Schema
{
"type": "object",
"properties": {
"country_code": {
"type": "string",
"description": "ISO2 country code provided"
},
"count": {
"type": "number",
"description": "Total number of states returned"
},
"states": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "State or province name"
},
"code": {
"type": "string",
"description": "State or province code (ISO2)"
},
"type": {
"type": [
"string",
"null"
],
"description": "Type of state division"
}
},
"required": [
"name",
"code",
"type"
]
}
}
},
"required": [
"country_code",
"count",
"states"
]
}
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.