Skip to main content
Glama
mohalmah

Google Apps Script MCP Server

by mohalmah

script_projects_deployments_get

Retrieve a specific deployment of a Google Apps Script project using its script and deployment IDs to access deployment details.

Instructions

Get a deployment of an Apps Script project.

Input Schema

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

Implementation Reference

  • Main handler function that executes the logic to retrieve a specific Apps Script project deployment via the Google API using OAuth authentication, with comprehensive error handling.
    const executeFunction = async ({ scriptId, deploymentId }) => {
      const baseUrl = 'https://script.googleapis.com';
      const url = `${baseUrl}/v1/projects/${scriptId}/deployments/${deploymentId}`;
    
      try {
        // Get OAuth access token
        const token = await getOAuthAccessToken();
        
        // Set up headers for the request
        const headers = {
          'Authorization': `Bearer ${token}`,
          'Accept': 'application/json'
        };
    
        // Perform the fetch request
        const response = await fetch(url, {
          method: 'GET',
          headers
        });
    
        // Check if the response was successful
        if (!response.ok) {
          const errorText = await response.text();
          console.error('API Error Response:', errorText);
          throw new Error(`HTTP ${response.status}: ${errorText}`);
        }
    
        // 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_GET', 'Error retrieving deployment', errorDetails);
        
        console.error('❌ Error retrieving 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 and deploymentId as required strings), used for MCP tool validation.
      name: 'script_projects_deployments_get',
      description: 'Get 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 retrieve.'
          }
        },
        required: ['scriptId', 'deploymentId']
      }
    }
  • The apiTool object that registers the handler function and schema definition for the MCP tool system, exported for import into central tool registry.
    const apiTool = {
      function: executeFunction,
      definition: {
        type: 'function',
        function: {
          name: 'script_projects_deployments_get',
          description: 'Get 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 retrieve.'
              }
            },
            required: ['scriptId', 'deploymentId']
          }
        }
      }
    };
  • Path listing used likely for dynamic import and registration of all Apps Script API tools in the MCP system.
    'google-app-script-api/apps-script-api/script-projects-deployments-get.js',

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