Skip to main content
Glama

devtools-mcp

Format Json

format_json

JSON 字符串处理。action 支持:format(美化缩进2格,中文不转义)、minify(压缩为单行去空白)、validate(仅校验合法性,非法时返回错误行号、列号、位置指针和上下文片段)。输入 data 必须是字符串。

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": {
      "data": "<data>"
    },
    "name": "format_json"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataYesJSON 格式的字符串
actionNo"format"(默认,美化缩进2格)、"minify"(压缩)、 "validate"(校验合法性)format

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / action / description
      Added value: +"\"format\"(默认,美化缩进2格)、\"minify\"(压缩)、\n    \"validate\"(校验合法性)"
    • removedInput schema / properties / action / title
      Removed value: -"Action"
    • addedInput schema / properties / data / description
      Added value: +"JSON 格式的字符串"
    • removedInput schema / properties / data / title
      Removed value: -"Data"
    • removedInput schema / title
      Removed value: -"format_jsonArguments"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

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

No annotations exist, so the description carries the burden, and it does disclose non-obvious behavior: 2-space indentation, non-escaping of Chinese characters, whitespace removal on minify, and that validate only checks legality and returns line/column/pointer/context on failure. It omits any statement about input size limits or failure behavior for format/minify, which is why it is not a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One dense paragraph with the purpose front-loaded and no filler sentences; every clause describes a distinct action or constraint. It would read better as separated action clauses, but nothing is wasted.

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 two-parameter pure utility with an output schema already covering return values, the description supplies purpose, all action semantics, and the key input constraint. Only edge-case behavior (size limits, what format/minify return on invalid input) is left unaddressed.

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 baseline is 3; the description earns above baseline by explaining what each action enum value actually does and by insisting data be a string. It adds behavioral meaning for the action parameter beyond the schema's short gloss.

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+resource ('JSON 字符串处理') and immediately enumerates the three operations it performs (format/minify/validate). It cannot be confused with any sibling (timestamp, unit, QR, UUID, DNS), all of which operate on entirely different domains.

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?

Each action value is tied to its concrete effect, and the default (format) is stated, which tells an agent how to select behavior. There is no explicit 'when not to use' clause or prerequisite guidance, but with no overlapping sibling the practical alternative set is empty.

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.