Skip to main content
Glama
ProfessioneIT

lsp-mcp-server

lsp_format_document

Idempotent

Format source code documents using Language Server Protocol to apply consistent styling based on project-specific settings, supporting multiple programming languages.

Instructions

Format a document using the language server's formatting capabilities. Respects project-specific formatting settings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the source file to format
tab_sizeNoNumber of spaces per tab (default: 2)
insert_spacesNoUse spaces instead of tabs (default: true)
applyNoIf true, apply formatting changes to file. If false, return edits without applying.
Behavior4/5

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

Annotations provide readOnlyHint=false, idempotentHint=true, and openWorldHint=false, indicating this is a mutating but safe operation. The description adds valuable context about respecting project-specific formatting settings, which isn't covered by annotations. It doesn't contradict annotations, as 'format' implies mutation consistent with readOnlyHint=false.

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?

The description is two concise sentences with zero wasted words. The first sentence states the core purpose, and the second adds important behavioral context. It's appropriately sized and front-loaded with essential information.

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

Completeness3/5

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

Given the tool's moderate complexity (formatting with project settings), rich annotations, and full schema coverage, the description is adequate but has gaps. It lacks output information (no schema provided), doesn't explain error conditions, and doesn't detail how 'apply' parameter affects behavior beyond the schema's basic description.

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?

With 100% schema description coverage, the input schema fully documents all parameters. The description adds no additional parameter semantics beyond what's in the schema, such as explaining how 'project-specific formatting settings' interact with parameters like tab_size. This meets the baseline score of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Format a document') and mechanism ('using the language server's formatting capabilities'), distinguishing it from other LSP tools that perform different operations like completions or diagnostics. However, it doesn't explicitly differentiate from hypothetical formatting alternatives beyond mentioning 'project-specific formatting settings.'

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 description implies usage context through 'Respects project-specific formatting settings,' suggesting this tool should be used when consistent project formatting is desired. However, it provides no explicit guidance on when to choose this tool versus other LSP tools or when not to use it (e.g., for non-source files).

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/ProfessioneIT/lsp-mcp-server'

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