Skip to main content
Glama

get_service

Retrieve detailed information about a specific Cloud Run service, including project ID, region, and service name, to manage and monitor deployments effectively.

Instructions

Gets details for a specific Cloud Run service.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesGoogle Cloud project ID containing the service
regionNoRegion where the service is locatedeurope-west1
serviceYesName of the Cloud Run service

Implementation Reference

  • registerGetServiceTool: registers the MCP 'get_service' tool, defines its input schema, and provides the handler logic that validates parameters and retrieves service details via getService helper.
    function registerGetServiceTool(server, options) {
      server.registerTool(
        'get_service',
        {
          description: 'Gets details for a specific Cloud Run service.',
          inputSchema: {
            project: z
              .string()
              .describe('Google Cloud project ID containing the service')
              .default(options.defaultProjectId),
            region: z
              .string()
              .describe('Region where the service is located')
              .default(options.defaultRegion),
            service: z
              .string()
              .describe('Name of the Cloud Run service')
              .default(options.defaultServiceName),
          },
        },
        gcpTool(
          options.gcpCredentialsAvailable,
          async ({ project, region, service }) => {
            if (typeof project !== 'string') {
              return {
                content: [
                  { type: 'text', text: 'Error: Project ID must be provided.' },
                ],
              };
            }
            if (typeof service !== 'string') {
              return {
                content: [
                  { type: 'text', text: 'Error: Service name must be provided.' },
                ],
              };
            }
            try {
              const serviceDetails = await getService(project, region, service);
              if (serviceDetails) {
                return {
                  content: [
                    {
                      type: 'text',
                      text: `Name: ${service}\nRegion: ${region}\nProject: ${project}\nURL: ${serviceDetails.uri}\nLast deployed by: ${serviceDetails.lastModifier}`,
                    },
                  ],
                };
              } else {
                return {
                  content: [
                    {
                      type: 'text',
                      text: `Service ${service} not found in project ${project} (region ${region}).`,
                    },
                  ],
                };
              }
            } catch (error) {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Error getting service ${service} in project ${project} (region ${region}): ${error.message}`,
                  },
                ],
              };
            }
          }
        )
      );
    }
  • getService helper function: core implementation that uses Google Cloud Run ServicesClient to fetch service details by path, handles not-found gracefully.
    export async function getService(projectId, location, serviceId) {
      if (!runClient) {
        const { v2 } = await import('@google-cloud/run');
        const { ServicesClient } = v2;
        runClient = new ServicesClient({ projectId });
      }
    
      const servicePath = runClient.servicePath(projectId, location, serviceId);
    
      try {
        console.log(
          `Getting details for Cloud Run service ${serviceId} in project ${projectId}, location ${location}...`
        );
        const [service] = await callWithRetry(
          () => runClient.getService({ name: servicePath }),
          'getService'
        );
        return service;
      } catch (error) {
        console.error(
          `Error getting details for Cloud Run service ${serviceId}:`,
          error
        );
        // Check if the error is a "not found" error (gRPC code 5)
        if (error.code === 5) {
          console.log(`Cloud Run service ${serviceId} not found.`);
          return null; // Or throw a custom error, or handle as needed
        }
        throw error; // Re-throw other errors
      }
    }
  • tools/tools.js:34-34 (registration)
    Calls registerGetServiceTool to register the 'get_service' tool on the MCP server.
    registerGetServiceTool(server, options);
  • Zod input schema definition for 'get_service' tool parameters: project, region, service.
    inputSchema: {
      project: z
        .string()
        .describe('Google Cloud project ID containing the service')
        .default(options.defaultProjectId),
      region: z
        .string()
        .describe('Region where the service is located')
        .default(options.defaultRegion),
      service: z
        .string()
        .describe('Name of the Cloud Run service')
        .default(options.defaultServiceName),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a read operation ('Gets'), but doesn't mention authentication requirements, rate limits, error conditions, or what the output format looks like. For a tool with no annotation coverage, this leaves significant gaps in understanding how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states exactly what the tool does without any wasted words. It's appropriately sized for a simple retrieval tool and front-loads the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'details' are returned, what format they come in, or any behavioral aspects like error handling. Given the complexity of Cloud Run services and the lack of structured output documentation, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the schema itself. The description doesn't add any additional parameter semantics beyond what's already in the schema descriptions. This meets the baseline expectation when schema coverage is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Gets') and resource ('details for a specific Cloud Run service'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'list_services' or 'get_service_log', which would require explicit comparison to achieve a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_services' (for listing all services) or 'get_service_log' (for logs). It also doesn't mention prerequisites or contextual constraints, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GoogleCloudPlatform/cloud-run-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server