Skip to main content
Glama

set_quota_project

Assign a specific GCP project to attribute API request quotas, resolving warnings about end user credentials used without a quota project.

Instructions

    Set a quota project for Google Cloud API requests.
    
    This helps resolve the warning: "Your application has authenticated using end user credentials 
    from Google Cloud SDK without a quota project."
    
    Args:
        project_id: The ID of the GCP project to use for quota attribution
    
    Returns:
        Confirmation message if successful, error message otherwise
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes

Implementation Reference

  • The main execution logic for the set_quota_project tool. Sets GOOGLE_CLOUD_QUOTA_PROJECT environment variable and attempts to update default credentials with quota project.
    @mcp.tool()
    def set_quota_project(project_id: str) -> str:
        """
        Set a quota project for Google Cloud API requests.
        
        This helps resolve the warning: "Your application has authenticated using end user credentials 
        from Google Cloud SDK without a quota project."
        
        Args:
            project_id: The ID of the GCP project to use for quota attribution
        
        Returns:
            Confirmation message if successful, error message otherwise
        """
        try:
            try:
                import google.auth
                from google.auth import exceptions
                import os
            except ImportError:
                return "Error: Required libraries not installed. Please install with 'pip install google-auth'."
            
            # Set the quota project in the environment variable
            os.environ["GOOGLE_CLOUD_QUOTA_PROJECT"] = project_id
            
            # Try to get credentials with the quota project
            try:
                # Get the current credentials
                credentials, project = google.auth.default()
                
                # Set the quota project on the credentials if supported
                if hasattr(credentials, "with_quota_project"):
                    credentials = credentials.with_quota_project(project_id)
                    
                    # Save the credentials back (this depends on the credential type)
                    # This is a best-effort approach
                    try:
                        if hasattr(google.auth, "_default_credentials"):
                            google.auth._default_credentials = credentials
                    except:
                        pass
                    
                    return f"Successfully set quota project to '{project_id}'. New API requests will use this project for quota attribution."
                else:
                    return f"Set environment variable GOOGLE_CLOUD_QUOTA_PROJECT={project_id}, but your credential type doesn't support quota projects directly."
            except exceptions.GoogleAuthError as e:
                return f"Error setting quota project: {str(e)}"
        except Exception as e:
            return f"Error setting quota project: {str(e)}"
  • Registration of the resource management tools module, which includes the set_quota_project tool, via calling its register_tools function.
    # Register resource management tools
    resource_tools.register_tools(mcp)
Behavior3/5

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

With no annotations provided, the description carries the full burden. It implies a write/mutation operation ('Set'), mentions authentication context, and describes success/error outcomes. However, it lacks details about permissions required, whether changes are persistent, side effects, or rate limits. The behavioral disclosure is adequate but not comprehensive for a mutation tool.

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 and front-loaded: purpose statement first, followed by usage context, then parameter and return details. Every sentence earns its place with no redundancy. The four-sentence format efficiently covers all necessary aspects without waste.

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

Completeness4/5

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

For a single-parameter mutation tool with no annotations and no output schema, the description provides good coverage: clear purpose, usage context, parameter explanation, and return value description. It could be more complete by mentioning authentication prerequisites or persistence of changes, but it addresses the core needs adequately.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must fully compensate. It provides a clear 'Args' section explaining 'project_id' as 'The ID of the GCP project to use for quota attribution,' which adds essential semantic meaning beyond the schema's basic type information. This fully addresses the single parameter's purpose.

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 tool's purpose: 'Set a quota project for Google Cloud API requests.' It specifies the verb ('Set') and resource ('quota project'), and distinguishes it from siblings by addressing a specific authentication warning scenario. However, it doesn't explicitly differentiate from similar configuration tools like 'config_set_project'.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool: to resolve the specific warning about 'end user credentials from Google Cloud SDK without a quota project.' This gives practical guidance. However, it doesn't mention when NOT to use it or explicitly compare it to alternatives like 'config_set_project' for general project configuration.

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