# Search Places — Google Maps (Places API)

> Searches for places based on location, radius, and optional filters like keywords, place type, or name. See the documentation

- Key: `google_maps_platform-search-places`
- Type: Action (Read-only)
- Version: 0.0.4
- App: Google Maps (Places API) (`google_maps_platform`) — https://pipedream.com/apps/google-maps-platform.md
- This page (HTML): https://pipedream.com/apps/google-maps-platform/actions/search-places
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_maps_platform/actions/search-places/search-places.mjs

## Description

Searches for places based on location, radius, and optional filters like keywords, place type, or name. [See the documentation](https://developers.google.com/maps/documentation/places/web-service/text-search)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `textQuery` | `string` | Yes | The text string on which to search, for example: "restaurant", "123 Main Street", or "best place to visit in San Francisco". The API returns candidate matches based on this string and orders the results based on their perceived relevance. |
| `includedType` | `string` | No | Restricts the results to places matching the specified type defined by Table A. Only one type may be specified. |
| `includePureServiceAreaBusinesses` | `boolean` | No | If set to true, the response includes businesses that visit or deliver to customers directly, but don't have a physical business location. If set to false, the API returns only businesses with a physical business location. |
| `languageCode` | `string` | No | The language in which to return results. |
| `locationBias` | `object` | No | Specifies an area to search. This location serves as a bias which means results around the specified location can be returned, including results outside the specified area. See the documentation for further information. |
| `locationRestriction` | `string` | No | Specifies an area to search. Results outside the specified area are not returned. |
| `evOptions` | `object` | No | Specifies parameters for identifying available electric vehicle (EV) charging connectors and charging rates. See the documentation for further information. |
| `minRating` | `string` | No | Restricts results to only those whose average user rating is greater than or equal to this limit. Values must be between 0.0 and 5.0 (inclusive) in increments of 0.5. For example: 0, 0.5, 1.0, ... , 5.0 inclusive. Values are rounded up to the nearest 0.5. For example, a value of 0.6 eliminates all results with a rating less than 1.0. |
| `openNow` | `boolean` | No | If true, return only those places that are open for business at the time the query is sent. If false, return all businesses regardless of open status. Places that don't specify opening hours in the Google Places database are returned if you set this parameter to false. |
| `priceLevels` | `string[]` | No | Restrict the search to places that are marked at certain price levels. The default is to select all price levels. |
| `rankPreference` | `string` | No | Specifies how the results are ranked in the response based on the type of query: For a categorical query such as "Restaurants in New York City", RELEVANCE (rank results by search relevance) is the default. You can set Rank Preference to RELEVANCE or DISTANCE (rank results by distance). For a non-categorical query such as "Mountain View, CA", it is recommended that you leave Rank Preference unset. |
| `regionCode` | `string` | No | The region code used to format the response, specified as a two-character CLDR code value. This parameter can also have a bias effect on the search results. |
| `strictTypeFiltering` | `boolean` | No | Used with the Included Type parameter. When set to true, only places that match the specified types specified by includeType are returned. When false, the default, the response can contain places that don't match the specified types. |
| `simplified` | `boolean` | No | If true, the response will contain a reduced set of fields |

## 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": "google_maps_platform",
      },
    },
  },
)

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: "google_maps_platform-search-places",
  arguments: {
    textQuery: "Text Query",
    includedType: "Included Type",
  },
})
```

**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: "google_maps_platform-search-places",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_maps_platform: { authProvisionId: "apn_xxxxxxx" },
    textQuery: "Text Query",
    includedType: "Included Type",
  },
})

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": "google_maps_platform-search-places",
    "configured_props": {
      "google_maps_platform": { "authProvisionId": "apn_xxxxxxx" },
      "textQuery": "Text Query",
      "includedType": "Included Type"
    }
  }'
```

---

- App: https://pipedream.com/apps/google-maps-platform.md · All apps: https://pipedream.com/apps
