Skip to main content
Glama

Add NatSpec documentation

natspec_document

Generate NatSpec documentation for Solidity files and return it without modifying source, or write updates in place with a .sol.bak backup or to a separate output file.

Instructions

Generate NatSpec documentation for a Solidity file with kritisi. By default the documented source is returned without touching any file. Set write=true for an in-place update with a .sol.bak backup, or set output to write to a separate file.

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": {
      "path": "<path>"
    },
    "name": "natspec_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesPath to a .sol file
writeNoUpdate the source file in place and keep a .sol.bak backup
outputNoWrite the documented source to this path (implies writing)
providerNoAI provider (default: openrouter)openrouter
overwriteNoAllow replacing an existing output file

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses that the default is non-destructive, that write=true mutates the source but leaves a .sol.bak backup, and that output redirects the result. Gaps remain around provider requirements (API keys/cost) and whether pre-existing NatSpec comments are replaced.

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?

Three sentences, front-loaded with purpose and then the mode ladder; every sentence carries information. Minor deduction for the opaque token "kritisi", which reads as noise or a typo and adds no meaning for the agent.

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?

For a 5-parameter file-mutating tool with no annotations and no output schema, the description covers the destructive-action risk well but omits the provider selection implications and the shape of the returned documented source when nothing is written. Adequate, not complete.

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%, so the schema already documents path, write, output, provider, and overwrite. The description reinforces the write/output interaction but adds little beyond the schema text, and says nothing about the provider enum or overwrite semantics — baseline 3.

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?

"Generate NatSpec documentation for a Solidity file" names a specific verb and resource, so an agent can immediately tell this is a doc-generation task rather than a lint/audit/merge task. It does not explicitly contrast itself with siblings like security_audit or merge_imports, but the resource distinction is unambiguous.

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?

The description clearly states the default mode (documented source returned, no file touched) and the two opt-in paths (write=true for in-place, output for a separate file), which is exactly the decision an agent needs before calling. It stops short of stating when *not* to use it or of naming sibling alternatives, so it is not a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.