Skip to main content
Glama

marketo_get_lead_by_id

Retrieve a Marketo lead by its unique ID, with optional field selection to return only the data you need.

Instructions

Get a single lead by Marketo lead ID. Optionally specify which fields to return. Returns lead record with all requested fields.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesMarketo lead ID
fieldsNoList of field API names to return (e.g. ['email','firstName','company'])

Implementation Reference

  • The async handler function for marketo_get_lead_by_id. It extracts optional 'fields' from args, joins them into a comma-separated string, and calls makeRequest to GET /rest/v1/lead/{id}.json.
      async (args) => {
        try {
          const params: Record<string, unknown> = {};
          if (args.fields?.length) params.fields = args.fields.join(",");
          return ok(await makeRequest(`/rest/v1/lead/${args.id}.json`, "GET", params));
        } catch (e) { return err(e); }
      }
    );
  • Input schema for marketo_get_lead_by_id: 'id' (required number) and 'fields' (optional array of strings).
    {
      id: z.number().describe("Marketo lead ID"),
      fields: z.array(z.string()).optional().describe("List of field API names to return (e.g. ['email','firstName','company'])"),
    },
  • src/tools/leads.ts:7-8 (registration)
    Registration of the tool via server.tool('marketo_get_lead_by_id', ...) with description and schema.
    server.tool(
      "marketo_get_lead_by_id",
  • src/index.ts:6-22 (registration)
    Import of registerLeadTools from leads.ts (file containing the tool registration).
    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);
  • The makeRequest helper that performs authenticated HTTP requests to the Marketo REST API, called by the tool handler.
    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;
    }
Behavior3/5

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

Describes read-only behavior ('Get'), but does not mention error handling (e.g., if ID not found) or any side effects. No annotations provided, so description carries burden but is minimal.

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, 22 words, front-loaded with purpose. Every sentence adds value without waste.

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

Completeness4/5

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

For a simple lookup tool with no output schema or annotations, the description covers the basic function and inputs. Minor omission: no mention of return format or error behavior (e.g., null if not found).

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%, so baseline is 3. Description adds no extra meaning beyond schema: 'Optionally specify which fields' repeats schema info. No clarification on default return fields.

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?

Clearly states verb 'Get', resource 'single lead', and input 'Marketo lead ID'. Differentiates from sibling tools like marketo_get_lead_by_email by specifying the identifier type.

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?

No explicit guidance on when to use this tool vs alternatives (e.g., by email vs ID) or prerequisites. Implicit from purpose but lacks exclusion criteria.

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