feat: optional name field, AI-optimized descriptions, auto-name generation (v1.4.0)#11
feat: optional name field, AI-optimized descriptions, auto-name generation (v1.4.0)#11Puma7 wants to merge 21 commits intolucaguindani:developmentfrom
Conversation
…tions
- Remove required: true from name field on Create operations for Page,
Book, Chapter, and Shelf resources
- Add generateFallbackName() method that auto-generates names from
content (HTML/markdown headings for pages, description for others,
timestamp as final fallback)
- Update node description to communicate BookStack hierarchy
(Shelves > Books > Chapters > Pages)
- Enrich all operation action texts and field descriptions for better
AI agent guidance via MCP (move semantics, search syntax, tag usage)
- Update Global Search description with BookStack advanced filter syntax
({type:page}, {tag:name}, {in_name:text}, {in_body:text})
This enables AI agents to create and organize BookStack content without
requiring manual name input, and provides clear guidance for token-efficient
navigation of the content hierarchy.
https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
- Bump version from 1.3.0 to 1.4.0 - Add v1.4.0 changelog entry documenting all new features - Add CLAUDE.md project knowledge base for AI-assisted development (covers architecture, API reference, workflow patterns, and pitfalls) https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
…trategy Addresses issues found in QA regression audit: - Limit HTML text extraction to first 2000 chars to avoid expensive regex on large documents (performance fix) - Add decodeHtmlEntities() to prevent names like " " or "&" from auto-generated page titles - Reorder name extraction to try Markdown BEFORE HTML (markdown is the preferred format for AI workflows) - Update page field descriptions to clearly recommend Markdown over HTML (~3x fewer tokens, more AI-efficient) - Add "Do NOT set both html and markdown" guidance to prevent undefined behavior - Update CLAUDE.md with Markdown-first policy and pitfall notes https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
…ions Prevents AI agents from accidentally loading entire BookStack instances (which could cost millions of tokens on large instances). Changes across all description files: - Node description: encodes Search → Get by ID → Update/Create strategy - Search action: explicitly states it returns only IDs and previews - Search query: documents 3-step workflow (search → get → update) - Get Many actions: WARNING to use Search instead on large instances - Get (single) actions: positioned as follow-up step after Search - Return All: WARNING about catastrophic token usage on large datasets - Limit: guidance to keep low (10-20) and use Search instead - Deep Dive: WARNING about N+1 API calls, recommend small limits - ListOperations: Return All and Limit warnings for shared use - CLAUDE.md: token cost comparison table and ALWAYS/NEVER rules https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
… generation Add .trim() check before returning extracted heading or first line from markdown content. Prevents empty string being sent as page name to BookStack API (which requires a non-empty name). Found during final QA dry check. https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
- Create KNOWN_ISSUES.md documenting 16 pre-existing issues found during QA audit (4 MEDIUM, 8 LOW, 4 INFO - none from v1.4.0) - Update CHANGELOG.md with complete v1.4.0 feature and QA sections - Update CLAUDE.md with QA learnings: known issues summary, new pitfalls (new Bookstack() pattern, audit-log sort, decodeHtmlEntities limitations, NodeApiError detection), updated version history https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
…scriptions Action texts are shown as dropdown labels in the n8n UI and should be short and clean. The long warnings and navigation hints were cluttering the operation picker. Moved all AI guidance to field-level description properties where they belong (visible to AI agents via MCP, but not cluttering the UI dropdown). Before: "List pages (WARNING: use Search instead to find pages...)" After: "Get many pages" AI guidance remains in: node description, field descriptions for Search Query, Return All, Limit, Deep Dive, and CLAUDE.md. https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
Each tool description must be self-contained so an LLM knows exactly how to use it without external context. Key improvements: - Node description: explains full hierarchy (Shelves > Books > Chapters > Pages) and the Search → Get → Update workflow strategy - Get operations: describe what the response CONTAINS (e.g. "returns book with contents array listing chapters and pages") - Page Create: clarifies EITHER book_id OR chapter_id (not both) - Page Create: instructs AI to generate descriptive titles - Search: documents exact response fields (id, name, type, url, preview_html, tags) and provides query example with filters - Move semantics: clarifies that moving removes from current location - Filter fields: lists available field names (name, created_at, etc.) https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
Simulated an LLM using the tools for 10 real tasks and found gaps
where the LLM would have to guess. Fixes:
1. Tags: remove misleading name:value examples (code doesn't split
on colon - known issue). Use simple tag names instead.
2. Tags: document that update REPLACES all existing tags.
3. Markdown/HTML: document that update REPLACES entire content.
To append, first Get, merge, then Update.
4. Page move: clarify that setting chapter_id alone is sufficient
(no need to clear book_id).
5. Delete: document cascading behavior in node description (deleting
a book deletes all chapters and pages).
6. Search: clarify that Content Type Filter is auto-appended, do NOT
also add {type:...} manually to avoid double filtering.
7. Search: remove confusing {tag:name=value} example (doesn't work
with current tag implementation).
8. HTML field: document same replace-on-update semantics as markdown.
https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
Document recommended pattern where AI agents move unwanted content to an Archive shelf instead of deleting it permanently. A human can then review and delete manually from the archive. - CLAUDE.md: full archive workflow documentation with setup steps and tool usage for archiving pages, chapters, and books - Node description: brief "prefer moving to Archive shelf" hint - Covers shelf many-to-many book list management for archiving books Delete remains available as a tool - the recommendation is advisory, not enforced. Each user decides their own risk tolerance. https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
Findings from final QA audit with 3 parallel review agents: - Fix Attachment action texts: bare "Create" → "Create an attachment" (consistent with all other resources, important for AI/MCP) - Fix Image action texts: bare "Create" → "Create an image" - Fix Search limit placeholder: "100" → "20" (was contradicting the description guidance "keep low 5-20") - Document 2 new known issues: requiresDataPath on search query (#17), missing continueOnFail() support (#18) Total known issues: 18 (all pre-existing, none from v1.4.0) https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
- Remove duplicate "Add CLAUDE.md" line from CHANGELOG.md - Document known issue #19: multipart handler missing try/catch (attachment/image errors show raw unformatted messages) - Document known issue #20: redundant credential null checks - Update CLAUDE.md known issues count to 20 https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
The filter field description only listed 5 example fields. LLMs need the full list to know their options. Now documents all available fields grouped by resource: common fields (id, name, slug, created_at, etc.) and resource-specific fields (book_id, chapter_id, draft, template, priority, uploaded_to). https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
Add findings from final regression test that were not yet documented: - #21: !body.name falsy check too broad (v1.4.0, MEDIUM) - #22: required:true removal = silent accept for manual users (v1.4.0, MEDIUM) - #23: Page ID description misleading for delete (v1.4.0, LOW) - #24: README typo "lunch" → "launch" (pre-existing, LOW) Update header to distinguish v1.4.0 introductions from pre-existing issues. https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
…back Every tool description now documents: - Get: exact response fields (id, name, slug, created_at, tags[], etc.) - Get: child arrays with their shapes (contents[], pages[], books[]) - Create: confirms response contains the new id - Update: confirms response contains the updated object - Delete: confirms empty response on success - Search: fix field name (preview not preview_html), add empty=no matches Before: LLMs had to guess what the API returns. After: LLMs know exact field names for every operation. https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
1. Fix !body.name → (body.name === undefined || body.name === '')
Prevents edge case where falsy values like 0 would trigger fallback.
2. Fix tags to support name:value pairs - "topic:networking" now
produces {name: "topic", value: "networking"} instead of
{name: "topic:networking"}. BookStack {tag:name=value} search
now works correctly. This was Known Issue lucaguindani#1 - now fixed.
3. Shorten node description from 405 → 270 chars to prevent
potential UI truncation while keeping all key information.
Known Issues lucaguindani#1, #21, #23 marked as FIXED in v1.4.0.
Tag descriptions updated to show name:value examples again.
https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
Filter out empty tags from whitespace-only input, double commas,
and trailing whitespace. Drop empty values (e.g. "name:" becomes
{name: "name"} without an empty value field).
Edge cases now handled:
- " " (whitespace) → [] (empty array, no crash)
- "tag1,,tag2" (double comma) → [{name:"tag1"},{name:"tag2"}]
- "name:" (empty value) → {name:"name"} (no empty value sent)
- "a:b:c" (multiple colons) → {name:"a", value:"b:c"}
https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
Update CLAUDE.md with learnings from cross-referencing BookStack API docs, n8n tool system, and our implementation: - Tags pitfall updated: now documents name:value split and edge cases - New pitfall lucaguindani#12: IDs sent as strings (PHP coerces, but fragile) - New pitfall lucaguindani#13: search preview_html is object, not string - New pitfall lucaguindani#14: description_html exists but node only uses plaintext - New pitfall #15: API max pagination count is configurable per instance KNOWN_ISSUES.md updated with 3 new findings (#25-#27): - ID fields as strings instead of integers - Search preview_html shape mismatch - Missing API fields (description_html, priority, cover, chapter templates) Total: 27 known issues (3 fixed in v1.4.0, 24 remaining). https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
|
I ran into a practical issue when using the BookStack node as an AI agent tool via MCP in n8n: So I went ahead and made Key changes:
Important: This has been tested in a local dev environment (Docker + Happy to discuss any of the changes or adjust things if needed! |
|
lgtm |
Suggested workflow for this PR
Optional: automate with GitHub ActionsIf you'd like to automate this in the future, you can add a GitHub Actions workflow that automatically publishes to npm when you create a GitHub Release:
This way you'd never have to run More details on dist-tags: https://docs.npmjs.com/adding-dist-tags-to-packages n8n's GUI "Update" button only checks the |
|
Hello @Puma7, thanks for your PR and your interest in this community node! Unfortunately I do not agree with @daviserez review. I have a few thoughts before we can consider merging. Multiple features in a single PRThis PR bundles several independent changes together. Each PR should ideally be limited to a single feature or concern to ensure clarity, easier review, and better traceability. I'd suggest splitting this into three separate PRs:
Also, please do not bump the version number in package.json, this will be done upon release. 1. Make
|
The n8n framework does not show the "Defined automatically by the model" button on fields named "name" (likely an internal n8n restriction). This means AI agents cannot dynamically generate page titles via $fromAI. Workaround: Add a new field "Page Title (AI)" (parameter name: page_title) that DOES get the $fromAI button. When set, it overrides the Name field and is mapped to the API's "name" parameter. The page_title field is removed from the request body before sending (BookStack API only knows "name"). Priority: page_title > name > generateFallbackName > timestamp https://claude.ai/code/session_019hMoW1VKjD6QL4q7CcErjQ
Update: Found the root cause — n8n doesn't show the $fromAI button for fields named "name"I did some testing and I think I found the actual issue. It seems like n8n internally To verify this, I added a second field called As you can see:
So the issue appears to be an n8n framework limitation specifically with the parameter The question: how should we handle this?Right now my fork has both fields, where Option A: Add
Option B: Rename the original field from
Option C: Keep only
What would be your preferred approach? I'm happy to adjust the PR accordingly. Update 1:
|
|
Thanks for digging into this, that's a really useful finding and it explains the original motivation for the PR much better. This does look like an n8n framework limitation. The parameter On your three options:
So for now, I think option C is the way to go. If n8n confirms it's a bug and fixes it, no change is needed on our side. If they consider it a limitation with a recommended workaround, we can revisit at that point. |
|
@lucaguindani I'll wait for n8n's response before making any further changes here. Once we know if it's a bug they'll fix or a permanent limitation, we can decide on the best approach for this node. Thanks for your patience and the helpful feedback on the PR! |
|
Looks like the issue was fixed by n8n (n8n-io/n8n#28763). Should be available in the next releases ! @Puma7 I'll closed this PR since no change is needed on our end, but you're welcome to make a new one for the tags |
@lucaguindani thanks again for the clarification and for closing the loop on this. It is great to hear that n8n has fixed the name field issue on their side. I will definitely keep looking at your BookStack integration, because I still find the overall direction very interesting. My broader use case is a bit bigger than “books” in the classic sense: I am thinking more about long-term life documentation and practical knowledge management. For example, there are all kinds of small but important pieces of information you may want to preserve over many years, such as where a certain power cable runs in a house, which cross-sections were used, what was changed over time, family-related information, technical notes, procedures, and so on. The same idea also applies to companies that want to store operational knowledge in a structured and durable way. My original concept was to have an “inbox” where you can throw information at an AI, and the AI then sorts it into the right place in BookStack automatically. In that sense, BookStack looked very attractive as a human-readable knowledge base. After more testing, though, I am no longer fully sure whether BookStack is the ideal long-term foundation for that kind of workflow. My current impression is that for reliable later retrieval, especially with AI, you probably need a proper RAG or hybrid search layer rather than trying to query the BookStack database more directly through an agent. Also, writing new information back into BookStack in a token-efficient way is not trivial, because in many cases you are effectively replacing or resubmitting whole pages instead of appending or patching very precisely. That is why I increasingly understand why many people prefer a simpler markdown-on-filesystem approach: it is easier to version, easier to patch line-by-line, and often easier to integrate into AI workflows. Still, I have not reached a final conclusion yet. I think a lot of people are currently exploring the same question: what is the simplest and most durable way to store knowledge over decades so that both humans and AI systems can find and use it well? So I am not at the end of that journey yet, but I am very curious to see how this ecosystem evolves. BookStack may still be part of that picture, even if perhaps not as the only layer. Thanks again for your feedback and for maintaining the project. |



Summary
This PR improves the BookStack node for AI agent / MCP usage by making the
namefield optional on Create operations and significantly improving all tool descriptions so that LLMs can use the BookStack tools correctly and token-efficiently.Key changes:
namefield is no longer required for Page, Book, Chapter, and Shelf creation. When omitted, the node auto-generates a name from the content (markdown headings, first text line, description, or timestamp fallback).KNOWN_ISSUES.md(20 pre-existing issues documented), updatedCLAUDE.md(project knowledge base for AI-assisted development), and comprehensiveCHANGELOG.md.Files changed:
nodes/Bookstack/Bookstack.node.ts— auto-name generation logic (generateFallbackName,decodeHtmlEntities), updated node descriptionnodes/Bookstack/descriptions/*.ts— all 9 description files updated with improved field descriptions and consistent action textsCLAUDE.md— new project knowledge base for LLM-assisted developmentKNOWN_ISSUES.md— 20 pre-existing issues documented during QA auditCHANGELOG.md— complete v1.4.0 changelogpackage.json— version bump to 1.4.0Important: Testing status & recommendation
I was unable to test this in my live n8n environment directly. The changes work correctly in the dev environment (TypeScript compiles, node loads, operations are visible in the UI), but I strongly recommend the following before merging to main:
Test in a real n8n instance with an actual BookStack connection:
Consider publishing as a beta/pre-release version first (e.g.,
1.4.0-beta.1on npm) so users can test before it becomes the default. If n8n community nodes support pre-release tags, this would allow early adopters to opt in vianpm install n8n-nodes-bookstack@betawhile the stable version remains on 1.3.0.No breaking changes were introduced — all existing workflows that provide a name on Create will continue to work identically. The only behavioral difference is that omitting the name now succeeds (with auto-generation) instead of being blocked by the UI.
Motivation
When using BookStack as an AI Agent tool via MCP in n8n, the AI was forced to ask the user for a name on every Create operation because
namewas marked asrequired. This broke the automated workflow where an AI agent should be able to create, organize, and manage BookStack content autonomously (e.g., receiving notes via webhook, searching for the right location, and filing them automatically).The improved descriptions also ensure that any LLM using these tools knows:
QA audit results
Three independent automated QA audits were performed covering:
Result: 0 critical issues, 0 regressions from v1.4.0 changes. 20 pre-existing issues were found and documented in
KNOWN_ISSUES.md(none introduced by this PR).Hope to her from you :)