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

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.
diagnostics_frameNoWhether diagnostic positions refer to the submitted code or the formatted code.

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +]
  2. 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"
      +}
  3. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already establish readOnlyHint=true, so safety is covered. The description adds non-obvious behavioral context: the source is wrapped in each platform's runtime shell before formatting to handle top-level await, bare return, and injected globals, and that output includes lint diagnostics. It does not mention size limits (only in schema) or how severe/format of diagnostics appear.

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: purpose first, the non-obvious wrapping behavior second, output third. No filler.

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?

Given a simple 3-param read-only tool with 100% schema coverage and an output schema, the description covers the critical non-obvious behavior (platform wrapping) and the return of diagnostics. An output schema exists, so return-format details needn't be explained. Only minor gaps in error/limit behavior keep it from 5.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds semantic context by enumerating the supported languages and platform targets that map to the parameters, reinforcing the parameter constraints even though the schema already documents them in detail.

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 specific verbs (format and lint) and resources (JavaScript/Python/HubL code), names the target platforms, and clearly distinguishes itself from siblings format_json and ask_codefmt by outputting transformed code rather than answering questions.

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?

Clearly implies when to use it: before deploying code into Zapier, n8n, Pipedream, Make, or HubSpot. Platform-specific edge cases (hubl lacks Python support) are covered in the schema rather than the description. No explicit exclusion vs. ask_codefmt or format_json, so not a 5.

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