Tool: GetPolicy
Gets a specific policy on a resource by name. Returns the policy details if set.
The following code sample shows how to use curl to call the GetPolicy MCP tool.
| Curl Request |
|---|
curl --location 'https://orgpolicy.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "GetPolicy", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
The request sent to the GetPolicy method.
GetPolicyRequest
| JSON representation |
|---|
{ "name": string } |
| Fields | |
|---|---|
name |
Required. Resource name of the policy. See |
Output Schema
Defines an organization policy that is used to specify constraints for configurations of Google Cloud resources.
Policy
| JSON representation |
|---|
{ "name": string, "spec": { object ( |
| Fields | |
|---|---|
name |
Immutable. The resource name of the policy. Must be one of the following forms, where
For example, Note: |
spec |
Basic information about the organization policy. |
alternate |
Deprecated. |
dryRunSpec |
Dry-run policy. Audit-only policy, can be used to monitor how the policy would have impacted the existing and future resources if it's enforced. |
etag |
Optional. An opaque tag indicating the current state of the policy, used for concurrency control. This entity tag (ETag) is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. |
PolicySpec
| JSON representation |
|---|
{
"etag": string,
"updateTime": string,
"rules": [
{
object ( |
| Fields | |
|---|---|
etag |
An opaque tag indicating the current version of the policySpec, used for concurrency control. This field is ignored if used in a When the policy is returned from either a When the policy is returned from a |
updateTime |
Output only. The time stamp this was previously updated. This represents the last time a call to 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: |
rules[] |
In policies for boolean constraints, the following requirements apply:
|
inheritFromParent |
Determines the inheritance behavior for this policy. If |
reset |
Ignores policies set above this resource and restores the |
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. |
PolicyRule
| JSON representation |
|---|
{ "condition": { object ( |
| Fields | |
|---|---|
condition |
A condition that determines whether this rule is used to evaluate the policy. When set, the The
For example: The
For example: The
For example: The
For example: |
parameters |
Optional. Required for managed constraints if parameters are defined. Passes parameter values when policy enforcement is enabled. Ensure that parameter value types match those defined in the constraint definition. For example: |
Union field
|
|
values |
List of values to be used for this policy rule. This field can be set only in policies for list constraints. |
allowAll |
Setting this to true means that all values are allowed. This field can be set only in policies for list constraints. |
denyAll |
Setting this to true means that all values are denied. This field can be set only in policies for list constraints. |
enforce |
If |
StringValues
| JSON representation |
|---|
{ "allowedValues": [ string ], "deniedValues": [ string ] } |
| Fields | |
|---|---|
allowedValues[] |
List of values allowed at this resource. |
deniedValues[] |
List of values denied at this resource. |
Expr
| JSON representation |
|---|
{ "expression": string, "title": string, "description": string, "location": string } |
| Fields | |
|---|---|
expression |
Textual representation of an expression in Common Expression Language syntax. |
title |
Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. |
description |
Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. |
location |
Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. |
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. |
AlternatePolicySpec
| JSON representation |
|---|
{
"launch": string,
"spec": {
object ( |
| Fields | |
|---|---|
launch |
Reference to the launch that will be used while audit logging and to control the launch. Set only in the alternate policy. |
spec |
Specify constraint for configurations of Google Cloud resources. |
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. |
Tool Annotations
Tool annotations are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.
Along with the title string, the following boolean hints are defined as follows:
readOnlyHint: If true, the tool doesn't modify its environment. Default: false.destructiveHint: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.idempotentHint: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.openWorldHint: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌