Skip to main content
Glama

sendEvent

Track user actions by sending custom events to Mailmodo with email and event name, along with optional properties and timestamp for detailed analytics.

Instructions

Send custom events with email, event name and event properties

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes
event_nameYes
tsNo
event_propertiesNo

Implementation Reference

  • src/server.ts:118-151 (registration)
    Registers the 'sendEvent' tool on the MCP server with input schema (email, event_name, ts, event_properties) and handler that calls addMailmodoEvent.
    server.tool(
      "sendEvent",
      "Send custom events with email, event name and event properties",
      {
          email: z.string(),
          event_name: z.string(),
          ts: z.number().optional(),
          event_properties: eventPropertiesSchema.optional(),
      },
      async (params) => {
        try {
          const respone = await addMailmodoEvent(mmApiKey,params);
          
          // Here you would typically integrate with your event sending system
          // For example: eventBus.emit(eventName, eventData)
          
          // For demonstration, we'll just return a success message
          return {
            content: [{
              type: "text",
              text: respone.success?`Successfully sent event '${params.event_name}' for email ${params.email} with payload: ${JSON.stringify(params.event_properties)} with reference id ${respone.ref}`: `Something went wrong. Please check if the email is correct`,
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: error instanceof Error ? error.message : "Failed to send event",
            }],
            isError: true
          };
        }
      }
    );
  • Executes the actual event-sending logic by POSTing to Mailmodo's /addEvent API endpoint with axios.
    export async function addMailmodoEvent(
        mmApiKey: string,
        payload: MailmodoEvent
    ): Promise<AddCustomeEventResponse> {
    
        if (!payload.email || !payload.event_name) {
            throw new Error('Email and event_name are required fields');
        }
    
        try {
            const response = await axios.post<AddCustomeEventResponse>(
                'https://api.mailmodo.com/api/v1/addEvent',
                {
                    ...payload,
                    ts: payload.ts || Math.floor(Date.now() / 1000)
                },
                {
                    headers: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json',
                        'mmApiKey': mmApiKey || ''
                    }
                }
            );
    
            return response.data;
        } catch (error) {
            if (error instanceof AxiosError) {
                return {success: false}
            }
            throw new Error('An unexpected error occurred');
        }
    }
  • Type definition for the MailmodoEvent payload used by addMailmodoEvent.
    export interface MailmodoEvent {
        email: string;
        event_name: string;
        ts?: number;
        event_properties?: EventProperties;
    }
    
    export const eventPropertiesSchema = z.record(
        z.union([
          z.string(),
          z.number(),
          z.boolean(),
          z.undefined()
        ])
      );
    
    export interface AddCustomeEventResponse {
        // Define your expected response structure here
        success: boolean;
        ref?: string;
    }
  • Zod schema for event_properties used in the sendEvent tool's input validation.
    export const eventPropertiesSchema = z.record(
        z.union([
          z.string(),
          z.number(),
          z.boolean(),
          z.undefined()
        ])
      );
  • Response type returned by the Mailmodo API for event sending.
    export interface AddCustomeEventResponse {
        // Define your expected response structure here
        success: boolean;
        ref?: string;
    }
Behavior2/5

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

No annotations exist, but the description provides minimal behavior details. It does not disclose authentication needs, rate limits, idempotency, or error handling. The action 'send' implies a mutation, but no confirmation or side effects are described.

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

Conciseness3/5

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

The description is a single sentence, which is concise but omits important details. It front-loads the purpose but lacks structure and fails to elaborate on parameters, usage, or behavior.

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

Completeness1/5

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

For a tool with 4 parameters, no output schema, and no annotations, the description is severely incomplete. It does not explain return values, error conditions, or the effect of sending an event, leaving the agent underinformed.

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

Parameters2/5

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

Schema description coverage is 0%. The description only lists email, event name, and event properties, omitting the 'ts' parameter. It adds no detail on types, constraints, or the complex structure of event_properties beyond the schema itself.

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

Purpose4/5

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

The description clearly states the tool sends custom events with email, event name, and event properties. It distinguishes from sibling tools (e.g., sendEmailToCampaign) by focusing on events rather than email sending.

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. The description lacks context on when it is appropriate to send events, and no comparisons to sibling tools are made.

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/mailmodo/mailmodo-mcp'

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