Skip to main content
Glama

marketo_get_lead_by_email

Look up a lead by email address in Marketo. Returns matching lead records with specified fields.

Instructions

Look up a lead by email address. Uses filterType=email on the leads endpoint. Returns matching lead records.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesEmail address to search for
fieldsNoList of field API names to return

Implementation Reference

  • Handler function for marketo_get_lead_by_email tool. Makes a GET request to Marketo's /rest/v1/leads.json endpoint with filterType=email and the provided email address, optionally returning specified fields.
    // ── marketo_get_lead_by_email ──────────────────────────────────────────────
    server.tool(
      "marketo_get_lead_by_email",
      "Look up a lead by email address. Uses filterType=email on the leads endpoint. Returns matching lead records.",
      {
        email: z.string().describe("Email address to search for"),
        fields: z.array(z.string()).optional().describe("List of field API names to return"),
      },
      async (args) => {
        try {
          const params: Record<string, unknown> = {
            filterType: "email",
            filterValues: args.email,
          };
          if (args.fields?.length) params.fields = args.fields.join(",");
          return ok(await makeRequest("/rest/v1/leads.json", "GET", params));
        } catch (e) { return err(e); }
      }
    );
  • Input schema for marketo_get_lead_by_email using zod. Requires email (string) and optionally accepts fields (array of strings).
    {
      email: z.string().describe("Email address to search for"),
      fields: z.array(z.string()).optional().describe("List of field API names to return"),
    },
  • Registration of the marketo_get_lead_by_email tool via server.tool() call, which is invoked when registerLeadTools() is called from src/index.ts.
    // ── marketo_get_lead_by_email ──────────────────────────────────────────────
    server.tool(
      "marketo_get_lead_by_email",
      "Look up a lead by email address. Uses filterType=email on the leads endpoint. Returns matching lead records.",
      {
        email: z.string().describe("Email address to search for"),
        fields: z.array(z.string()).optional().describe("List of field API names to return"),
      },
      async (args) => {
        try {
          const params: Record<string, unknown> = {
            filterType: "email",
            filterValues: args.email,
          };
          if (args.fields?.length) params.fields = args.fields.join(",");
          return ok(await makeRequest("/rest/v1/leads.json", "GET", params));
        } catch (e) { return err(e); }
      }
    );
  • src/index.ts:6-22 (registration)
    Registration of all lead tools (including marketo_get_lead_by_email) in the MCP server via registerLeadTools(server) call.
    import { registerLeadTools } from "./tools/leads.js";
    import { registerProgramTools } from "./tools/programs.js";
    import { registerEmailTools } from "./tools/emails.js";
    import { registerSmartListTools } from "./tools/smartLists.js";
    import { registerListTools } from "./tools/lists.js";
    import { registerChannelTools } from "./tools/channels.js";
    import { registerLandingPageTools } from "./tools/landingPages.js";
    import { registerBulkExportTools } from "./tools/bulkExport.js";
    
    const server = new McpServer({
      name: "marketo-mcp",
      version: "0.1.0",
    });
    
    // Register all tool groups
    registerFormTools(server);
    registerLeadTools(server);
  • Shared makeRequest helper called by the handler. Handles authentication token retrieval, HTTP requests via axios, and Marketo error parsing.
    export async function makeRequest<T = unknown>(
      endpoint: string,
      method: Method = "GET",
      data?: unknown,
      contentType?: string,
    ): Promise<T> {
      const token = await getAccessToken();
      const config: AxiosRequestConfig = {
        url: `${MARKETO_BASE_URL}${endpoint}`,
        method,
        headers: {
          Authorization: `Bearer ${token}`,
          ...(contentType ? { "Content-Type": contentType } : {}),
        },
        ...(data && method !== "GET" ? { data } : {}),
        ...(data && method === "GET" ? { params: data } : {}),
      };
    
      const res = await axios(config);
      const body = res.data;
    
      // Marketo REST API returns errors inside the response body
      if (body?.errors?.length) {
        const e = body.errors[0];
        throw new MarketoError(`${e.code}: ${e.message}`, res.status);
      }
    
      return body as T;
    }
Behavior2/5

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

With no annotations, the description carries full burden for behavioral disclosure. It fails to mention side effects, rate limits, permissions, or data freshness. Being a read operation is implied but not stated explicitly.

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

Conciseness5/5

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

Two sentences clearly convey purpose and implementation detail. No fluff, front-loaded with the main action. Achieves maximal density for the given information.

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?

Given no output schema, the description does not explain return format, pagination, or error cases. For a simple lookup, this may be adequate, but lacks completeness for an agent to fully anticipate behavior.

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?

Input schema has 100% description coverage, so baseline is 3. Description adds minimal value beyond schema by noting 'Uses filterType=email' but does not explain the meaning or constraints of the 'fields' parameter in any actionable way.

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?

The description clearly states the tool's purpose: 'Look up a lead by email address.' This is a specific verb-resource pair and distinguishes from sibling 'marketo_get_lead_by_id' which uses ID instead of email.

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

Usage Guidelines3/5

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

The description implies usage for email-based lookups but does not explicitly state when to use this tool over alternatives like 'marketo_get_lead_by_id' or 'marketo_create_or_update_leads'. No guidance on prerequisites or appropriate contexts is provided.

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/ZLeventer/marketo-mcp-server'

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