Skip to main content
Glama

create_email_message_by_user_id

Idempotent

Create and send personalized email messages to users with dynamic tags for subject and body, using the user's ID.

Instructions

Create and send an email message to a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idYesID of the email
fromYesFrom field of the email. The default is the educator reply to email. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{educator.reply_to}}`.
subjectYesSubject line of the email. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{user.full_name}}`.
bodyYesBody field of the email, allowing HTML format. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{user.full_name}}`. Since this is JSON it does not accept `"` characters and multi-line strings. The body must be properly escaped before sending. This can be done automatically or manually. Example tool: https://www.freeformatter.com/json-escape.html#before-output

Implementation Reference

  • The async handler function that executes the tool logic: destructures user_id from the rest of the body, calls apiPost to POST /users/{user_id}/emails, logs the response, and returns formatted output.
        async ({ user_id, ...body }) => {
          try {
            const record = await apiPost<EduframeRecord>(`/users/${user_id}/emails`, body);
            void logResponse("create_email_message_by_user_id", { user_id, ...body }, record);
            return formatShow(record, "email");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    }
  • Input schema and tool metadata: defines 'description', 'annotations', and 'inputSchema' with Zod validators for user_id (number), from (string), subject (string), and body (string).
    {
      description: "Create and send an email message to a user",
      annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
      inputSchema: {
        user_id: z.number().int().positive().describe("ID of the email"),
        from: z
          .string()
          .describe(
            "From field of the email. The default is the educator reply to email. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{educator.reply_to}}`.",
          ),
        subject: z
          .string()
          .describe(
            "Subject line of the email. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{user.full_name}}`.",
          ),
        body: z
          .string()
          .describe(
            'Body field of the email, allowing HTML format. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{user.full_name}}`. Since this is JSON it does not accept `"` characters and multi-line strings. The body must be properly escaped before sending. This can be done automatically or manually. Example tool: https://www.freeformatter.com/json-escape.html#before-output',
          ),
      },
    },
  • The registerEmailTools function registers the tool on the McpServer via server.registerTool('create_email_message_by_user_id', ...).
    export function registerEmailTools(server: McpServer): void {
      server.registerTool(
        "create_email_message_by_user_id",
        {
          description: "Create and send an email message to a user",
          annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
          inputSchema: {
            user_id: z.number().int().positive().describe("ID of the email"),
            from: z
              .string()
              .describe(
                "From field of the email. The default is the educator reply to email. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{educator.reply_to}}`.",
              ),
            subject: z
              .string()
              .describe(
                "Subject line of the email. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{user.full_name}}`.",
              ),
            body: z
              .string()
              .describe(
                'Body field of the email, allowing HTML format. It is possible to use tags delimited by two pairs of curly braces, i.e. `{{user.full_name}}`. Since this is JSON it does not accept `"` characters and multi-line strings. The body must be properly escaped before sending. This can be done automatically or manually. Example tool: https://www.freeformatter.com/json-escape.html#before-output',
              ),
          },
        },
        async ({ user_id, ...body }) => {
          try {
            const record = await apiPost<EduframeRecord>(`/users/${user_id}/emails`, body);
            void logResponse("create_email_message_by_user_id", { user_id, ...body }, record);
            return formatShow(record, "email");
          } catch (error) {
            return formatError(error);
          }
        },
      );
    }
  • The registerAllTools function iterates over all tool registrations including registerEmailTools, which is the entry point that causes the tool to be registered on the server.
    export function registerAllTools(server: McpServer): void {
      for (const register of tools) {
        register(server);
      }
    }
  • The apiPost helper function that performs the actual HTTP POST request to the Eduframe API, used by the handler to POST to /users/{user_id}/emails.
    export async function apiPost<T>(path: string, body: unknown): Promise<T> {
      const { token } = getConfig();
      const url = buildUrl(path);
    
      const response = await fetch(url.toString(), {
        method: "POST",
        headers: buildHeaders(token),
        body: JSON.stringify(body),
      });
    
      return handleResponse<T>(response);
    }
Behavior2/5

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

The description and annotations together imply a mutation (readOnlyHint false) but give no details on side effects, such as email delivery guarantees, rate limits, or potential failures. The idempotentHint true is not explained and may contradict the typical behavior of sending email, reducing transparency.

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 a single, concise sentence containing all essential information without redundancy. It is front-loaded and easily parsed. Every word serves a purpose.

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 tool sends email (a complex side effect), the description omits important context: return value (e.g., success status, message ID), error handling, prerequisite checks (e.g., user existence, email configuration), and confirmation of sending. The absence of an output schema increases the need for such details.

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 coverage is 100% with detailed parameter descriptions (e.g., template tags, JSON escaping). The description adds no additional meaning beyond the schema, so baseline score of 3 is appropriate.

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 action ('Create and send an email message') and the target ('to a user'). It uses a specific verb and resource, distinguishing it from sibling tools like 'create_user' or 'create_comment' which focus on other entities. No ambiguity.

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 (e.g., other communication tools) or when not to use it. There are no explicit context cues, prerequisites, or exclusions. The agent must infer usage from the name alone.

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/martijnpieters/eduframe-mcp'

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