fix: real BookStack search syntax for recent-changes + book-scoped search (v5.2.2) - #15
Merged
Merged
Conversation
…d page search
Two tools passed BookStack search-filter tokens that do not exist, which
BookStack silently ignores — so both returned unfiltered, wrong data:
- getRecentChanges used {updated_at:>=DATE} (no such token; returned the entire
wiki, ~2681 items, mislabeled as recent). Now {updated_after:DATE}. Also dropped
the dead sort= query param (/search ignores it) and sort results newest-first
client-side; report the true match total plus a returned count.
- searchPages injected {book_id:X} to scope a search to a book, but that token is
ignored too, so scoped searches leaked every book's pages. BookStack search has
no book-scoping token, so over-fetch and filter client-side on book_id.
Bumps version to 5.2.2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two MCP tools passed BookStack search-filter tokens that don't exist. BookStack silently drops unknown
{...}filters, so both tools returned unfiltered, wrong data (same class as the recent OOM/stall work — a bug surfaced by a real "what changed last week?" query returning the entire wiki).Fixes (
src/bookstack-client.ts)getRecentChangesused{updated_at:>=DATE}— no such token; BookStack returned the whole wiki (~2681 items) mislabeled as "recent". Live check:{updated_at:>=2026-07-13}→ 2681 vs correct{updated_after:2026-07-13}→ 15.{updated_after:DATE}; dropped the deadsortquery param (/searchignores it) and sort newest-first client-side; report the true matchtotal+ areturnedcount.searchPagesinjected{book_id:X}to scope to a book — also ignored, so scoped searches leaked other books' pages (live:{book_id:1},{book_id:999999}, and no filter all returned 1937). BookStack search has no book-scoping token, so over-fetch and filter client-side onbook_id(best-effort past the 500-result ceiling, but every returned result truly belongs to the book).Verification
npm run type-check+npm run buildclean.{updated_after:}with no deadsortand newest-first order; search-pages emits no{book_id:}token and returns only the requested book; slug-cache cross-session sharing still holds.Found but NOT fixed here (needs a decision)
The Comments API (
get_commentsetc.) returns HTTP 404 onbookstack.teamgleim.com— it requires BookStack v25.11+ and the instance predates it. Environmental, not a syntax bug: either upgrade BookStack or gate/hide those tools. Flagged separately.