You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(tools): Improve tool robustness and developer experience
This commit introduces several key improvements to the Gemini Cloud Assist tools to make them more reliable and easier to use.
The primary changes include:
- **Enhanced Tool Definitions:** The documentation for all troubleshooting tools has been significantly updated to provide clear, strict instructions for use. This includes mandating fully-formed GCP resource URIs and absolute UTC timestamps, which will reduce errors and improve the reliability of tool calls.
- **Client-Side Validation:** The API client now proactively checks for authentication and licensing before attempting to make any API calls. This provides clearer, more immediate feedback if credentials are not set up correctly.
- **Cleaner Initial Output:** The `create_investigation` tool now returns a more concise summary by default, with the option to include detailed observations and hypotheses when needed.
Change-Id: I1e7acff515e557c184785173f48a695b6a17cd1a
* Creates a new Gemini Cloud Assist Investigation.
84
+
* Creates a new Gemini Cloud Assist Investigation. This tool is the primary entry point for initiating any new troubleshooting analysis.
85
+
*
86
+
* Prerequisites:
87
+
* Argument Resolution: Before invoking this tool, you **MUST** resolve all user-provided information into the specific formats required by the arguments.
99
88
*
100
-
* This is the first and mandatory step.
89
+
* Resource URI Mandate: The 'relevant_resources' parameter requires a list of full Google Cloud Platform (GCP) resource URIs.
90
+
* - **Format:** Each URI **MUST** strictly adhere to the format: //<service>.googleapis.com/<resource-path>.
91
+
* - **Validation:** The tool will fail if the provided strings are not well-formed URIs in this exact format.
92
+
* - **Resolution:** You are responsible for converting any partial, ambiguous, or incomplete resource names (e.g., "my GKE cluster", "the default nodepool", or "project/zone/resource_type/resource_name") into their full URI representation. Utilize available tools like 'gcloud', 'kubectl', or your internal knowledge base to discover the complete and accurate resource URIs.
93
+
* - **GCP Resource URI Reference**: https://cloud.google.com/asset-inventory/docs/asset-names
* This tool is the primary entry point for starting any new troubleshooting
103
-
* analysis.
98
+
* Additional Argument Formatting:
99
+
* - **Timestamp ('start_time'):** Convert all relative time expressions (e.g., "30 minutes ago", "yesterday at 5pm") into the absolute 'YYYY-MM-DDTHH:mm:ssZ' UTC format. The 'Shell' tool with the 'date' command can be used for this conversion.
100
+
* - **Project ID ('project_id'):** If a project is not explicitly mentioned by the user, you must determine the correct one from the context of the conversation or by using the command 'gcloud config get-value project'.
104
101
*
105
-
* **Prerequisites: Argument Resolution**
106
-
* Before calling this tool, you **MUST** resolve all user-provided information
107
-
* into the required, specific formats using your available tools.
108
-
* - **Resource URIs ('relevant_resources')**: Convert vague names (e.g., "my
109
-
* GKE cluster", "the default nodepool") into full resource URIs. Use
110
-
* 'gcloud', 'kubectl', or 'Memorybank' to find the exact paths.
111
-
* - **Timestamp ('start_time')**: Convert relative times (e.g., "30 minutes
112
-
* ago", "yesterday at 5pm") into the absolute 'YYYY-MM-DDTHH:mm:ssZ'
113
-
* (UTC) format. Use the 'Shell' tool (e.g., with the 'date' command).
114
-
* - **Project ID ('project_id')**: If the user doesn't specify a project,
115
-
* determine the correct one from context or by using 'gcloud config get-value
116
-
* project'.
117
-
* **If you cannot resolve any of this information, you MUST ask the user for
118
-
* clarification before proceeding.**
102
+
* **Crucial:** If you are unable to resolve any of this information into the required formats, you **MUST** seek clarification from the user before proceeding to call this tool.
119
103
*
120
-
* @param {string} projectId [REQUIRED] The fully-resolved Google Cloud Project ID.
121
-
* @param {string} title [REQUIRED] A human-readable title. You MUST prefix the title with "[Gemini CLI]".
122
-
* @param {string} issue_description [REQUIRED] A detailed description of the issue.
123
-
* @param {Array<string>} relevant_resources [REQUIRED] A list of fully-resolved resource URIs.
124
-
* @param {string} start_time [REQUIRED] The investigation start time, formatted as 'YYYY-MM-DDTHH:mm:ssZ' (UTC).
125
-
* @returns {string} A summary of the new investigation, structured with markdown. You
126
-
* **MUST**
127
-
* parse this output to find the '**Investigation Path**' and
128
-
* '**Revision Path**'
129
-
* fields. The final segment of the 'Investigation Path' is the
130
-
* 'investigation_id',
131
-
* and the final segment of the 'Revision Path' is the 'revision_id'.
132
-
* These
133
-
* are required for subsequent tool calls.
104
+
* @returns {string} A summary of the new investigation, structured with Markdown.
105
+
* You **MUST** parse this output to find the '**Investigation Path**' and '**Revision Path**'
106
+
* fields. The final segment of the 'Investigation Path' is the 'investigation_id' and the
107
+
* final segment of the 'Revision Path' is the 'revision_id'. These are required for subsequent tool calls.
134
108
*/`,
135
109
{
136
-
projectId: z.string().describe('The Google Cloud Project ID.'),
137
-
title: z.string().describe('The title of the investigation.'),
138
-
issue_description: z.string().describe('A description of the issue.'),
139
-
relevant_resources: z.array(z.string()).describe('A list of relevant resources.'),
140
-
start_time: z.string().describe('The start time of the issue in RFC3339 UTC "Zulu" format.')
110
+
projectId: z.string().describe("The Google Cloud Project ID."),
111
+
title: z.string().describe("A human-readable title. You MUST prefix the title with \"[Gemini CLI]\""),
112
+
issue_description: z.string().describe("A detailed comprehensive description of the issue including relevant tool outputs."),
113
+
relevant_resources: z.array(z.string()).describe("A list of fully-resolved GCP resource URIs, each starting with '//<service>.googleapis.com/...'. For example: '//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance-name'."),
114
+
start_time: z.string().describe("The investigation start time, formatted as 'YYYY-MM-DDTHH:mm:ssZ' (UTC).")
* Adds a new user observation to an existing investigation.
275
219
*
276
-
* **Prerequisites: Argument Resolution**
277
-
* Before calling this tool, you **MUST** resolve any new resource names
278
-
* mentioned in the user's observation.
279
-
* - **Resource URIs ('relevant_resources')**: If the user's 'observation'
280
-
* mentions new resources, convert their vague names into full resource URIs
281
-
* using 'gcloud', 'kubectl', or 'Memorybank'. If no new resources are
282
-
* mentioned, provide an empty list '[]'.
283
-
* **If you cannot resolve a resource name, you MUST ask the user for
284
-
* clarification before proceeding.**
220
+
* Prerequisites:
221
+
* Argument Resolution: Before invoking this tool, you **MUST** resolve any new resource names mentioned in the user's observation into the specific formats required by the arguments.
222
+
*
223
+
* Resource URI Mandate: If the user's 'observation' mentions new resources, the 'relevant_resources' parameter requires a list of full Google Cloud Platform (GCP) resource URIs. If no new resources are mentioned, provide an empty list '[]'.
224
+
* - **Format:** Each URI **MUST** strictly adhere to the format: //<service>.googleapis.com/<resource-path>.
225
+
* - **Validation:** The tool will fail if any provided strings are not well-formed URIs in this exact format.
226
+
* - **Resolution:** You are responsible for converting any partial, ambiguous, or incomplete resource names into their full URI representation. Utilize available tools like 'gcloud', 'kubectl', or your internal knowledge base to discover the complete and accurate resource URIs.
227
+
* - **GCP Resource URI Reference**: https://cloud.google.com/asset-inventory/docs/asset-names
* **Workflow:** After adding an observation, you **MUST** call
287
-
* 'run_investigation'
288
-
* on the new revision to re-analyze with the added context.
232
+
* **Crucial:** If you cannot resolve a new resource name into the required format, you **MUST** seek clarification from the user before proceeding to call this tool.
289
233
*
290
-
* @param {string} projectId [REQUIRED] The GCP Project ID where the investigation resides.
291
-
* @param {string} investigationId [REQUIRED] The ID of the investigation.
292
-
* @param {string} observation [REQUIRED] The new information or question from the user.
293
-
* @param {Array<string>} relevant_resources [REQUIRED] A list of fully-resolved resource URIs for any new resources mentioned in the observation.
294
-
* @returns {string} A string summary of the updated investigation, structured with markdown.
234
+
* Workflow: After adding an observation, you **MUST** call 'run_investigation' on the new revision to re-analyze with the added context.
235
+
*
236
+
* @returns {string} A string summary of the updated investigation, structured with Markdown.
295
237
* You **MUST** parse this output to find the '**Revision Path**' field.
296
238
* The final segment of this path is the new 'revision_id' that you must
297
239
* use for the subsequent 'run_investigation' call.
298
240
*/`,
299
241
{
300
-
projectId: z.string().describe('The Google Cloud Project ID.'),
301
-
investigationId: z.string().describe('The ID of the investigation.'),
302
-
observation: z.string().describe('The new information or question from the user.'),
303
-
relevant_resources: z.array(z.string()).describe('A list of fully-resolved resource URIs for any new resources mentioned in the observation.'),
242
+
projectId: z.string().describe("The GCP Project ID where the investigation resides."),
243
+
investigationId: z.string().describe("The ID of the investigation."),
244
+
observation: z.string().describe("The new information or question from the user."),
245
+
relevant_resources: z.array(z.string()).describe("A list of fully-resolved GCP resource URIs for any new resources mentioned in the observation, each starting with '//<service>.googleapis.com/...'. Provide an empty list if no new resources are mentioned."),
0 commit comments