Skip to main content
Glama

getv2dataprivacydataforemailaddress

Retrieve GDPR-compliant data activities for an email address to support privacy requests. Input the email address and optional cursor for paginated results.

Instructions

Activities for an email address (GDPR helper)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNo
emailAddressYes

Implementation Reference

  • src/index.ts:100-109 (registration)
    Registration of the 'getv2dataprivacydataforemailaddress' tool in the toolDefinitionMap. Defines the tool's metadata, input schema requiring 'emailAddress' (email format) and optional 'cursor', GET method to path '/v2/data-privacy/data-for-email-address' with query parameters, and basicAuth security.
    ["getv2dataprivacydataforemailaddress", { name: "getv2dataprivacydataforemailaddress", description: `Activities for an email address (GDPR helper)`, inputSchema: {"type":"object","properties":{"emailAddress":{"type":"string","format":"email"},"cursor":{"type":"string"}},"required":["emailAddress"]}, method: "get", pathTemplate: "/v2/data-privacy/data-for-email-address", executionParameters: [{"name":"emailAddress","in":"query"},{"name":"cursor","in":"query"}], requestBodyContentType: undefined, securityRequirements: [{"basicAuth":[]}] }],
  • Input schema definition for the tool: object with required 'emailAddress' (string, email format) and optional 'cursor' (string). Used for Zod validation.
    inputSchema: {"type":"object","properties":{"emailAddress":{"type":"string","format":"email"},"cursor":{"type":"string"}},"required":["emailAddress"]},
  • Handler function that executes the tool by validating inputs against the schema, constructing the API endpoint 'https://api.gong.io/v2/data-privacy/data-for-email-address?emailAddress={emailAddress}&cursor={cursor}', adding Basic Auth, calling the Gong API via axios, and returning the response as formatted JSON.
    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}` }] }; } }
  • Helper function to convert the tool's JSON inputSchema to a Zod schema for input validation in the handler.
    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(); } }

Other Tools

Related 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/MaPa07/gong-mcp'

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