Skip to main content
Glama

list_gcp_services

Retrieve a list of enabled services and APIs in a specified Google Cloud Platform (GCP) project by providing the project ID, simplifying resource management and visibility.

Instructions

    List enabled services/APIs in a GCP project.
    
    Args:
        project_id: The ID of the GCP project to list services for
    
    Returns:
        List of enabled services in the specified GCP project
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • The handler function for the 'list_gcp_services' MCP tool. It lists enabled GCP services/APIs in a project using the ServiceUsageClient. Includes @mcp.tool() decorator for registration and input/output schema in docstring.
        @mcp.tool()
        def list_gcp_services(project_id: str) -> str:
            """
            List enabled services/APIs in a GCP project.
            
            Args:
                project_id: The ID of the GCP project to list services for
            
            Returns:
                List of enabled services in the specified GCP project
            """
            try:
                try:
                    from google.cloud import service_usage
                except ImportError:
                    return "Error: The Google Cloud service usage library is not installed. Please install it with 'pip install google-cloud-service-usage'."
                
                # Initialize the Service Usage client
                client = service_usage.ServiceUsageClient()
                
                # Create the request
                request = service_usage.ListServicesRequest(
                    parent=f"projects/{project_id}",
                    filter="state:ENABLED"
                )
                
                # List enabled services
                services = client.list_services(request=request)
                
                # Format the response
                services_list = []
                for service in services:
                    name = service.name.split('/')[-1] if service.name else "Unknown"
                    title = service.config.title if service.config else "Unknown"
                    services_list.append(f"- {name}: {title}")
                
                if not services_list:
                    return f"No services are enabled in project {project_id}."
                
                services_str = "\n".join(services_list)
                
                return f"""
    Enabled Services in GCP Project {project_id}:
    {services_str}
    """
            except Exception as e:
                return f"Error listing GCP services: {str(e)}"
  • The @mcp.tool() decorator registers the list_gcp_services function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the action but doesn't disclose behavioral traits such as required permissions, rate limits, pagination, or error handling. For a read operation in GCP with no annotation coverage, this is a significant gap.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose, followed by structured Args and Returns sections. Every sentence earns its place, though the formatting could be slightly more streamlined.

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

Completeness3/5

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

Given no annotations, no output schema, and low complexity, the description is minimally adequate but incomplete. It covers the basic purpose and parameter semantics but lacks behavioral details and usage guidelines, which are needed for a tool in a complex environment like GCP.

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?

The description adds meaning beyond the input schema by explaining that 'project_id' is for 'the ID of the GCP project to list services for'. With 0% schema description coverage and only 1 parameter, this adequately compensates, providing clear semantics for the single required input.

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 ('List') and resource ('enabled services/APIs in a GCP project'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_gcp_projects' or 'list_assets', which reduces clarity in a crowded namespace.

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?

No guidance is provided on when to use this tool versus alternatives. With many sibling tools (e.g., 'list_gcp_projects', 'list_assets'), the description lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage.

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/henihaddad/gcp-mcp'

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