Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Get Contact Details

get_contact

Retrieve detailed information about a specific contact using its ID for email marketing and transactional email operations.

Instructions

Get detailed information about a specific contact by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contact_idYesID of the contact to retrieve

Implementation Reference

  • The get_contact tool definition including the config (title, description, inputSchema with contact_id) and the handler that makes a GET request to the SendGrid marketing contacts API endpoint.
    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) }] };
      },
  • Input schema for get_contact - requires a contact_id string parameter.
    inputSchema: {
      contact_id: z.string().describe("ID of the contact to retrieve"),
    },
  • src/index.ts:20-23 (registration)
    Tools are registered dynamically by iterating allTools, which includes contactTools spread from src/tools/contacts.ts. The name 'get_contact' is used as the tool name when registered.
    // Register all tools
    for (const [name, tool] of Object.entries(allTools)) {
      server.registerTool(name, tool.config as any, tool.handler as any);
    }
  • The makeRequest helper used by get_contact's handler to call the SendGrid API with authentication headers.
    export async function makeRequest(url: string, options: RequestInit = {}): Promise<any> {
      const response = await fetch(url, {
        headers: {
          ...getAuthHeaders(),
          ...options.headers,
        },
        ...options,
      });
    
      if (!response.ok) {
        const errorText = await response.text();
        throw new Error(`SendGrid API error (${response.status}): ${errorText}`);
      }
    
      return response.json();
    }
  • contactTools (which contains get_contact) is imported and spread into allTools for registration.
    import { contactTools } from "./contacts.js";
    import { mailTools } from "./mail.js";
    import { miscTools } from "./misc.js";
    import { statsTools } from "./stats.js";
    import { templateTools } from "./templates.js";
    
    export const allTools = {
      ...automationTools,
      ...campaignTools,
      ...contactTools,
Behavior2/5

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

No annotations provided, so description must carry full burden. It only states 'Get detailed information', without disclosing response format, permissions, rate limits, or any side effects. Lacks transparency for a retrieval operation.

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

Conciseness4/5

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

Single sentence is concise and front-loaded. No unnecessary words. Could be slightly improved by adding common usage context without losing brevity.

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

Completeness3/5

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

Simple tool with one parameter and no output schema. Description is adequate but does not hint at response fields or structure. Minimal extra context needed.

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

Parameters3/5

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

Schema coverage is 100% with one parameter 'contact_id' described as 'ID of the contact to retrieve'. Description adds no additional semantics beyond the schema.

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

Purpose5/5

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

Description clearly states verb 'Get', resource 'contact', and method 'by ID'. It distinguishes from siblings like 'list_contacts' and 'search_contacts' which serve different purposes.

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

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives such as 'search_contacts' or 'list_contacts'. Missing context on scenarios that require a specific contact ID vs. query-based retrieval.

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/deyikong/sendgrid-mcp'

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