Skip to main content
Glama

generate_toc

Read-onlyIdempotent

Generate a formatted table of contents from Markdown with indented links to each heading. Handles duplicate slugs automatically and supports depth limits from 1-6.

Instructions

Generate a Table of Contents from Markdown headings. Returns a Markdown-formatted TOC with indented links to each heading. Handles duplicate heading slugs. The max_depth parameter controls the deepest heading level to include.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
markdownYesThe Markdown text to generate a TOC from.
max_depthNoMaximum heading depth to include (1-6, default: 6).
Behavior4/5

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

Adds valuable behavioral details not present in annotations: output format specifics ('Markdown-formatted TOC with indented links') and special handling logic ('Handles duplicate heading slugs'). Complements the readOnly/idempotent annotations by describing the transformation behavior without contradicting safety hints.

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?

Four tightly constructed sentences: purpose declaration, output specification, behavioral note on duplicates, and parameter guidance. Front-loaded with essential information; no filler content. Excellent information density.

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?

Compensates well for missing output schema by explicitly describing return format. Complete coverage of the two parameters with 100% schema coverage. Only gap is lack of explicit sibling differentiation given the server's large collection of document processing tools.

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 has 100% description coverage setting baseline at 3. Description adds redundant but clarifying phrasing for max_depth ('deepest heading level'), reinforcing the schema's intent without adding substantial new semantic information about parameter usage or constraints.

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?

Description uses specific verb 'Generate' with clear resource 'Table of Contents' and source 'Markdown headings'. Effectively distinguishes from sibling convert/extract tools by specifying its unique purpose (TOC generation with links).

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?

Provides clear context about what the tool produces (indented links TOC) and input requirements (Markdown headings), but lacks explicit guidance on when to choose this over similar siblings like extract_structure. Usage is implied but not explicitly contrasted with alternatives.

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/XJTLUmedia/MCP_Markdown_Formatter'

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