Tool: invoke_operation
Invokes the Operations Agent for Cloud Operations tasks.
The Operations Agent is capable of handling various cloud operations, investigations, and management tasks.
The user_query is a stringified JSON object that defines the exact operation. The JSON MUST contain an operation_type key with one of two values: GKE_APPLY, GKE_PATCH. Based on the operation_type, provide exactly one of the corresponding objects:
If
GKE_APPLY: Provide agke_applyobject containing:target_cluster(string, required): Full resource name, e.g.,projects/{p}/locations/{l}/clusters/{c}.yaml_manifest(string, required): The raw YAML string. Ensure newlines are escaped.namespace(string, optional): Overrides the namespace.force_conflicts(boolean, optional): If true, force conflicts resolution when applying. This corresponds to kubectl apply --server-side --force-conflicts. Use this to ensure the intended state is applied even if another field manager currently owns the targeted fields.
If
GKE_PATCH: Provide agke_patchobject containing:target_cluster(string, required): Full resource name.resource_type(string, required): e.g.,deployments.resource_name(string, required): Name of the k8s resource.patch_json(string, required): The JSON patch string. Escaped properly.namespace(string, optional): The namespace of the resource.
Examples:
Example 1 (
GKE_APPLY):{ "operation_type": "GKE_APPLY", "gke_apply": { "target_cluster": "projects/my-company/locations/us-central1/clusters/my-cluster", "yaml_manifest": "apiVersion: v1 | kind: ConfigMap | metadata: name: my-config | data: key: value", "namespace": "default" } }Example 2 (
GKE_PATCH):{ "operation_type": "GKE_PATCH", "gke_patch": { "target_cluster": "projects/my-company/locations/us-central1/clusters/my-cluster", "resource_type": "deployments", "resource_name": "my-app", "patch_json": "{'spec': {'replicas': 5}}", "namespace": "default" } }Example 3 (
GKE_APPLYwith force_conflicts to override existing field managers):{ "operation_type": "GKE_APPLY", "gke_apply": { "target_cluster": "projects/my-company/locations/us-central1/clusters/my-cluster", "yaml_manifest": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: web-backend\nspec:\n replicas: 5\n template:\n spec:\n containers:\n - name: app\n image: my-repo/web-backend:v2.0.1", "namespace": "default", "force_conflicts": true } }
Args:
project: The Google Cloud project with formatprojects/{project_id}.userQuery: A stringified JSON object that defines the exact operation.contextId: Context ID from the previous agent response.
Session Management:
- This tool returns a
contextIdin its output. - To continue a conversation (multi-turn), you MUST include this
contextIdin the next request. - Omit
contextIdto start a new, independent task.
The following sample demonstrate how to use curl to invoke the invoke_operation MCP tool.
| Curl Request |
|---|
curl --location 'https://geminicloudassist.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "invoke_operation", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request for InvokeOperation
InvokeOperationRequest
| JSON representation |
|---|
{ "project": string, "userQuery": string, "contextId": string } |
| Fields | |
|---|---|
project |
Required. The project resource name in the format |
userQuery |
Required. The natural language prompt provided by the user. |
contextId |
Optional. This is an optional session ID to continue a conversation. |
Output Schema
Represents the response for InvokeOperation. This message is only used as an output_schema_override.
InvokeOperationResponse
| JSON representation |
|---|
{ "content": string, "contextId": string } |
| Fields | |
|---|---|
content |
Contains the textual response received from the agent. |
contextId |
Represents the session ID; clients must persist this. |
Tool Annotations
Destructive Hint: ✅ | Idempotent Hint: ✅ | Read Only Hint: ❌ | Open World Hint: ✅