search_contacts_by_emails
Find SendGrid contacts using their email addresses. Input email addresses to retrieve contact information from your SendGrid account.
Instructions
Search for specific contacts by their email addresses
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emails | Yes | Array of email addresses to search for |
Implementation Reference
- src/tools/contacts.ts:436-442 (handler)The handler function that executes the core logic: sends a POST request to SendGrid API's /marketing/contacts/search/emails endpoint with the emails array and returns the JSON response.handler: async ({ emails }: { emails: string[] }): Promise<ToolResult> => { const result = await makeRequest("https://api.sendgrid.com/v3/marketing/contacts/search/emails", { method: "POST", body: JSON.stringify({ emails }), }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
- src/tools/contacts.ts:429-435 (schema)The tool configuration including title, description, and Zod input schema for validating the emails array parameter.config: { title: "Search Contacts by Email Addresses", description: "Search for specific contacts by their email addresses", inputSchema: { emails: z.array(z.string().email()).describe("Array of email addresses to search for"), }, },
- src/tools/index.ts:9-16 (registration)Spreads contactTools (which contains search_contacts_by_emails) into the allTools object exported for registration.export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools,
- src/index.ts:20-23 (registration)The MCP server registration loop that registers all tools from allTools, including search_contacts_by_emails, using registerTool.// Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }