Skip to main content
Glama
max-paulus

gong-mcp

by max-paulus

getv2callsbyid

Retrieve a single call from the Gong platform by providing its unique identifier to access specific conversation data.

Instructions

Retrieve a single call

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • src/index.ts:60-69 (registration)
    Registration of the 'getv2callsbyid' tool definition, including name, description, input schema, HTTP method (GET), path template (/v2/calls/{id}), parameters, and security (basicAuth).
    ["getv2callsbyid", {
      name: "getv2callsbyid",
      description: `Retrieve a single call`,
      inputSchema: {"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},
      method: "get",
      pathTemplate: "/v2/calls/{id}",
      executionParameters: [{"name":"id","in":"path"}],
      requestBodyContentType: undefined,
      securityRequirements: [{"basicAuth":[]}]
    }],
  • Generic handler that implements the tool logic for ALL tools (including 'getv2callsbyid') by validating inputs with Zod, constructing the API URL/path/query/body based on tool definition, adding Basic Auth credentials from environment variables, proxying the request to Gong API via axios, and returning the JSON response.
    async function executeApiTool(
        toolName: string,
        definition: McpToolDefinition,
        toolArgs: JsonObject,
        allSecuritySchemes: Record<string, any>
    ): Promise<CallToolResult> {
        try {
            // Validate input arguments using Zod
            const zodSchema = getZodSchemaFromJsonSchema(definition.inputSchema, toolName);
            const validatedArgs = zodSchema.parse(toolArgs);
    
            // Build the request URL
            let url = API_BASE_URL + definition.pathTemplate;
            
            // Replace path parameters
            for (const param of definition.executionParameters) {
                if (param.in === 'path') {
                    const value = validatedArgs[param.name];
                    if (value !== undefined) {
                        url = url.replace(`{${param.name}}`, encodeURIComponent(value));
                    }
                }
            }
    
            // Build query parameters
            const queryParams: Record<string, string> = {};
            for (const param of definition.executionParameters) {
                if (param.in === 'query') {
                    const value = validatedArgs[param.name];
                    if (value !== undefined) {
                        queryParams[param.name] = value;
                    }
                }
            }
            
            if (Object.keys(queryParams).length > 0) {
                url += '?' + new URLSearchParams(queryParams).toString();
            }
    
            // Debug logging (safe)
            console.error('Debug - Making API request to:', url);
            
            // Get credentials from environment
            const accessKey = process.env.GONG_ACCESS_KEY || '';
            const secret = process.env.GONG_SECRET || '';
            
            if (!accessKey || !secret) {
                throw new Error('Missing Gong credentials in environment');
            }
            
            // Create authorization header
            const authHeader = `Basic ${Buffer.from(`${accessKey}:${secret}`).toString('base64')}`;
            
            // Build request config
            const config: AxiosRequestConfig = {
                method: definition.method,
                url,
                headers: {
                    'Accept': 'application/json',
                    'Authorization': authHeader
                }
            };
    
            // Add request body if needed
            if (definition.requestBodyContentType) {
                config.headers!['Content-Type'] = definition.requestBodyContentType;
                if (validatedArgs.requestBody) {
                    config.data = validatedArgs.requestBody;
                }
            }
    
            // Make the request
            const response = await axios(config);
            
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify(response.data, null, 2)
                    }
                ]
            };
    
        } catch (error: any) {
            if (error instanceof ZodError) {
                return {
                    content: [{
                        type: 'text',
                        text: `Validation error: ${error.message}`
                    }]
                };
            }
            
            if (axios.isAxiosError(error)) {
                return {
                    content: [{
                        type: 'text',
                        text: formatApiError(error)
                    }]
                };
            }
    
            return {
                content: [{
                    type: 'text',
                    text: `Unexpected error: ${error.message}`
                }]
            };
        }
    }
  • Input schema definition for 'getv2callsbyid': an object requiring a single 'id' property of type string (used for path parameter). Converted to Zod schema at runtime for validation.
    inputSchema: {"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},
  • Helper function to convert the tool's JSON inputSchema to a Zod schema for runtime validation before executing the API call.
    function getZodSchemaFromJsonSchema(jsonSchema: any, toolName: string): z.ZodTypeAny {
        if (typeof jsonSchema !== 'object' || jsonSchema === null) { 
            return z.object({}).passthrough(); 
        }
        try {
            const zodSchemaString = jsonSchemaToZod(jsonSchema);
            const zodSchema = eval(zodSchemaString);
            if (typeof zodSchema?.parse !== 'function') { 
                throw new Error('Eval did not produce a valid Zod schema.'); 
            }
            return zodSchema as z.ZodTypeAny;
        } catch (err: any) {
            console.error(`Failed to generate/evaluate Zod schema for '${toolName}':`, err);
            return z.object({}).passthrough();
        }
    }
  • src/index.ts:143-151 (registration)
    MCP server request handler registration for tool calls (CallToolRequestSchema). Looks up tool by name from toolDefinitionMap and dispatches to executeApiTool.
    server.setRequestHandler(CallToolRequestSchema, async (request: CallToolRequest): Promise<CallToolResult> => {
      const { name: toolName, arguments: toolArgs } = request.params;
      const toolDefinition = toolDefinitionMap.get(toolName);
      if (!toolDefinition) {
        console.error(`Error: Unknown tool requested: ${toolName}`);
        return { content: [{ type: "text", text: `Error: Unknown tool requested: ${toolName}` }] };
      }
      return await executeApiTool(toolName, toolDefinition, toolArgs ?? {}, securitySchemes);
    });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Retrieve' implies a read operation, it doesn't specify authentication requirements, rate limits, error conditions, or what happens with invalid IDs. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 maximally concise with a single clear sentence that states the core functionality. There's no wasted language or unnecessary elaboration, making it easy to parse and understand at a glance.

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 tool with no annotations, no output schema, and 0% parameter documentation, the description is insufficiently complete. It doesn't address what format the retrieved call data will be in, what fields are included, or provide any context about the 'id' parameter that's essential for correct usage.

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

Parameters2/5

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

With 0% schema description coverage and one required parameter ('id'), the description provides no information about what the 'id' parameter represents, its format, or valid values. The description doesn't compensate for the complete lack of parameter documentation in the schema.

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 verb ('Retrieve') and resource ('a single call'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential sibling retrieval tools (like 'getv2users' or 'postv2callsextensive'), which would require more specific scope information.

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. With sibling tools like 'postv2callsextensive' and 'postv2callstranscript' available, there's no indication whether this is for basic call retrieval versus more comprehensive or transcript-focused operations.

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/max-paulus/gong-mcp'

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