Skip to main content
Glama
by mohalmah

script_projects_deployments_delete

Remove a deployment from a Google Apps Script project by specifying the script and deployment IDs, facilitating efficient project management and cleanup.

Instructions

Delete a deployment of an Apps Script project.

Input Schema

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

Input Schema (JSON Schema)

{ "properties": { "deploymentId": { "description": "The ID of the deployment to delete.", "type": "string" }, "scriptId": { "description": "The ID of the script project.", "type": "string" } }, "required": [ "scriptId", "deploymentId" ], "type": "object" }

Implementation Reference

  • Handler function that executes the tool logic: sends DELETE request to Google Apps Script API to delete a specific deployment of a script project, with comprehensive 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&quotaUser=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 } }; } };
  • Tool schema definition including name, description, input parameters (scriptId and deploymentId as required strings), and function reference.
    const apiTool = { function: executeFunction, 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:1-18 (registration)
    Central list of all tool file paths relative to tools/, enabling dynamic discovery and registration of this tool among others.
    export const toolPaths = [ 'google-app-script-api/apps-script-api/script-projects-deployments-delete.js', 'google-app-script-api/apps-script-api/script-projects-create.js', 'google-app-script-api/apps-script-api/script-projects-versions-create.js', 'google-app-script-api/apps-script-api/script-projects-deployments-create.js', 'google-app-script-api/apps-script-api/script-projects-deployments-update.js', 'google-app-script-api/apps-script-api/script-projects-deployments-list.js', 'google-app-script-api/apps-script-api/script-projects-update-content.js', 'google-app-script-api/apps-script-api/script-projects-deployments-get.js', 'google-app-script-api/apps-script-api/script-scripts-run.js', 'google-app-script-api/apps-script-api/script-projects-get.js', 'google-app-script-api/apps-script-api/script-processes-list-script-processes.js', 'google-app-script-api/apps-script-api/script-projects-get-metrics.js', 'google-app-script-api/apps-script-api/script-projects-get-content.js', 'google-app-script-api/apps-script-api/script-projects-versions-list.js', 'google-app-script-api/apps-script-api/script-projects-versions-get.js', 'google-app-script-api/apps-script-api/script-processes-list.js' ];
  • lib/tools.js:8-64 (registration)
    Dynamic tool discovery and registration: imports each file from toolPaths, validates apiTool export, wraps handler with logging, and collects for MCP server tool list.
    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; }

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