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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>",
      "platform": "<platform>"
    },
    "name": "format_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesSource code to format (≤50KB).
languageNoDefaults to javascript. typescript parses TypeScript on pipedream and reads as javascript elsewhere. zapier, n8n, pipedream, make, and hubspot support python; hubl does not.
platformYesTarget automation platform.

Output 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.
lint_unavailableNoPresent only when the linter could not run, so an empty diagnostics list is unknown, not clean.
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
    • addedOutput schema / properties / lint_unavailable
      Added value: +{
      +  "const": true,
      +  "description": "Present only when the linter could not run, so an empty diagnostics list is unknown, not clean.",
      +  "type": "boolean"
      +}
  2. Changed2 schema fields changed
    • changedInput schema / properties / language / description
      Previous value: -"Defaults to javascript. zapier, n8n, pipedream, make, and hubspot support python; hubl does not."New value: +"Defaults to javascript. typescript parses TypeScript on pipedream and reads as javascript elsewhere. zapier, n8n, pipedream, make, and hubspot support python; hubl does not."
    • changedInput schema / properties / language / enum
      Previous value: -[
      -  "javascript",
      -  "python"
      -]New value: +[
      +  "javascript",
      +  "typescript",
      +  "python"
      +]
  3. 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"
      +}
  4. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=true, but the description discloses a genuinely non-obvious behavior: the source is wrapped in each platform's runtime shell before formatting so top-level await, bare return, and injected globals don't break the formatter. It also states the output shape (formatted code plus lint diagnostics), which is the kind of context an agent cannot infer from a read-only hint.

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?

Three tight sentences with no filler: purpose first, then the key behavioral caveat, then the return value. Every sentence carries information an agent needs.

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

Completeness5/5

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

With a fully described schema, an output schema, and an output shape summarized in the description, an agent has everything needed to call this correctly. Platform/language compatibility constraints are already handled by the schema, so no significant gap remains.

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 coverage is 100%, with enums and per-parameter descriptions already covering language defaults, per-platform TypeScript behavior, and HubL's lack of Python. The description adds no parameter-level detail beyond the schema, so the baseline of 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) plus the exact resource scope (JavaScript, Python, or HubL) and the target platforms (Zapier, n8n, Pipedream, Make, HubSpot). The resource scope alone separates it from a JSON-formatting sibling without needing to name it.

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

Usage Guidelines4/5

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

Gives clear context for when this tool applies: code destined for automation platforms, with the runtime-shell wrapping explained as the reason. It stops short of explicit exclusions or naming alternatives such as format_json for plain JSON, so it is clear-but-not-routing.

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