Tool: get_recommendation
Gets a specific recommendation.
The following sample demonstrate how to use curl to invoke the get_recommendation MCP tool.
| Curl Request |
|---|
curl --location 'https://recommender.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "get_recommendation", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request to the GetRecommendation method.
GetRecommendationRequest
| JSON representation |
|---|
{ "name": string } |
| Fields | |
|---|---|
name |
Required. Name of the recommendation. |
Output Schema
A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc
Recommendation
| JSON representation |
|---|
{ "name": string, "description": string, "recommenderSubtype": string, "lastRefreshTime": string, "primaryImpact": { object ( |
| Fields | |
|---|---|
name |
Identifier. Name of recommendation. |
description |
Free-form human readable summary in English. The maximum length is 500 characters. |
recommenderSubtype |
Contains an identifier for a subtype of recommendations produced for the same recommender. Subtype is a function of content and impact, meaning a new subtype might be added when significant changes to Examples: For recommender = "google.iam.policy.Recommender", recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE" |
lastRefreshTime |
Last time this recommendation was refreshed by the system that created it in the first place. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
primaryImpact |
The primary impact that this recommendation can have while trying to optimize for one category. |
additionalImpact[] |
Optional set of additional impact that this recommendation may have when trying to optimize for the primary category. These may be positive or negative. |
priority |
Recommendation's priority. |
content |
Content of the recommendation describing recommended changes to resources. |
stateInfo |
Information for state. Contains state and metadata. |
etag |
Fingerprint of the Recommendation. Provides optimistic locking when updating states. |
associatedInsights[] |
Insights that led to this recommendation. |
xorGroupId |
Corresponds to a mutually exclusive group ID within a recommender. A non-empty ID indicates that the recommendation belongs to a mutually exclusive group. This means that only one recommendation within the group is suggested to be applied. |
targetResources[] |
Fully qualified resource names that this recommendation is targeting. |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
Impact
| JSON representation |
|---|
{ "category": enum ( |
| Fields | |
|---|---|
category |
Category that is being targeted. |
service |
The service that this impact is associated with. |
Union field projection. Contains projections (if any) for this category. projection can be only one of the following: |
|
costProjection |
Use with CategoryType.COST |
securityProjection |
Use with CategoryType.SECURITY |
sustainabilityProjection |
Use with CategoryType.SUSTAINABILITY |
reliabilityProjection |
Use with CategoryType.RELIABILITY |
CostProjection
| JSON representation |
|---|
{ "cost": { object ( |
| Fields | |
|---|---|
cost |
An approximate projection on amount saved or amount incurred. Negative cost units indicate cost savings and positive cost units indicate increase. See google.type.Money documentation for positive/negative units. A user's permissions may affect whether the cost is computed using list prices or custom contract prices. |
duration |
Duration for which this cost applies. A duration in seconds with up to nine fractional digits, ending with ' |
costInLocalCurrency |
The approximate cost savings in the billing account's local currency. |
Money
| JSON representation |
|---|
{ "currencyCode": string, "units": string, "nanos": integer } |
| Fields | |
|---|---|
currencyCode |
The three-letter currency code defined in ISO 4217. |
units |
The whole units of the amount. For example if |
nanos |
Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If |
Duration
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years |
nanos |
Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 |
SecurityProjection
| JSON representation |
|---|
{ "details": { object } } |
| Fields | |
|---|---|
details |
Additional security impact details that is provided by the recommender. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
SustainabilityProjection
| JSON representation |
|---|
{ "kgCO2e": number, "duration": string } |
| Fields | |
|---|---|
kgCO2e |
Carbon Footprint generated in kg of CO2 equivalent. Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e). |
duration |
Duration for which this sustainability applies. A duration in seconds with up to nine fractional digits, ending with ' |
ReliabilityProjection
| JSON representation |
|---|
{
"risks": [
enum ( |
| Fields | |
|---|---|
risks[] |
Reliability risks mitigated by this recommendation. |
details |
Per-recommender projection. |
RecommendationContent
| JSON representation |
|---|
{
"operationGroups": [
{
object ( |
| Fields | |
|---|---|
operationGroups[] |
Operations to one or more Google Cloud resources grouped in such a way that, all operations within one group are expected to be performed atomically and in an order. |
overview |
Condensed overview information about the recommendation. |
OperationGroup
| JSON representation |
|---|
{
"operations": [
{
object ( |
| Fields | |
|---|---|
operations[] |
List of operations across one or more resources that belong to this group. Loosely based on RFC6902 and should be performed in the order they appear. |
Operation
| JSON representation |
|---|
{ "action": string, "resourceType": string, "resource": string, "path": string, "sourceResource": string, "sourcePath": string, "pathFilters": { string: value, ... }, "pathValueMatchers": { string: { object ( |
| Fields | |
|---|---|
action |
Type of this operation. Contains one of 'add', 'remove', 'replace', 'move', 'copy', 'test' and custom operations. This field is case-insensitive and always populated. |
resourceType |
Type of GCP resource being modified/tested. This field is always populated. Example: cloudresourcemanager.googleapis.com/Project, compute.googleapis.com/Instance |
resource |
Contains the fully qualified resource name. This field is always populated. ex: //cloudresourcemanager.googleapis.com/projects/foo. |
path |
Path to the target field being operated on. If the operation is at the resource level, then path should be "/". This field is always populated. |
sourceResource |
Can be set with action 'copy' to copy resource configuration across different resources of the same type. Example: A resource clone can be done via action = 'copy', path = "/", from = "/", source_resource = |
sourcePath |
Can be set with action 'copy' or 'move' to indicate the source field within resource or source_resource, ignored if provided for other operation types. |
pathFilters |
Set of filters to apply if
When both path_filters and path_value_matchers are set, an implicit AND must be performed. An object containing a list of |
pathValueMatchers |
Similar to path_filters, this contains set of filters to apply if An object containing a list of |
Union field path_value. One of the fields in the following block will be set and intend to describe a value for 'path' field. path_value can be only one of the following: |
|
value |
Value for the |
valueMatcher |
Can be set for action 'test' for advanced matching for the value of 'path' field. Either this or |
ValueMatcher
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field match_variant. To be used for full regex matching. match_variant can be only one of the following: |
|
matchesPattern |
To be used for full regex matching. The regular expression is using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax), so to be used with RE2::FullMatch |
PathFiltersEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
PathValueMatchersEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
RecommendationStateInfo
| JSON representation |
|---|
{
"state": enum ( |
| Fields | |
|---|---|
state |
The state of the recommendation, Eg ACTIVE, SUCCEEDED, FAILED. |
stateMetadata |
A map of metadata for the state, provided by user or automations systems. An object containing a list of |
StateMetadataEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
InsightReference
| JSON representation |
|---|
{ "insight": string } |
| Fields | |
|---|---|
insight |
Insight resource name, e.g. projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID] |
Category
The category of the impact.
| Enums | |
|---|---|
CATEGORY_UNSPECIFIED |
Default unspecified category. Don't use directly. |
COST |
Indicates a potential increase or decrease in cost. |
SECURITY |
Indicates a potential increase or decrease in security. |
PERFORMANCE |
Indicates a potential increase or decrease in performance. |
MANAGEABILITY |
Indicates a potential increase or decrease in manageability. |
SUSTAINABILITY |
Indicates a potential increase or decrease in sustainability. |
RELIABILITY |
Indicates a potential increase or decrease in reliability. |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
RiskType
The risk associated with the reliability issue.
| Enums | |
|---|---|
RISK_TYPE_UNSPECIFIED |
Default unspecified risk. Don't use directly. |
SERVICE_DISRUPTION |
Potential service downtime. |
DATA_LOSS |
Potential data loss. |
ACCESS_DENY |
Potential access denial. The service is still up but some or all clients can't access it. |
Priority
Recommendation priority levels.
| Enums | |
|---|---|
PRIORITY_UNSPECIFIED |
Recommendation has unspecified priority. |
P4 |
Recommendation has P4 priority (lowest priority). |
P3 |
Recommendation has P3 priority (second lowest priority). |
P2 |
Recommendation has P2 priority (second highest priority). |
P1 |
Recommendation has P1 priority (highest priority). |
State
Represents Recommendation State.
| Enums | |
|---|---|
STATE_UNSPECIFIED |
Default state. Don't use directly. |
ACTIVE |
Recommendation is active and can be applied. Recommendations content can be updated by Google. ACTIVE recommendations can be marked as CLAIMED, SUCCEEDED, or FAILED. |
CLAIMED |
Recommendation is in claimed state. Recommendations content is immutable and cannot be updated by Google. CLAIMED recommendations can be marked as CLAIMED, SUCCEEDED, or FAILED. |
SUCCEEDED |
Recommendation is in succeeded state. Recommendations content is immutable and cannot be updated by Google. SUCCEEDED recommendations can be marked as SUCCEEDED, or FAILED. |
FAILED |
Recommendation is in failed state. Recommendations content is immutable and cannot be updated by Google. FAILED recommendations can be marked as SUCCEEDED, or FAILED. |
DISMISSED |
Recommendation is in dismissed state. Recommendation content can be updated by Google. DISMISSED recommendations can be marked as ACTIVE. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌