Skip to main content
Glama

format_document

Analyze code formatting by generating TextEdit[] showing changes needed to align with language server style rules, without applying them automatically.

Instructions

Get formatting edits for an entire document via LSP. Returns TextEdit[] describing the changes needed to format the file according to the language server's style rules. The edits are returned for inspection — they are NOT applied automatically. Use this to see what formatting changes a formatter would make.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
language_idNo
tab_sizeNo
insert_spacesNo
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it's a read-only operation (returns edits for inspection), non-destructive (edits are not applied automatically), and clarifies the return format (TextEdit[]). However, it doesn't mention potential limitations like language server availability, error conditions, or performance characteristics.

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 sentences with zero waste: first states purpose, second explains return value and behavior, third provides usage guidance. Every sentence adds value, and the description is appropriately front-loaded with the core functionality.

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 tool with 4 parameters, no annotations, and no output schema, the description does well by explaining the tool's purpose, behavior, and usage context. However, it doesn't address what happens with invalid inputs, language server errors, or provide examples of the TextEdit[] structure, leaving some gaps in completeness.

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 0%, but the description provides no information about any of the 4 parameters. The schema must carry all parameter documentation burden. Baseline 3 is appropriate since the description doesn't compensate for the schema's lack of descriptions, but it also doesn't contradict or confuse parameter usage.

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?

The description clearly states the tool's purpose with specific verbs ('get formatting edits', 'returns TextEdit[]') and resources ('entire document via LSP'), distinguishing it from sibling tools like format_range (which formats a specific range) and apply_edit (which applies edits). It explicitly explains what the tool does versus what it doesn't do.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'Use this to see what formatting changes a formatter would make.' It also distinguishes from alternatives by stating 'The edits are returned for inspection — they are NOT applied automatically,' implicitly suggesting apply_edit as an alternative for actually applying formatting changes.

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/blackwell-systems/agent-lsp'

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