Skip to main content
Glama
alexleventer

Marketo MCP Server

by alexleventer

marketo_send_sample_email

Send a preview email to a specified address for QA. Optionally use a lead's data to render the email with personalized content.

Instructions

Send a sample/preview of an email to a specified email address. Optionally render with a specific lead's data by passing leadId. Useful for QA before approving.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailIdYes
emailAddressYes
textOnlyNo
leadIdNo

Implementation Reference

  • The core handler for the marketo_send_sample_email tool. Sends a sample email via Marketo's REST API. Accepts emailId, emailAddress, textOnly (optional), and leadId (optional). Calls makeApiRequest with POST method to the /asset/v1/email/{emailId}/sendSample.json endpoint using application/x-www-form-urlencoded content type.
    server.tool(
      'marketo_send_sample_email',
      'Send a sample/preview of an email to a specified email address. Optionally render with a specific lead\'s data by passing leadId. Useful for QA before approving.',
      {
        emailId: z.number(),
        emailAddress: z.string().email(),
        textOnly: z.boolean().optional(),
        leadId: z.number().optional(),
      },
      tool(async ({ emailId, emailAddress, textOnly, leadId }) => {
        const data: Record<string, string> = { emailAddress };
        if (textOnly !== undefined) data.textOnly = textOnly.toString();
        if (leadId !== undefined) data.leadId = leadId.toString();
        return makeApiRequest(
          `/asset/v1/email/${emailId}/sendSample.json`,
          'POST',
          data,
          'application/x-www-form-urlencoded'
        );
      })
    );
  • Zod schema for input validation. Requires emailId (number) and emailAddress (email format string). Optionally accepts textOnly (boolean) and leadId (number).
    {
      emailId: z.number(),
      emailAddress: z.string().email(),
      textOnly: z.boolean().optional(),
      leadId: z.number().optional(),
    },
  • src/index.ts:525-545 (registration)
    Registration of the tool with the MCP server under the name 'marketo_send_sample_email'.
    server.tool(
      'marketo_send_sample_email',
      'Send a sample/preview of an email to a specified email address. Optionally render with a specific lead\'s data by passing leadId. Useful for QA before approving.',
      {
        emailId: z.number(),
        emailAddress: z.string().email(),
        textOnly: z.boolean().optional(),
        leadId: z.number().optional(),
      },
      tool(async ({ emailId, emailAddress, textOnly, leadId }) => {
        const data: Record<string, string> = { emailAddress };
        if (textOnly !== undefined) data.textOnly = textOnly.toString();
        if (leadId !== undefined) data.leadId = leadId.toString();
        return makeApiRequest(
          `/asset/v1/email/${emailId}/sendSample.json`,
          'POST',
          data,
          'application/x-www-form-urlencoded'
        );
      })
    );
  • Helper function that executes the actual HTTP request to the Marketo API, using Bearer token authentication and supporting both JSON and URL-encoded content types.
    async function makeApiRequest(
      endpoint: string,
      method: string,
      data?: any,
      contentType: string = 'application/json'
    ) {
      const token = await tokenManager.getToken();
      const headers: Record<string, string> = {
        Authorization: `Bearer ${token}`,
      };
    
      if (contentType) {
        headers['Content-Type'] = contentType;
      }
    
      try {
        const response = await axios({
          url: `${MARKETO_BASE_URL}${endpoint}`,
          method,
          data:
            contentType === 'application/x-www-form-urlencoded'
              ? new URLSearchParams(data).toString()
              : data,
          headers,
        });
        return response.data;
      } catch (error: any) {
        console.error('API request failed:', error.response?.data || error.message);
        throw error;
      }
    }
Behavior2/5

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

No annotations exist, so the description carries full burden. It states it sends a sample email but does not disclose that it actually dispatches a real email, nor does it mention permissions, rate limits, or side effects.

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, no wasted words. Front-loaded with the core action, followed by optional detail and use case. Ideal conciseness.

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 annotations, no output schema, and 0% parameter descriptions, the description covers main purpose and two params but misses required emailId explanation, the fact that it actually sends an email, and any response or error information.

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 0%, so description must explain parameters. It adds meaning for emailAddress and leadId, but does not explain emailId (the email to send) or textOnly flag, leaving half the parameters underspecified.

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 sends a sample/preview of an email to a specified address, and distinguishes from siblings like get_email or get_lead by focusing on the send action for QA purposes.

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

Usage Guidelines4/5

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

The description provides explicit context ('Useful for QA before approving'), but does not mention when not to use or list alternatives, leaving some gaps for an agent to decide.

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

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