Skip to main content
Glama
longngo192

Google Cloud Docs MCP Server

by longngo192

get_api_reference

Retrieve REST API documentation for Google Cloud services to access endpoints, methods, and parameters for integration development.

Instructions

Get REST API reference documentation for a specific Google Cloud service.

WHEN TO USE: Use this tool when:

  • User needs API endpoints, methods, or parameters

  • User is developing integrations with GCP APIs

  • User asks about REST API for a specific GCP service

  • User needs to know available API resources for a service

INPUT:

  • service (required): GCP service name (compute, storage, bigquery, pubsub, sql, kubernetes, functions, run, iam)

  • resource (optional): Specific API resource (instances, buckets, datasets, topics, etc.)

SUPPORTED SERVICES & RESOURCES:

  • compute: instances, disks, networks, firewalls, images, machineTypes

  • storage: buckets, objects, notifications

  • bigquery: datasets, tables, jobs, routines

  • pubsub: topics, subscriptions, snapshots

  • sql: instances, databases, users, backupRuns

  • kubernetes: clusters, nodePools, operations

  • functions: functions, operations, locations

  • run: services, configurations, routes, revisions

  • iam: roles, serviceAccounts, policies

OUTPUT: Returns JSON with:

  • service: Service name

  • description: Service description

  • apiReferenceUrl: Full URL to API reference

  • availableResources: List of available resources for this service

  • documentation: Actual API documentation content (if available)

EXAMPLE USAGE:

  • Get Compute Engine API overview: service="compute"

  • Get Storage buckets API: service="storage", resource="buckets"

  • Get BigQuery datasets API: service="bigquery", resource="datasets"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serviceYesThe Google Cloud service name (e.g., 'compute', 'storage', 'bigquery', 'pubsub', 'sql', 'kubernetes', 'functions', 'run', 'iam')
resourceNoOptional: Specific API resource (e.g., 'instances', 'buckets', 'datasets', 'topics')

Implementation Reference

  • The handler function that executes the get_api_reference tool. It maps services to API reference paths, fetches documentation using fetchGoogleCloudDoc, and returns structured JSON with API details, resources, and content.
    async function getApiReference(
      service: string,
      resource?: string
    ): Promise<string> {
      const serviceLower = service.toLowerCase();
      const product = GOOGLE_CLOUD_PRODUCTS[serviceLower];
    
      if (!product) {
        return JSON.stringify({
          error: `Unknown service: ${service}`,
          availableServices: Object.keys(GOOGLE_CLOUD_PRODUCTS),
          suggestion:
            'Use "list_google_cloud_products" to see all available services.',
        });
      }
    
      // API reference paths for common services
      const apiPaths: Record<string, { rest: string; resources: string[] }> = {
        compute: {
          rest: "compute/docs/reference/rest/v1",
          resources: [
            "instances",
            "disks",
            "networks",
            "firewalls",
            "images",
            "machineTypes",
          ],
        },
        storage: {
          rest: "storage/docs/json_api/v1",
          resources: ["buckets", "objects", "notifications"],
        },
        bigquery: {
          rest: "bigquery/docs/reference/rest",
          resources: ["datasets", "tables", "jobs", "routines"],
        },
        pubsub: {
          rest: "pubsub/docs/reference/rest",
          resources: ["topics", "subscriptions", "snapshots"],
        },
        sql: {
          rest: "sql/docs/mysql/admin-api/rest/v1",
          resources: ["instances", "databases", "users", "backupRuns"],
        },
        kubernetes: {
          rest: "kubernetes-engine/docs/reference/rest",
          resources: ["clusters", "nodePools", "operations"],
        },
        functions: {
          rest: "functions/docs/reference/rest/v2",
          resources: ["functions", "operations", "locations"],
        },
        run: {
          rest: "run/docs/reference/rest",
          resources: ["services", "configurations", "routes", "revisions"],
        },
        iam: {
          rest: "iam/docs/reference/rest",
          resources: ["roles", "serviceAccounts", "policies"],
        },
      };
    
      const apiInfo = apiPaths[serviceLower];
    
      if (!apiInfo) {
        return JSON.stringify({
          service: product.name,
          docsUrl: `https://cloud.google.com/${product.docsPath}`,
          apiReference: `https://cloud.google.com/${product.docsPath}/reference`,
          note: "API reference path not pre-configured. Try fetching the docs URL directly.",
        });
      }
    
      const apiUrl = resource
        ? `https://cloud.google.com/${apiInfo.rest}/${resource}`
        : `https://cloud.google.com/${apiInfo.rest}`;
    
      // Fetch the actual API reference page
      try {
        const docContent = await fetchGoogleCloudDoc(apiInfo.rest);
        const parsedContent = JSON.parse(docContent);
    
        return JSON.stringify({
          service: product.name,
          description: product.description,
          apiReferenceUrl: apiUrl,
          availableResources: apiInfo.resources,
          selectedResource: resource || "overview",
          documentation: parsedContent,
          usage: resource
            ? `Viewing API reference for ${resource}`
            : `Use "get_api_reference" with a resource parameter to get specific resource documentation. Available: ${apiInfo.resources.join(", ")}`,
        });
      } catch {
        return JSON.stringify({
          service: product.name,
          description: product.description,
          apiReferenceUrl: apiUrl,
          availableResources: apiInfo.resources,
          selectedResource: resource || "overview",
          fetchCommand: `Use fetch_google_cloud_doc with path: "${resource ? `${apiInfo.rest}/${resource}` : apiInfo.rest}"`,
        });
      }
    }
  • The tool registration including name, detailed description, and input schema definition (service required, resource optional) used by the MCP server for listing and validating tool calls.
        name: "get_api_reference",
        description: `Get REST API reference documentation for a specific Google Cloud service.
    
    **WHEN TO USE**: Use this tool when:
    - User needs API endpoints, methods, or parameters
    - User is developing integrations with GCP APIs
    - User asks about REST API for a specific GCP service
    - User needs to know available API resources for a service
    
    **INPUT**:
    - service (required): GCP service name (compute, storage, bigquery, pubsub, sql, kubernetes, functions, run, iam)
    - resource (optional): Specific API resource (instances, buckets, datasets, topics, etc.)
    
    **SUPPORTED SERVICES & RESOURCES**:
    - compute: instances, disks, networks, firewalls, images, machineTypes
    - storage: buckets, objects, notifications
    - bigquery: datasets, tables, jobs, routines
    - pubsub: topics, subscriptions, snapshots
    - sql: instances, databases, users, backupRuns
    - kubernetes: clusters, nodePools, operations
    - functions: functions, operations, locations
    - run: services, configurations, routes, revisions
    - iam: roles, serviceAccounts, policies
    
    **OUTPUT**: Returns JSON with:
    - service: Service name
    - description: Service description
    - apiReferenceUrl: Full URL to API reference
    - availableResources: List of available resources for this service
    - documentation: Actual API documentation content (if available)
    
    **EXAMPLE USAGE**:
    - Get Compute Engine API overview: service="compute"
    - Get Storage buckets API: service="storage", resource="buckets"
    - Get BigQuery datasets API: service="bigquery", resource="datasets"`,
        inputSchema: {
          type: "object" as const,
          properties: {
            service: {
              type: "string",
              description:
                "The Google Cloud service name (e.g., 'compute', 'storage', 'bigquery', 'pubsub', 'sql', 'kubernetes', 'functions', 'run', 'iam')",
            },
            resource: {
              type: "string",
              description:
                "Optional: Specific API resource (e.g., 'instances', 'buckets', 'datasets', 'topics')",
            },
          },
          required: ["service"],
        },
      },
  • src/index.ts:1065-1074 (registration)
    The switch case that handles incoming 'get_api_reference' tool calls, extracts parameters, invokes the handler, and returns the result as MCP content.
    case "get_api_reference": {
      const { service, resource } = args as {
        service: string;
        resource?: string;
      };
      const result = await getApiReference(service, resource);
      return {
        content: [{ type: "text", text: result }],
      };
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes what the tool returns (JSON with specific fields), provides examples of supported services and resources, and includes example usage patterns. It doesn't mention rate limits, authentication requirements, or error handling, but provides substantial behavioral context.

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 well-structured with clear sections (purpose, when to use, input, supported services, output, examples). Every sentence adds value, and the information is front-loaded with the core purpose followed by practical guidance. No wasted words or redundant information.

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

Completeness5/5

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

For a tool with 2 parameters, 100% schema coverage, and no output schema, the description provides complete context. It explains what the tool does, when to use it, detailed parameter semantics, supported values, output structure, and example usage. This is comprehensive given the tool's complexity and available structured data.

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

Parameters4/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds significant value by providing a comprehensive list of supported services and resources for each service, which goes beyond the schema's generic descriptions. It also clarifies the relationship between service and resource parameters through examples.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verb ('Get') and resource ('REST API reference documentation for a specific Google Cloud service'). It distinguishes from sibling tools by focusing specifically on API reference documentation rather than general documentation, product listings, or search.

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

Usage Guidelines5/5

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

The description includes an explicit 'WHEN TO USE' section with four specific scenarios for using this tool, providing clear guidance about when it's appropriate. It differentiates from siblings by focusing on API endpoints, methods, and parameters rather than general documentation needs.

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

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/longngo192/gcpdoc-mcp'

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