Skip to main content
Glama
mohalmah

Google Apps Script MCP Server

by mohalmah

script_projects_deployments_delete

Remove a deployment from a Google Apps Script project by specifying the script and deployment IDs to manage project versions and clean up unused deployments.

Instructions

Delete a deployment of an Apps Script project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptIdYesThe ID of the script project.
deploymentIdYesThe ID of the deployment to delete.

Implementation Reference

  • The main handler function 'executeFunction' that performs the DELETE API call to delete the specified deployment of the Apps Script project, including error handling and logging.
    const executeFunction = async ({ scriptId, deploymentId }) => {
      const baseUrl = 'https://script.googleapis.com';
      const accessToken = ''; // will be provided by the user
      try {
        // Construct the URL for the DELETE request
        const url = `${baseUrl}/v1/projects/${scriptId}/deployments/${deploymentId}?fields=occaecat dolor eu&alt=json&$.xgafv=1&upload_protocol=occaecat dolor eu&uploadType=occaecat dolor eu"aUser=occaecat dolor eu&callback=occaecat dolor eu&prettyPrint=true`;
    
        // Set up headers for the request
        const headers = {
          'Authorization': `Bearer ${accessToken}`,
          'Accept': 'application/json'
        };
    
        // Perform the fetch request
        const response = await fetch(url, {
          method: 'DELETE',
          headers
        });
    
        // Check if the response was successful
        if (!response.ok) {
          const errorData = await response.json();
          throw new Error(errorData);
        }
    
        // Parse and return the response data
        const data = await response.json();
        return data;
      } catch (error) {
        const errorDetails = {
          message: error.message,
          stack: error.stack,
          scriptId,
          deploymentId,
          timestamp: new Date().toISOString(),
          errorType: error.name || 'Unknown'
        };
    
        logger.error('DEPLOYMENT_DELETE', 'Error deleting deployment', errorDetails);
        
        console.error('❌ Error deleting deployment:', errorDetails);
        
        // Return detailed error information for debugging
        return { 
          error: true,
          message: error.message,
          details: errorDetails,
          rawError: {
            name: error.name,
            stack: error.stack
          }
        };
      }
    };
  • The tool schema definition including name, description, input parameters (scriptId and deploymentId), and required fields.
    definition: {
      type: 'function',
      function: {
        name: 'script_projects_deployments_delete',
        description: 'Delete a deployment of an Apps Script project.',
        parameters: {
          type: 'object',
          properties: {
            scriptId: {
              type: 'string',
              description: 'The ID of the script project.'
            },
            deploymentId: {
              type: 'string',
              description: 'The ID of the deployment to delete.'
            }
          },
          required: ['scriptId', 'deploymentId']
        }
      }
    }
  • tools/paths.js:2-2 (registration)
    The path to this tool's file is registered in the toolPaths array, which is used by the dynamic tool loader to import and register the tool.
    'google-app-script-api/apps-script-api/script-projects-deployments-delete.js',
  • lib/tools.js:8-64 (registration)
    The generic tool registration loader that dynamically imports files from toolPaths, extracts apiTool, wraps the function with logging, and returns the list of tools for MCP.
    export async function discoverTools() {
      logger.info('DISCOVERY', `Starting tool discovery for ${toolPaths.length} tool paths`);
      
      const toolPromises = toolPaths.map(async (file) => {
        try {
          logger.debug('DISCOVERY', `Loading tool from: ${file}`);
          const module = await import(`../tools/${file}`);
          
          if (!module.apiTool) {
            logger.warn('DISCOVERY', `Tool file missing apiTool export: ${file}`);
            return null;
          }
    
          const toolName = module.apiTool.definition?.function?.name;
          if (!toolName) {
            logger.warn('DISCOVERY', `Tool missing function name: ${file}`);
            return null;
          }
    
          // Wrap the original function with logging
          const originalFunction = module.apiTool.function;
          const wrappedFunction = withLogging(toolName, originalFunction);
    
          logger.debug('DISCOVERY', `Successfully loaded tool: ${toolName}`, {
            file,
            toolName,
            description: module.apiTool.definition?.function?.description
          });
    
          return {
            ...module.apiTool,
            function: wrappedFunction,
            path: file,
          };
        } catch (error) {
          logger.error('DISCOVERY', `Failed to load tool: ${file}`, {
            file,
            error: {
              message: error.message,
              stack: error.stack
            }
          });
          return null;
        }
      });
      
      const tools = (await Promise.all(toolPromises)).filter(Boolean);
      
      logger.info('DISCOVERY', `Tool discovery completed`, {
        totalPaths: toolPaths.length,
        successfullyLoaded: tools.length,
        failed: toolPaths.length - tools.length,
        toolNames: tools.map(t => t.definition?.function?.name).filter(Boolean)
      });
      
      return tools;
    }
Behavior2/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 states the tool performs a deletion, implying it's destructive, but doesn't clarify if the deletion is permanent, reversible, requires specific permissions, affects associated resources, or has side effects like breaking linked scripts. 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 that directly states the tool's purpose without unnecessary words. It's front-loaded with the key action ('Delete'), making it easy to scan and understand immediately.

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 destructive tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after deletion (e.g., success confirmation, error handling), whether it affects project versions or runs, or any dependencies. Given the complexity of deployments in a scripting context, more behavioral 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 input schema has 100% description coverage, with both parameters ('scriptId' and 'deploymentId') clearly documented. The description doesn't add any semantic context beyond what the schema provides, such as where to find these IDs or format requirements. Baseline 3 is appropriate since the schema does the heavy lifting.

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 ('Delete') and the resource ('a deployment of an Apps Script project'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling deletion tools (none are listed) or other destructive operations like 'update_script_content' that might also modify 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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a deployment ID from 'script_projects_deployments_list'), when not to use it (e.g., for active deployments), or how it differs from related tools like 'script_projects_deployments_update' or 'update_script_content'.

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