## Tool: `get_service`

Get info about a Cloud Run service, such as its URI and whether the deploy succeeded.

The following code sample shows how to use `curl` to call the `get_service` MCP tool.

| Curl Request |
|---|
| ```bash curl --location 'https://run.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "get_service", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' ``` |

## Input Schema

Request message for obtaining a Service by its full name.

### GetServiceRequest

| JSON representation |
|---|
| ``` { "name": string, "project": string, "region": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Required. The short name of the Service. |
| `project` | `string` Required. The project ID or project number to get the Service from. |
| `region` | `string` Required. The region to get the Service from. |

## Output Schema

The output of a managed Cloud Run Service returned by the API.

### ServiceOutput

| JSON representation |
|---|
| ``` { "name": string, "template": { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.RevisionTemplateOutput`) }, "createTime": string, "updateTime": string, "creator": string, "lastModifier": string, "uri": string, "terminalCondition": { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.Condition`) } } ``` |

| Fields ||
|---|---|
| `name` | `string` The fully qualified name of this Service. Format: projects/{project}/locations/{location}/services/{service_id} |
| `template` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.RevisionTemplateOutput`)`` The template used to create revisions for this Service. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` The creation time. 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: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` The last-modified time. 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: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `creator` | `string` Email address of the creator. |
| `lastModifier` | `string` Email address of the last modifier. |
| `uri` | `string` The main URI in which this Service is serving traffic. |
| `terminalCondition` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.Condition`)`` The terminal condition of this Service, indicating its readiness status. State CONDITION_SUCCEEDED means the service is ready. If the service is not ready, this condition will contain detailed error information. |

### RevisionTemplateOutput

| JSON representation |
|---|
| ``` { "containers": [ { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.ContainerOutput`) } ] } ``` |

| Fields ||
|---|---|
| `containers[]` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.ContainerOutput`)`` Holds the containers that define this Revision. |

### ContainerOutput

| JSON representation |
|---|
| ``` { "image": string, "command": [ string ], "args": [ string ], "env": [ { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.EnvVar`) } ], "ports": [ { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.ContainerPort`) } ], "baseImageUri": string, "sourceCode": { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.SourceCode`) } } ``` |

| Fields ||
|---|---|
| `image` | `string` Name of the container image in Dockerhub, Google Artifact Registry, or Google Container Registry. If the host is not provided, Dockerhub is assumed. |
| `command[]` | `string` Entrypoint array. Not executed within a shell. |
| `args[]` | `string` Arguments to the entrypoint. |
| `env[]` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.EnvVar`)`` List of environment variables to set in the container. |
| `ports[]` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.ContainerPort`)`` List of ports exposed from the container. |
| `baseImageUri` | `string` Base image for this container. Only supported for services. If set, it indicates that the service is enrolled into automatic base image update. |
| `sourceCode` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.SourceCode`)`` The location of the source code from which this container was built. |

### EnvVar

| JSON representation |
|---|
| ``` { "name": string, // Union field `values` can be only one of the following: "value": string, "valueSource": { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.EnvVarSource`) } // End of list of possible types for union field `values`. } ``` |

| Fields ||
|---|---|
| `name` | `string` Required. Name of the environment variable. Must not exceed 32768 characters. |
| Union field `values`. `values` can be only one of the following: ||
| `value` | `string` Literal value of the environment variable. Defaults to "", and the maximum length is 32768 bytes. Variable references are not supported in Cloud Run. |
| `valueSource` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.EnvVarSource`)`` Source for the environment variable's value. |

### EnvVarSource

| JSON representation |
|---|
| ``` { "secretKeyRef": { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.SecretKeySelector`) } } ``` |

| Fields ||
|---|---|
| `secretKeyRef` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.SecretKeySelector`)`` Selects a secret and a specific version from Cloud Secret Manager. |

### SecretKeySelector

| JSON representation |
|---|
| ``` { "secret": string, "version": string } ``` |

| Fields ||
|---|---|
| `secret` | `string` Required. The name of the secret in Cloud Secret Manager. Format: {secret_name} if the secret is in the same project. projects/{project}/secrets/{secret_name} if the secret is in a different project. |
| `version` | `string` The Cloud Secret Manager secret version. Can be 'latest' for the latest version, an integer for a specific version, or a version alias. |

### ContainerPort

| JSON representation |
|---|
| ``` { "name": string, "containerPort": integer } ``` |

| Fields ||
|---|---|
| `name` | `string` If specified, used to specify which protocol to use. Allowed values are "http1" and "h2c". |
| `containerPort` | `integer` Port number the container listens on. This must be a valid TCP port number, 0 \< container_port \< 65536. |

### SourceCode

| JSON representation |
|---|
| ``` { // Union field `source_type` can be only one of the following: "cloudStorageSource": { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.CloudStorageSource`) }, "inlinedSource": { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.InlinedSource`) } // End of list of possible types for union field `source_type`. } ``` |

| Fields ||
|---|---|
| Union field `source_type`. The source type. `source_type` can be only one of the following: ||
| `cloudStorageSource` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.CloudStorageSource`)`` The source is a Cloud Storage bucket. |
| `inlinedSource` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.InlinedSource`)`` Optional. Input only. Source code inlined in the request. Cloud Run will store the inlined_source to Cloud Storage and replace the field with cloud_storage_source. |

### CloudStorageSource

| JSON representation |
|---|
| ``` { "bucket": string, "object": string, "generation": string } ``` |

| Fields ||
|---|---|
| `bucket` | `string` Required. The Cloud Storage bucket name. |
| `object` | `string` Required. The Cloud Storage object name. |
| `generation` | `string (https://developers.google.com/discovery/v1/type-format format)` Optional. The Cloud Storage object generation. |

### InlinedSource

| JSON representation |
|---|
| ``` { "sources": [ { object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.SourceFile`) } ] } ``` |

| Fields ||
|---|---|
| `sources[]` | ``object (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.SourceFile`)`` Required. Input only. The source code. |

### SourceFile

| JSON representation |
|---|
| ``` { "filename": string, "content": string } ``` |

| Fields ||
|---|---|
| `filename` | `string` Required. Input only. The file name for the source code. e.g., `"index.js"` or `"node_modules/dependency.js"`. The filename must be less than 255 characters and cannot contain `..`, `./`, `//`, or end with a `/`. Cloud Run will place the files in the container subdirectories, please use relative path to access the file. |
| `content` | `string` Required. Input only. Represents the exact, literal, and complete source code of the file. Placeholders like `...` or comments such as `# [rest of code]` should NEVER be used as omission. Every character in this field will be built into the final container. Any omission will result in a broken application. |

### Timestamp

| JSON representation |
|---|
| ``` { "seconds": string, "nanos": integer } ``` |

| Fields ||
|---|---|
| `seconds` | `string (https://developers.google.com/discovery/v1/type-format format)` 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` | `integer` 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. |

### Condition

| JSON representation |
|---|
| ``` { "type": string, "state": enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.State`), "message": string, "lastTransitionTime": string, "severity": enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.Severity`), // Union field `reasons` can be only one of the following: "reason": enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.CommonReason`), "revisionReason": enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.RevisionReason`), "executionReason": enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.ExecutionReason`), "instanceReason": enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.InstanceReason`) // End of list of possible types for union field `reasons`. } ``` |

| Fields ||
|---|---|
| `type` | `string` type is used to communicate the status of the reconciliation process. See also: <https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting> Types common to all resources include: \* "Ready": True when the Resource is ready. |
| `state` | ``enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.State`)`` State of the condition. |
| `message` | `string` Human readable message indicating details about the current status. |
| `lastTransitionTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Last time the condition transitioned from one status to another. 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: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `severity` | ``enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.Severity`)`` How to interpret failures of this condition, one of Error, Warning, Info |
| Union field `reasons`. The reason for this condition. Depending on the condition type, it will populate one of these fields. Successful conditions cannot have a reason. `reasons` can be only one of the following: ||
| `reason` | ``enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.CommonReason`)`` Output only. A common (service-level) reason for this condition. |
| `revisionReason` | ``enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.RevisionReason`)`` Output only. A reason for the revision condition. |
| `executionReason` | ``enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.ExecutionReason`)`` Output only. A reason for the execution condition. |
| `instanceReason` | ``enum (`https://docs.cloud.google.com/run/docs/reference/mcp/tools_list/get_service#Output.Schema.InstanceReason`)`` Output only. A reason for the instance condition. |

### State

Represents the possible Condition states.

| Enums ||
|---|---|
| `STATE_UNSPECIFIED` | The default value. This value is used if the state is omitted. |
| `CONDITION_PENDING` | Transient state: Reconciliation has not started yet. |
| `CONDITION_RECONCILING` | Transient state: reconciliation is still in progress. |
| `CONDITION_FAILED` | Terminal state: Reconciliation did not succeed. |
| `CONDITION_SUCCEEDED` | Terminal state: Reconciliation completed successfully. |

### Severity

Represents the severity of the condition failures.

| Enums ||
|---|---|
| `SEVERITY_UNSPECIFIED` | Unspecified severity |
| `ERROR` | Error severity. |
| `WARNING` | Warning severity. |
| `INFO` | Info severity. |

### CommonReason

Reasons common to all types of conditions.

| Enums ||
|---|---|
| `COMMON_REASON_UNDEFINED` | Default value. |
| `UNKNOWN` | Reason unknown. Further details will be in message. |
| `REVISION_FAILED` | Revision creation process failed. |
| `PROGRESS_DEADLINE_EXCEEDED` | Timed out waiting for completion. |
| `CONTAINER_MISSING` | The container image path is incorrect. |
| `CONTAINER_PERMISSION_DENIED` | Insufficient permissions on the container image. |
| `CONTAINER_IMAGE_UNAUTHORIZED` | Container image is not authorized by policy. |
| `CONTAINER_IMAGE_AUTHORIZATION_CHECK_FAILED` | Container image policy authorization check failed. |
| `ENCRYPTION_KEY_PERMISSION_DENIED` | Insufficient permissions on encryption key. |
| `ENCRYPTION_KEY_CHECK_FAILED` | Permission check on encryption key failed. |
| `SECRETS_ACCESS_CHECK_FAILED` | At least one Access check on secrets failed. |
| `WAITING_FOR_OPERATION` | Waiting for operation to complete. |
| `IMMEDIATE_RETRY` | System will retry immediately. |
| `POSTPONED_RETRY` | System will retry later; current attempt failed. |
| `INTERNAL` | An internal error occurred. Further information may be in the message. |
| `VPC_NETWORK_NOT_FOUND` | User-provided VPC network was not found. |

### RevisionReason

Reasons specific to Revision resource.

| Enums ||
|---|---|
| `REVISION_REASON_UNDEFINED` | Default value. |
| `PENDING` | Revision in Pending state. |
| `RESERVE` | Revision is in Reserve state. |
| `RETIRED` | Revision is Retired. |
| `RETIRING` | Revision is being retired. |
| `RECREATING` | Revision is being recreated. |
| `HEALTH_CHECK_CONTAINER_ERROR` | There was a health check error. |
| `CUSTOMIZED_PATH_RESPONSE_PENDING` | Health check failed due to user error from customized path of the container. System will retry. |
| `MIN_INSTANCES_NOT_PROVISIONED` | A revision with min_instance_count \> 0 was created and is reserved, but it was not configured to serve traffic, so it's not live. This can also happen momentarily during traffic migration. |
| `ACTIVE_REVISION_LIMIT_REACHED` | The maximum allowed number of active revisions has been reached. |
| `NO_DEPLOYMENT` | There was no deployment defined. This value is no longer used, but Services created in older versions of the API might contain this value. |
| `HEALTH_CHECK_SKIPPED` | A revision's container has no port specified since the revision is of a manually scaled service with 0 instance count |
| `MIN_INSTANCES_WARMING` | A revision with min_instance_count \> 0 was created and is waiting for enough instances to begin a traffic migration. |

### ExecutionReason

Reasons specific to Execution resource.

| Enums ||
|---|---|
| `EXECUTION_REASON_UNDEFINED` | Default value. |
| `JOB_STATUS_SERVICE_POLLING_ERROR` | Internal system error getting execution status. System will retry. |
| `NON_ZERO_EXIT_CODE` | A task reached its retry limit and the last attempt failed due to the user container exiting with a non-zero exit code. |
| `CANCELLED` | The execution was cancelled by users. |
| `CANCELLING` | The execution is in the process of being cancelled. |
| `DELETED` | The execution was deleted. |
| `DELAYED_START_PENDING` | A delayed execution is waiting for a start time. |

### InstanceReason

Reasons specific to Instance resource.

| Enums ||
|---|---|
| `INSTANCE_REASON_UNSPECIFIED` | Default value. |
| `INSTANCE_DELETED` | Instance deleted. |
| `INSTANCE_STOPPED` | Instance stopped. |
| `INSTANCE_STOPPING` | Instance stopping. |
| `INSTANCE_NON_ZERO_EXIT_CODE` | Instance exited with a non-zero exit code. |

### Tool Annotations

Destructive Hint: ❌ \| Idempotent Hint: ❌ \| Read Only Hint: ✅ \| Open World Hint: ❌