Skip to main content
Glama

Format code for automation platforms

format_code
Read-only

Format and lint JavaScript, Python, or HubL code for Zapier, n8n, Pipedream, Make, or HubSpot. Wraps the source in each platform's runtime shell before formatting so top-level await, bare return, and injected globals don't break the formatter. Returns formatted code plus lint diagnostics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesSource code to format (≤50KB).
languageNoDefaults to javascript. zapier, n8n, pipedream, make, and hubspot support python; hubl does not.
platformYesTarget automation platform.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorYesWhy the format failed, or null on success.
diagnosticsYesLint findings with line and column.
formatted_codeNoThe formatted source. Absent when the input was refused.
diagnostics_frameNoWhether diagnostic positions refer to the submitted code or the formatted code.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "diagnostics": {
      +      "description": "Lint findings with line and column.",
      +      "items": {
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "diagnostics_frame": {
      +      "description": "Whether diagnostic positions refer to the submitted code or the formatted code.",
      +      "enum": [
      +        "input",
      +        "output"
      +      ],
      +      "type": "string"
      +    },
      +    "error": {
      +      "description": "Why the format failed, or null on success.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "formatted_code": {
      +      "description": "The formatted source. Absent when the input was refused.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "diagnostics",
      +    "error"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A4/5.0
Behavior4/5

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

With readOnlyHint=true the safety profile is already declared, yet the description adds real behavioral detail: it wraps source in each platform's runtime shell so top-level await, bare return, and injected globals don't break the formatter. That explains non-obvious internal behavior beyond the annotations. The 'returns formatted code plus lint diagnostics' sentence is partly redundant with the output schema.

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, zero filler. The primary purpose and supported languages/platforms are front-loaded, with the non-obvious wrapping rationale following. Every clause earns its place.

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

Completeness4/5

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

For a three-parameter, enum-driven tool with an output schema covering the return shape, the description supplies purpose, platform scope, and the key formatting caveat. It is essentially complete, with minor room for stating the size limit or error behavior, both of which the schema already handles.

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 description coverage is 100%, including enum members and the python-support caveat for hubl, so the schema carries the parameter semantics. The description adds nothing to the code/language/platform parameters beyond repeating the platform names. Baseline 3 applies.

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?

States a specific verb pair (format and lint) with a specific resource (JavaScript, Python, or HubL code) and enumerates the target platforms. An agent can distinguish this from format_json (JSON) and ask_codefmt without opening any schema.

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

Usage Guidelines3/5

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

The platform enumeration implies the usage context, but there is no explicit when-to-use or when-not-to-use statement and no routing to the siblings ask_codefmt or format_json. The agent must infer that non-JS/Python/HubL content belongs elsewhere.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources