Skip to main content
Glama

sendEvent

Track and send custom email events with specific details like event name and properties using Mailmodo. Enhance user engagement and data collection.

Instructions

Send custom events with email, event name and event properties

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes
event_nameYes
event_propertiesNo
tsNo

Implementation Reference

  • src/server.ts:118-151 (registration)
    Registration of the 'sendEvent' tool including inline handler and input schema definition.
    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
          };
        }
      }
    );
  • Core handler logic for sending the custom event to Mailmodo API via POST request.
    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');
        }
    }
  • Zod schema definition for event_properties object used in sendEvent tool input.
    export const eventPropertiesSchema = z.record(
        z.union([
          z.string(),
          z.number(),
          z.boolean(),
          z.undefined()
        ])
      );
  • TypeScript interface defining the MailmodoEvent payload structure for sendEvent.
    export interface MailmodoEvent {
        email: string;
        event_name: string;
        ts?: number;
        event_properties?: EventProperties;
    }
  • TypeScript interface for the API response from addEvent endpoint.
    export interface AddCustomeEventResponse {
        // Define your expected response structure here
        success: boolean;
        ref?: string;
    }
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. The description only states what the tool does ('send custom events') without mentioning any behavioral traits: it doesn't indicate whether this is a write operation, what permissions are required, whether it's idempotent, what happens on failure, or any rate limits. This is a significant gap for a tool that appears to be a mutation operation.

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?

The description is extremely concise at just 8 words, with zero wasted language. It's front-loaded with the core purpose and efficiently lists the key parameters. Every word earns its place in conveying essential information without redundancy.

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

Completeness2/5

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

Given the complexity (4 parameters including nested objects), no annotations, and no output schema, the description is insufficiently complete. It doesn't explain what 'sending' an event means operationally, what the expected outcome is, what format event properties should take, or what the timestamp parameter represents. For a mutation tool with multiple parameters, this leaves too many unanswered questions.

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?

With 0% schema description coverage for 4 parameters, the description must compensate but only partially does so. It mentions 'email, event name and event properties' which maps to 3 of the 4 parameters (email, event_name, event_properties), but doesn't explain the 'ts' parameter at all. The description provides basic semantic meaning for most parameters but leaves one completely undocumented.

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 action ('send') and resource ('custom events'), specifying the required components (email, event name, event properties). It distinguishes from sibling tools that focus on contact management, campaigns, or reporting rather than event tracking. However, it doesn't explicitly differentiate from potential similar event-sending tools that might exist in other contexts.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, appropriate contexts, or exclusions. While sibling tools are listed, there's no explicit comparison or indication of when this tool is preferred over others for event-related tasks.

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

Related 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