Skip to main content
Glama

validate_mjml

Check MJML syntax and structure for errors to ensure valid email templates before deployment.

Instructions

Validate MJML syntax and structure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesMJML content or file path
filePathNoTreat input as file path
validationLevelNoValidation levelstrict

Implementation Reference

  • The main handler function for the validate_mjml tool. Parses input arguments using the schema, reads MJML content from string or file, validates it using the mjml library with specified validation level, determines if valid based on absence of errors, and returns a structured response with validity status, errors, warnings, and validation level.
    async handleValidateMjml(args) {
      const parsed = ValidateMjmlSchema.parse(args);
      log.info('Validating MJML');
    
      const mjmlContent = await this.readInput(parsed.input, parsed.filePath);
    
      const mjmlOptions = {
        validationLevel: parsed.validationLevel,
      };
    
      const result = mjml(mjmlContent, mjmlOptions);
    
      const isValid = result.errors.length === 0;
      log.info(`MJML validation ${isValid ? 'passed' : 'failed'}`);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              valid: isValid,
              errors: result.errors,
              warnings: result.warnings,
              validationLevel: parsed.validationLevel,
            }, null, 2),
          },
        ],
      };
    }
  • Zod schema for validating input parameters to the validate_mjml tool: MJML input (content or path), flag for file path treatment, and validation level.
    const ValidateMjmlSchema = z.object({
      input: z.string().describe('MJML content or file path'),
      filePath: z.boolean().optional().default(false).describe('Treat input as file path'),
      validationLevel: z.enum(['skip', 'soft', 'strict']).optional().default('strict').describe('Validation level'),
    });
  • index.js:185-209 (registration)
    MCP tool registration for validate_mjml, including name, description, and input schema definition for the ListTools response.
    {
      name: 'validate_mjml',
      description: 'Validate MJML syntax and structure',
      inputSchema: {
        type: 'object',
        properties: {
          input: {
            type: 'string',
            description: 'MJML content or file path',
          },
          filePath: {
            type: 'boolean',
            description: 'Treat input as file path',
            default: false,
          },
          validationLevel: {
            type: 'string',
            enum: ['skip', 'soft', 'strict'],
            description: 'Validation level',
            default: 'strict',
          },
        },
        required: ['input'],
      },
    },
  • index.js:271-272 (registration)
    Dispatch case in the CallToolRequest handler that routes validate_mjml calls to the specific handler method.
    case 'validate_mjml':
      return await this.handleValidateMjml(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool validates MJML but doesn't describe what happens during validation (e.g., returns errors/warnings, checks against a schema), whether it's read-only or has side effects, or any performance or permission considerations. For a validation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 four words ('Validate MJML syntax and structure'), with zero wasted language. It's front-loaded with the core purpose and appropriately sized for a simple validation tool, making it easy for an agent to parse quickly.

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 the tool's moderate complexity (validation with three parameters) and no output schema, the description is minimally adequate but incomplete. It states what the tool does but lacks details on behavior, usage context, or return values. With no annotations and no output schema, the agent must rely heavily on the schema and tool name, leaving gaps in understanding the full context of validation results.

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?

The description adds no parameter semantics beyond what the input schema provides. Since schema description coverage is 100%, the baseline score is 3. The schema fully documents all three parameters (input, filePath, validationLevel) with descriptions and defaults, so the description doesn't need to compensate, but it also doesn't add any extra context about parameter usage or interactions.

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's purpose as 'Validate MJML syntax and structure', which is a specific verb ('validate') applied to a specific resource ('MJML syntax and structure'). It distinguishes from sibling tools like 'compile_mjml' (which transforms MJML) and 'generate_template' (which creates templates), though it doesn't explicitly mention these distinctions in the description text itself.

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 when validation is needed (e.g., before compilation), what scenarios it's best for, or how it differs from sibling tools like 'compile_mjml' (which might include validation implicitly). The agent must infer usage from the tool name and context 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/shaunie2fly/mjml_mcp'

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