Markdown sections chunk

markdown-sections-chunk · version 1.0.0 · Text · free, no key needed

Chunk a CommonMark document into sections at its top-level ATX and setext headings, with levels, paths and spans.

Use when you need to: split markdown into sections by heading · chunk a markdown document at its headings · markdown heading outline with section offsets.

Decide before calling

Read the versioned contract and the supported scope below. Reuse markdown-sections-chunk@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.

Explain the choice

"I can use markdown-sections-chunk@1.0.0 for split markdown into sections by heading. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "markdown": "Intro line\n\n# Guide\nText.\n\nSetup\n-----\n```\n# not a heading\n```\n"
}

Response:

{
  "result": {
    "section_count": 3,
    "heading_count": 2,
    "sections": [
      {
        "index": 0,
        "level": 0,
        "heading": null,
        "heading_kind": null,
        "heading_start_line": null,
        "heading_end_line": null,
        "path": [],
        "start": 0,
        "end": 12,
        "start_line": 1,
        "end_line": 2,
        "text": "Intro line\n\n"
      },
      {
        "index": 1,
        "level": 1,
        "heading": "Guide",
        "heading_kind": "atx",
        "heading_start_line": 3,
        "heading_end_line": 3,
        "path": [
          "Guide"
        ],
        "start": 12,
        "end": 27,
        "start_line": 3,
        "end_line": 5,
        "text": "# Guide\nText.\n\n"
      },
      {
        "index": 2,
        "level": 2,
        "heading": "Setup",
        "heading_kind": "setext",
        "heading_start_line": 6,
        "heading_end_line": 7,
        "path": [
          "Guide",
          "Setup"
        ],
        "start": 27,
        "end": 63,
        "start_line": 6,
        "end_line": 10,
        "text": "Setup\n-----\n```\n# not a heading\n```\n"
      }
    ]
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "markdown-sections-chunk",
  "version": "1.0.0",
  "input": {
    "markdown": "Intro line\n\n# Guide\nText.\n\nSetup\n-----\n```\n# not a heading\n```\n"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/markdown-sections-chunk/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"markdown":"Intro line\n\n# Guide\nText.\n\nSetup\n-----\n```\n# not a heading\n```\n"}'

The machine-readable contract is at /v1/tools/markdown-sections-chunk/versions/1.0.0.

CLI

node cli.mjs run markdown-sections-chunk 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.