Tool: optimize_costs
The Optimize Agent helps users analyze, track, and optimize their Google Cloud costs. It provides detailed breakdowns of spend and identifies opportunities for cost efficiency by finding idle or underutilized resources.
Core Features:
- Cost Analysis:Breaks down spend by project, application, product, resource, or location to answer "how much did I spend" questions.
- Top Cost Drivers:Identifies the most expensive resources or services driving the bill.
- Cost Trends:Analyzes how costs have changed over time (e.g., month-over-month increases).
- Efficiency & Rightsizing:Identifies idle, overprovisioned, or underutilized resources specifically to highlight cost-saving opportunities.
Important Routing Constraints:
- DOroute questions about "underutilized" or "idle" resources if the context is saving money (e.g., "Show me the cost of my most underutilized resources").
- DO NOTroute general utilization questions unrelated to cost (e.g., "How much vCPU did resource X use?").
- This agent does notpredict future costs.
- This agent does nottake any action to reduce costs (read-only analysis).
When to route to this agent:
- User asks "How much did I spend on Compute Engine last month?"
- User asks "What are my most expensive resources?"
- User asks "Which resources are idle and costing me money?"
- User asks "Why did my bill go up compared to last month?"
Session Management:
- This tool returns a
contextIdin its output. - To continue a conversation (multi-turn), you MUST include this
contextId. - Omit
contextIdto start a new, independent task.
The following sample demonstrate how to use curl
to invoke the optimize_costs
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": "optimize_costs", "arguments": { // provide these details according to the tool' s MCP specification } } , "jsonrpc" : "2.0" , "id" : 1 } ' |
Input Schema
Request for OptimizeCosts
OptimizeCostsRequest
| 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 OptimizeCosts. This message is only used as an output_schema_override.
OptimizeCostsResponse
| 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: ✅

