---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}:executeTool"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}:executeTool"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}:executeTool

`POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}:executeTool`

## Request

- Base URL: `https://ces.googleapis.com`
- URL: `https://ces.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}:executeTool`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/ces`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/ces`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`

Executes the given tool with the given arguments.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `appsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- ExecuteToolRequest: Request message for ToolService.ExecuteTool.
  - `args` object: Optional. The input parameters and values for the tool in JSON object format.
  - `context` object: Optional. The [ToolCallContext](https://docs.cloud.google.com/customer-engagement-ai/conversational-agents/ps/tool/python#environment for details) to be passed to the Python tool.
  - `mockConfig` MockConfig: Mock tool calls configuration for the session.
    - `mockedToolCalls` MockedToolCall[]: Optional. All tool calls to mock for the duration of the session.
      - `expectedArgsPattern` object: Required. A pattern to match against the args / inputs of all dispatched tool calls. If the tool call inputs match this pattern, then mock output will be returned.
      - `mockResponse` object: Optional. The mock response / output to return if the tool call args / inputs match the pattern.
      - `tool` string: Optional. Deprecated. Use tool_identifier instead.
      - `toolId` string: Optional. The name of the tool to mock. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
      - `toolset` ToolsetTool: A tool that is created from a toolset.
        - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
        - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
    - `unmatchedToolCallBehavior` 'UNMATCHED_TOOL_CALL_BEHAVIOR_UNSPECIFIED' | 'FAIL' | 'PASS_THROUGH': Required. Beavhior for tool calls that don't match any args patterns in mocked_tool_calls.
  - `tool` string: Optional. The name of the tool to execute. Format: projects/{project}/locations/{location}/apps/{app}/tools/{tool}
  - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
    - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
    - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
  - `variables` object: Optional. The variables that are available for the tool execution.

## Response `200`

Successful response

- ExecuteToolResponse: Response message for ToolService.ExecuteTool.
  - `citations` Citations: Citations associated with the agent response.
    - `citedChunks` CitationsCitedChunk[]: List of cited pieces of information.
      - `requiresAttribution` boolean: Whether this citation requires attribution to be shown to the end users.
      - `text` string: Text used for citation.
      - `title` string: Title of the cited document.
      - `uri` string: URI used for citation.
    - `inlineCitations` CitationsInlineCitation[]: Optional. List of inline citations in the agent response.
      - `citedChunkIndices` integer[]: The indices of the cited chunks that back this text segment. Indices refer to the elements in `cited_chunks`.
      - `endIndex` integer: The ending index (in bytes) of the text segment in the agent response.
      - `startIndex` integer: The starting index (in bytes) of the text segment in the agent response.
  - `googleSearchSuggestions` GoogleSearchSuggestions: Search suggestions from Google Search Tool.
    - `htmls` string[]: Compliant HTML and CSS styling for search suggestions. The provided HTML and CSS automatically adapts to your device settings, displaying in either light or dark mode indicated by `@media(prefers-color-scheme)`.
    - `webSearchQueries` WebSearchQuery[]: List of queries used to perform the google search along with the search result URIs forming the search suggestions.
      - `query` string: The search query text.
      - `uri` string: The URI to the Google Search results page for the query.
  - `response` object: The tool execution result in JSON object format. Use "output" key to specify tool response and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as tool execution result.
  - `tool` string: The name of the tool that got executed. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
  - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
    - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
    - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
  - `variables` object: The variable values at the end of the tool execution.

## Changes

- **2026-11-17** `455f2f484021`: 4 info
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`
- **2026-11-11** `d1599b011b2e`: 4 info
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/ces/changes/v1/projects/:projectsId/locations/:locationsId/apps/:appsId:executeTool/post.md)

---

[API](https://skmtc.dev/google/apis/ces.md) - [All operations](https://skmtc.dev/google/apis/ces/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/ces/revisions/455f2f484021?raw)
