get_contact
Retrieve detailed contact information from SendGrid by providing a contact ID for email marketing and management purposes.
Instructions
Get detailed information about a specific contact by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contact_id | Yes | ID of the contact to retrieve |
Implementation Reference
- src/tools/contacts.ts:359-362 (handler)The handler function executes the tool logic by fetching the contact details from the SendGrid API using the provided contact_id and returning the result as formatted JSON.handler: async ({ contact_id }: { contact_id: string }): Promise<ToolResult> => { const result = await makeRequest(`https://api.sendgrid.com/v3/marketing/contacts/${contact_id}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
- src/tools/contacts.ts:355-357 (schema)Zod input schema validating the 'contact_id' parameter as a required string.inputSchema: { contact_id: z.string().describe("ID of the contact to retrieve"), },
- src/tools/contacts.ts:351-363 (registration)The 'get_contact' tool is registered as part of the contactTools object exported from contacts.ts, which is then aggregated into allTools.get_contact: { config: { title: "Get Contact Details", description: "Get detailed information about a specific contact by ID", inputSchema: { contact_id: z.string().describe("ID of the contact to retrieve"), }, }, handler: async ({ contact_id }: { contact_id: string }): Promise<ToolResult> => { const result = await makeRequest(`https://api.sendgrid.com/v3/marketing/contacts/${contact_id}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }, },
- src/index.ts:21-23 (registration)Final registration of all tools, including 'get_contact', to the MCP server using a loop over allTools.for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
- src/tools/index.ts:9-12 (registration)Aggregation of contactTools (containing get_contact) into the allTools object.export const allTools = { ...automationTools, ...campaignTools, ...contactTools,