postv2callstranscript
Download call transcripts from gong-mcp by specifying filters like date range, call IDs, user IDs, or participant emails.
Instructions
Download transcripts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestBody | Yes | The JSON request body. |
Implementation Reference
- src/index.ts:273-382 (handler)Generic execution handler for all tools including 'postv2callstranscript'. For this tool, it performs a POST request to https://api.gong.io/v2/calls/transcript with the provided requestBody (containing filter and cursor), using Basic Auth credentials from GONG_ACCESS_KEY and GONG_SECRET environment variables. Validates input using Zod schema from the tool definition, handles path/query params (none for this tool), and returns the API response as formatted JSON or detailed error.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:80-89 (registration)Tool registration in toolDefinitionMap. Defines name, description, input schema, HTTP method (POST), path (/v2/calls/transcript), no path/query params, JSON body, and basicAuth security. This map is used by listTools and callTool handlers.["postv2callstranscript", { name: "postv2callstranscript", description: `Download transcripts`, inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["filter"],"properties":{"filter":{"type":"object","properties":{"fromDateTime":{"type":"string","format":"date-time"},"toDateTime":{"type":"string","format":"date-time"},"callIds":{"type":"array","items":{"type":"string"}},"primaryUserIds":{"type":"array","items":{"type":"string"}},"participantsEmails":{"type":"array","items":{"type":"string","format":"email"}}}},"cursor":{"type":"string"}},"description":"The JSON request body."}},"required":["requestBody"]}, method: "post", pathTemplate: "/v2/calls/transcript", executionParameters: [], requestBodyContentType: "application/json", securityRequirements: [{"basicAuth":[]}] }],
- src/index.ts:83-83 (schema)JSON Schema for tool input: object with required 'requestBody' containing 'filter' (date ranges, callIds, userIds, emails) and optional 'cursor' for pagination.inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["filter"],"properties":{"filter":{"type":"object","properties":{"fromDateTime":{"type":"string","format":"date-time"},"toDateTime":{"type":"string","format":"date-time"},"callIds":{"type":"array","items":{"type":"string"}},"primaryUserIds":{"type":"array","items":{"type":"string"}},"participantsEmails":{"type":"array","items":{"type":"string","format":"email"}}}},"cursor":{"type":"string"}},"description":"The JSON request body."}},"required":["requestBody"]},
- src/index.ts:143-151 (registration)MCP CallTool request handler registration. Looks up tool definition by name ('postv2callstranscript') from map 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); });
- src/index.ts:133-140 (registration)MCP ListTools request handler registration. Returns list of all tools including 'postv2callstranscript' with name, description, inputSchema.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 }; });