@wienerberliner/pi-markdown-reader

Pi extension tools for deterministic, structure-aware Markdown outline and section reading.

Packages

Package details

extension

Install @wienerberliner/pi-markdown-reader from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@wienerberliner/pi-markdown-reader
Package
@wienerberliner/pi-markdown-reader
Version
0.3.0
Published
Jul 10, 2026
Downloads
877/mo · 237/wk
Author
wienerberliner
License
MIT
Types
extension
Size
19.6 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-markdown-reader

Pi extension tools for deterministic, structure-aware Markdown reading.

Instead of sampling long Markdown files with brittle line ranges, agents can inspect a compact outline first, then read complete sections by exact pathSlug.

Install

Install the published npm package:

pi install npm:@wienerberliner/pi-markdown-reader

Package: @wienerberliner/pi-markdown-reader

Then restart Pi or run /reload.

Tools

markdown_outline

Returns a flat, source-ordered table of contents for a Markdown file.

By default the output is intentionally compact:

  • heading level
  • hierarchical pathSlug
  • optional frontmatter entry as { "level": 0, "pathSlug": "frontmatter" }

Example:

{
  "path": "report.md"
}

Use verbose mode when the agent needs line numbers for other tools:

{
  "path": "report.md",
  "verbose": true
}

Verbose mode adds titles, frontmatter keys, startLine, endLine, lineCount, and totalLines.

markdown_read

Reads one or more complete Markdown sections by exact pathSlug.

If a request includes both a heading and one of its descendant subheadings, markdown_read returns the ancestor content once and omits the redundant descendant selection.

The LLM-facing result is plain Markdown text. Metadata stays in tool details.

Example:

{
  "path": "report.md",
  "sections": [
    { "pathSlug": "abstract" },
    { "pathSlug": "results/evidence" }
  ]
}

If a document has YAML frontmatter, it can be read with:

{ "pathSlug": "frontmatter" }

Development

npm install
npm test
npm run typecheck

For local Pi development in this repository, trust the project and reload Pi. The project .pi/settings.json shadows the published npm package and loads the local checkout.

Publishing

Pushing a commit to main with a new package.json version automatically publishes that version to npm. If the version is already published, the workflow skips npm publish.

The workflow uses npm Trusted Publishing, so npm package settings must allow GitHub Actions for dasomji/pi-markdown-reader and workflow publish.yml.

License

MIT