Skip to main content
Glama
max-paulus

gong-mcp

by max-paulus

getv2askanythinggeneratebrief

Generate account or deal briefs from CRM data to summarize key information for sales teams.

Instructions

Generate account/deal brief

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace-idYes
brief-nameYes
entity-typeYes
crm-entity-idYes
period-typeYes
from-date-timeNo
to-date-timeNo

Implementation Reference

  • Generic handler that implements the execution logic for the 'getv2askanythinggeneratebrief' tool (and all others) by validating inputs with Zod, constructing the API URL with query parameters, authenticating with Basic Auth using GONG_ACCESS_KEY and GONG_SECRET, making an Axios GET request to https://api.gong.io/v2/askanything/generate-brief, 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}`
                }]
            };
        }
    }
  • src/index.ts:110-119 (registration)
    Registration of the 'getv2askanythinggeneratebrief' tool in the toolDefinitionMap. Specifies the tool's metadata, input schema, GET method, path template '/v2/askanything/generate-brief', query parameters, and Basic Auth security.
    ["getv2askanythinggeneratebrief", {
      name: "getv2askanythinggeneratebrief",
      description: `Generate account/deal brief`,
      inputSchema: {"type":"object","properties":{"workspace-id":{"type":"string"},"brief-name":{"type":"string"},"entity-type":{"type":"string","enum":["Deal","Account"]},"crm-entity-id":{"type":"string"},"period-type":{"type":"string"},"from-date-time":{"type":"string","format":"date-time"},"to-date-time":{"type":"string","format":"date-time"}},"required":["workspace-id","brief-name","entity-type","crm-entity-id","period-type"]},
      method: "get",
      pathTemplate: "/v2/askanything/generate-brief",
      executionParameters: [{"name":"workspace-id","in":"query"},{"name":"brief-name","in":"query"},{"name":"entity-type","in":"query"},{"name":"crm-entity-id","in":"query"},{"name":"period-type","in":"query"},{"name":"from-date-time","in":"query"},{"name":"to-date-time","in":"query"}],
      requestBodyContentType: undefined,
      securityRequirements: [{"basicAuth":[]}]
    }],
  • Converts the tool's JSON inputSchema (OpenAPI schema) to a Zod schema for input validation during tool execution.
    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();
        }
    }
  • MCP ListTools handler that exposes the registered tools, including 'getv2askanythinggeneratebrief', to clients with their schemas.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      const toolsForClient: Tool[] = Array.from(toolDefinitionMap.values()).map(def => ({
        name: def.name,
        description: def.description,
        inputSchema: def.inputSchema
      }));
      return { tools: toolsForClient };
    });
  • MCP CallTool request handler that dispatches tool calls by name to the executeApiTool function using the tool definition from the map.
    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);
    });
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It fails to describe what 'generate' entails—whether it creates a new document, triggers a process, returns data, or modifies state. It doesn't mention permissions, rate limits, side effects, or output format, leaving critical behavioral traits unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise ('Generate account/deal brief')—just three words. While this avoids waste, it's under-specified rather than efficiently informative. It's front-loaded but lacks necessary detail, making it more of a placeholder than a helpful description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (7 parameters, 5 required), lack of annotations, and no output schema, the description is severely incomplete. It doesn't explain what the tool does, how to use it, what parameters mean, or what to expect as output. This leaves the agent with insufficient information to invoke the tool correctly.

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

Parameters1/5

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

Schema description coverage is 0%, meaning none of the 7 parameters are documented in the schema. The description adds no information about any parameters—it doesn't explain what 'workspace-id', 'brief-name', 'entity-type', 'crm-entity-id', 'period-type', or date ranges mean or how they affect the brief generation. This leaves all parameters semantically undefined.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Generate account/deal brief' states the general purpose but lacks specificity. It doesn't clarify what 'brief' means (report, summary, document?), what content it contains, or how it differs from other tools. While it mentions the resource types (account/deal), the verb 'generate' is vague without context about the output format or process.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/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, appropriate contexts, or how it relates to sibling tools like getv2callsbyid or postv2callsextensive. Without any usage context, an agent cannot determine when this tool is the correct choice.

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