Skip to main content
Glama
mohalmah

Google Apps Script MCP Server

by mohalmah

script_projects_deployments_update

Update a Google Apps Script deployment by modifying its manifest, version, or description to reflect changes in your script project.

Instructions

Updates a deployment of an Apps Script project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptIdYesThe ID of the script to update.
deploymentIdYesThe ID of the deployment to update.
deploymentConfigYes

Implementation Reference

  • Main handler function that executes the deployment update via Google Apps Script API using fetch PUT request with error handling and logging.
    const executeFunction = async ({ scriptId, deploymentId, deploymentConfig }) => {
      const baseUrl = 'https://script.googleapis.com';
      const token = process.env.GOOGLE_APP_SCRIPT_API_API_KEY;
      const apiKey = process.env.GOOGLE_APP_SCRIPT_API_API_KEY;
      const startTime = Date.now();
    
      try {
        logger.info('DEPLOYMENT_UPDATE', 'Starting deployment update', { 
          scriptId, 
          deploymentId, 
          versionNumber: deploymentConfig?.versionNumber 
        });
    
        // Construct the URL for the request
        const url = `${baseUrl}/v1/projects/${scriptId}/deployments/${deploymentId}?key=${apiKey}&prettyPrint=true`;
    
        // Set up headers for the request
        const headers = {
          'Content-Type': 'application/json',
          'Accept': 'application/json',
          'Authorization': `Bearer ${token}`
        };
    
        // Prepare the body of the request
        const requestBody = { deploymentConfig };
        const body = JSON.stringify(requestBody);
    
        logger.logAPICall('PUT', url, headers, requestBody);
    
        // Perform the fetch request
        const fetchStartTime = Date.now();
        const response = await fetch(url, {
          method: 'PUT',
          headers,
          body
        });
        
        const fetchDuration = Date.now() - fetchStartTime;
        const responseSize = response.headers.get('content-length') || 'unknown';
        
        logger.logAPIResponse('PUT', url, response.status, fetchDuration, responseSize);
    
        // Check if the response was successful
        if (!response.ok) {
          const errorText = await response.text();
          let errorData;
          
          try {
            errorData = JSON.parse(errorText);
          } catch (parseError) {
            errorData = { message: errorText };
          }
    
          const detailedError = {
            status: response.status,
            statusText: response.statusText,
            url,
            errorResponse: errorData,
            duration: Date.now() - startTime,
            scriptId,
            deploymentId,
            timestamp: new Date().toISOString()
          };
    
          logger.error('DEPLOYMENT_UPDATE', 'API request failed', detailedError);
          
          console.error('❌ API Error Details:', JSON.stringify(detailedError, null, 2));
          
          throw new Error(`API Error (${response.status}): ${errorData.error?.message || errorData.message || 'Unknown error'}`);
        }
    
        // Parse and return the response data
        const data = await response.json();
        
        logger.info('DEPLOYMENT_UPDATE', 'Successfully updated deployment', {
          scriptId,
          deploymentId,
          duration: Date.now() - startTime
        });
        
        console.log('✅ Successfully updated deployment');
        return data;
      } catch (error) {
        const errorDetails = {
          message: error.message,
          stack: error.stack,
          scriptId,
          deploymentId,
          duration: Date.now() - startTime,
          timestamp: new Date().toISOString(),
          errorType: error.name || 'Unknown'
        };
    
        logger.error('DEPLOYMENT_UPDATE', 'Error updating deployment', errorDetails);
        
        console.error('❌ Error updating deployment:', errorDetails);
        
        // Return detailed error information for debugging
        return { 
          error: true,
          message: error.message,
          details: errorDetails,
          rawError: {
            name: error.name,
            stack: error.stack
          }
        };
      }
    };
  • JSON schema defining the tool's name, description, input parameters (scriptId, deploymentId, deploymentConfig with subproperties), and required fields.
      function: {
        name: 'script_projects_deployments_update',
        description: 'Updates a deployment of an Apps Script project.',
        parameters: {
          type: 'object',
          properties: {
            scriptId: {
              type: 'string',
              description: 'The ID of the script to update.'
            },
            deploymentId: {
              type: 'string',
              description: 'The ID of the deployment to update.'
            },
            deploymentConfig: {
              type: 'object',
              properties: {
                manifestFileName: {
                  type: 'string',
                  description: 'The name of the manifest file.'
                },
                versionNumber: {
                  type: 'integer',
                  description: 'The version number of the deployment.'
                },
                description: {
                  type: 'string',
                  description: 'A description of the deployment.'
                }
              },
              required: ['manifestFileName', 'versionNumber', 'description']
            }
          },
          required: ['scriptId', 'deploymentId', 'deploymentConfig']
        }
      }
    }
  • tools/paths.js:6-6 (registration)
    The tool file path is listed in the central paths export, likely used for dynamic registration or loading of tools.
    'google-app-script-api/apps-script-api/script-projects-deployments-update.js',
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks behavioral details. It states 'Updates' implying mutation, but doesn't disclose permissions needed, whether changes are reversible, rate limits, or what the response looks like (no output schema). This is inadequate for a mutation tool with zero annotation coverage.

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 with zero waste, front-loading the core action and resource. It's appropriately sized for the tool's complexity, making it easy to parse quickly.

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?

Given a mutation tool with no annotations, 67% schema coverage, no output schema, and nested objects, the description is incomplete. It doesn't address behavioral aspects (e.g., side effects, error handling) or provide usage context, leaving significant gaps for an AI agent to understand how to invoke it correctly.

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?

Schema description coverage is 67% (2 of 3 top-level parameters have descriptions), and the description adds no parameter semantics beyond the schema. It doesn't explain what 'deploymentConfig' entails or provide context for the parameters. With moderate schema coverage, the baseline is 3 as the description doesn't compensate for gaps.

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 action ('Updates') and resource ('a deployment of an Apps Script project'), making the purpose evident. It distinguishes from siblings like 'script_projects_deployments_create' (create) and 'script_projects_deployments_delete' (delete), though it doesn't explicitly differentiate from 'update_script_content' which updates content rather than deployments.

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. It doesn't mention prerequisites (e.g., existing deployment), exclusions, or compare to siblings like 'script_projects_deployments_create' for new deployments or 'update_script_content' for content updates, leaving usage context unclear.

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/mohalmah/google-appscript-mcp-server'

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