# Find Cities — GeoDB Cities

> Find cities, filtering by optional criteria. If no criteria are set, you will get back all known cities with a population of at least 1000. See the docs.

- Key: `geodb_cities-find-cities`
- Type: Action (Read-only)
- Version: 0.0.3
- App: GeoDB Cities (`geodb_cities`) — https://pipedream.com/apps/geodb-cities.md
- This page (HTML): https://pipedream.com/apps/geodb-cities/actions/find-cities
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/geodb_cities/actions/find-cities/find-cities.mjs

## Description

Find cities, filtering by optional criteria. If no criteria are set, you will get back all known cities with a population of at least 1000. [See the docs](https://rapidapi.com/wirefreethought/api/geodb-cities).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `types` | `string[]` | No | The type of city. Possible values are: CITY and ADM2. |
| `location` | `string` | No | Only cities near this location. Latitude/Longitude in ISO-6709 format: ±DD.DDDD±DD.DDDD. For example: +51.5008-0.1247. |
| `minPopulation` | `integer` | No | Only cities having at least this population. |
| `maxPopulation` | `integer` | No | Only cities having no more than this population. |
| `languageCode` | `string` | No | The language to use for the name property. If not set, the name will be in English. Possible values are: en, de, es, fr, it, pt, ru, zh. |
| `namePrefix` | `string` | No | Only cities whose names start with this prefix. If Language Code is set, the prefix will be matched on the name as it appears in that language. |
| `max` | `integer` | No | Max number of records in the whole pagination |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "geodb_cities",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "geodb_cities-find-cities",
  arguments: {
    types: ["City Types"],
    location: "Location",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "geodb_cities-find-cities",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    geodb_cities: { authProvisionId: "apn_xxxxxxx" },
    types: ["City Types"],
    location: "Location",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "geodb_cities-find-cities",
    "configured_props": {
      "geodb_cities": { "authProvisionId": "apn_xxxxxxx" },
      "types": ["City Types"],
      "location": "Location"
    }
  }'
```

---

- App: https://pipedream.com/apps/geodb-cities.md · All apps: https://pipedream.com/apps
