Skip to main content
Glama

doc_stats

Read-onlyIdempotent

Count paragraphs, words, characters, headings, tables, comments and tracked changes in a .docx to size documents or find leftover revisions. Optionally add separate counts for notes and headers.

Instructions

Count what the body holds: paragraphs (and empty ones), words, characters, headings, tables, comments, footnotes, tracked changes by type, styles in use and the 20 most used fonts. stories ["notes", "headers"] adds separate counts for notes and for headers/footers (the body counts stay the body's). Use it to size a document or check for leftover revisions; doc.info gives file facts and the hash, revision.list the changes themselves. Read-only; one reply, not paged.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docYesPath to the .docx.
storiesNoStories to read (default ["body"]): "notes" adds footnotes and endnotes, each after the paragraph holding its mark; "headers" adds headers and footers, after the body. Their addresses carry a prefix (fn3/p1#…, hdr1.default/p1#…).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesAlways true on success.
opYesThe operation that ran.
apiYesAPI version (1.0).
docNoThe document read or written: path, sha256 and paragraph count.
nextYesCursor for the next page (pass as cursor), or null.
resultYesWhat the operation returns.
warningsYesThings to know about the result.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.2
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "api": {
      +      "description": "API version (1.0).",
      +      "type": "string"
      +    },
      +    "doc": {
      +      "description": "The document read or written: path, sha256 and paragraph count.",
      +      "properties": {
      +        "characters": {
      +          "description": "text.normalize of a text string: its length.",
      +          "type": "integer"
      +        },
      +        "paragraphs": {
      +          "description": "Body paragraphs.",
      +          "type": "integer"
      +        },
      +        "path": {
      +          "description": "Path of the document.",
      +          "type": "string"
      +        },
      +        "sha256": {
      +          "description": "sha256 of the file (pass as expect.sha256 to a write).",
      +          "type": "string"
      +        },
      +        "source": {
      +          "description": "A .txt/.md/.odt source's format, encoding and split mode; \"text\" for a text string (text.normalize).",
      +          "type": [
      +            "object",
      +            "string"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "next": {
      +      "description": "Cursor for the next page (pass as cursor), or null.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "ok": {
      +      "description": "Always true on success.",
      +      "type": "boolean"
      +    },
      +    "op": {
      +      "description": "The operation that ran.",
      +      "type": "string"
      +    },
      +    "result": {
      +      "description": "What the operation returns.",
      +      "properties": {
      +        "characters": {
      +          "description": "Characters in the body.",
      +          "type": "integer"
      +        },
      +        "comments": {
      +          "description": "Comments.",
      +          "type": "integer"
      +        },
      +        "empty_paragraphs": {
      +          "description": "Body paragraphs with no visible text.",
      +          "type": "integer"
      +        },
      +        "fonts": {
      +          "description": "Fonts named in the body and styles, most used first (top 20).",
      +          "items": {
      +            "description": "A font.",
      +            "properties": {
      +              "font": {
      +                "description": "Font name.",
      +                "type": "string"
      +              },
      +              "uses": {
      +                "description": "References.",
      +                "type": "integer"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "footnotes": {
      +          "description": "Footnotes.",
      +          "type": "integer"
      +        },
      +        "headings": {
      +          "description": "Heading paragraphs.",
      +          "type": "integer"
      +        },
      +        "paragraphs": {
      +          "description": "Body paragraphs.",
      +          "type": "integer"
      +        },
      +        "revisions": {
      +          "description": "Tracked changes in the body.",
      +          "properties": {
      +            "by_type": {
      +              "description": "Revision type -> count.",
      +              "type": "object"
      +            },
      +            "total": {
      +              "description": "All of them.",
      +              "type": "integer"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "stories": {
      +          "description": "With stories: the same counts for notes and for headers/footers.",
      +          "properties": {
      +            "headers": {
      +              "description": "Counts for one story kind.",
      +              "properties": {
      +                "characters": {
      +                  "description": "Characters.",
      +                  "type": "integer"
      +                },
      +                "paragraphs": {
      +                  "description": "Paragraphs.",
      +                  "type": "integer"
      +                },
      +                "stories": {
      +                  "description": "Stories (notes, or header/footer parts).",
      +                  "type": "integer"
      +                },
      +                "words": {
      +                  "description": "Words.",
      +                  "type": "integer"
      +                }
      +              },
      +              "type": "object"
      +            },
      +            "notes": {
      +              "description": "Counts for one story kind.",
      +              "properties": {
      +                "characters": {
      +                  "description": "Characters.",
      +                  "type": "integer"
      +                },
      +                "paragraphs": {
      +                  "description": "Paragraphs.",
      +                  "type": "integer"
      +                },
      +                "stories": {
      +                  "description": "Stories (notes, or header/footer parts).",
      +                  "type": "integer"
      +                },
      +                "words": {
      +                  "description": "Words.",
      +                  "type": "integer"
      +                }
      +              },
      +              "type": "object"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "styles_in_use": {
      +          "description": "Distinct styles used.",
      +          "type": "integer"
      +        },
      +        "tables": {
      +          "description": "Tables (w:tbl), nested included.",
      +          "type": "integer"
      +        },
      +        "words": {
      +          "description": "Words in the body (whitespace-separated).",
      +          "type": "integer"
      +        }
      +      },
      +      "required": [
      +        "paragraphs",
      +        "empty_paragraphs",
      +        "words",
      +        "characters",
      +        "headings",
      +        "tables",
      +        "comments",
      +        "revisions",
      +        "footnotes",
      +        "styles_in_use",
      +        "fonts"
      +      ],
      +      "type": "object"
      +    },
      +    "warnings": {
      +      "description": "Things to know about the result.",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "api",
      +    "ok",
      +    "op",
      +    "result",
      +    "warnings",
      +    "next"
      +  ],
      +  "type": "object"
      +}
  2. Addedv0.1.3

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint and openWorldHint=false, so the safety profile is covered before the description starts. The description still adds genuine behavioral context: 'one reply, not paged' (a pagination guarantee) and the scoping rule that requesting notes/headers does not change the body counts. It does not discuss cost, limits, or behavior with malformed files, so it is solid but not rich.

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?

Front-loaded with the counted resource, then the parameter caveat, then the routing sentence, then the operational note – a logical order with no filler sentences. The long enumeration of counted items is dense but each item earns its place because it defines the tool's surface; slightly heavy for a single paragraph.

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

Completeness5/5

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

An output schema exists, so the return shape need not be described, and the description still pre-announces the returned categories and the non-paged single reply. Combined with annotations covering safety and idempotency, an agent has everything needed to select and call this tool.

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 goes further by explaining the semantics of 'stories' that the schema only implies – that notes and headers are counted separately and 'the body counts stay the body's'. The schema supplies the address-prefix detail for the extra stories, so the description sensibly does not repeat it.

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 (count) and resource (body contents of a .docx) and enumerates exactly what is counted: paragraphs, empty paragraphs, words, characters, headings, tables, comments, footnotes, tracked changes by type, styles, top fonts. It is clearly distinguishable from the listed siblings doc.info (file facts/hash) and revision.list (the changes themselves).

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?

Explicitly names two use cases ('size a document or check for leftover revisions') and routes the agent to the right alternatives with the differentiator for each: doc.info for file facts and hash, revision.list for the changes themselves. That is when-to-use plus when-to-use-something-else.

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