Split Markdown into chunks
chunk_markdownBreak Markdown documents into heading-based chunks for search, embeddings, or RAG, keeping each chunk tied to its source section for accurate retrieval.
Instructions
Split a Markdown file or Markdown text into chunks by heading, for search, embeddings or RAG.
Use this when you need a long Markdown document (docs, notes, a README) broken into pieces that each know where they came from. A chunk never mixes two sections. Each chunk has heading_path (like ["Guide", "Install"]), anchor (the GitHub-style #link), start_line and end_line (1-based, in the file), part and parts (when a big section had to be split), chars and text. Code blocks and tables are kept whole when they fit; when they don't, each piece gets the fence or table header again. Plain code, not AI: same input, same chunks.
Do not use it for PDF or Word files (convert them to Markdown first), to just see the headings (use outline_markdown), or to read one section (use get_section). Sizes are characters, not tokens.
Returns {"source", "total", "start", "chunks": [...], "next_start"}. next_start is null when there are no more chunks.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "chunk_markdown"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Full path to a local Markdown or text file (UTF-8, up to 10 MB). Leave empty if you pass text. | |
| text | No | Markdown text to use instead of a file. Leave empty if you pass path. | |
| limit | No | Most chunks to return in one call. Default 100. | |
| start | No | First chunk number to return (1 = the first). Use next_start from the last call to get more. | |
| max_chars | No | Biggest chunk size in characters (not tokens). Default 1500. | |
| prefix_path | No | If true, each chunk text starts with its heading path, like "Guide > Install". | |
| overlap_chars | No | Characters repeated from the end of one part at the start of the next, only when a section is split. Must be at most half of max_chars. Default 0. |