Search broken on Docmost 0.25+ — data.items[] API change #8

Closed
opened 2026-05-19 13:31:51 -06:00 by NappyXIII · 0 comments
NappyXIII commented 2026-05-19 13:31:51 -06:00 (Migrated from github.com)

Bug

The search tool throws items.map is not a function on Docmost 0.25.0+.

Root Cause

Docmost changed the search API response format in v0.25.0 (February 2026):

  • Before 0.25.0: response.data.data was a direct array
  • After 0.25.0: response.data.data is now an object { items: [...], meta: {...} }

Reference: https://github.com/docmost/docmost/discussions/1903

In build/index.js line 227, the comment even acknowledges the old assumption:

// Filter search results (data is directly an array)
const items = response.data?.data || [];
const filteredItems = items.map((item) => filterSearchResult(item));

items.map fails because items is now { items: [...] } not an array.

Fix

const data = response.data?.data;
const items = Array.isArray(data) ? data : data?.items || [];
const filteredItems = items.map((item) => filterSearchResult(item));

This handles both old and new API formats for backwards compatibility.

Environment

  • docmost-mcp: 1.0.1
  • Docmost: 0.80.2 (API change introduced in 0.25.0)
## Bug The `search` tool throws `items.map is not a function` on Docmost 0.25.0+. ## Root Cause Docmost changed the search API response format in v0.25.0 (February 2026): - **Before 0.25.0:** `response.data.data` was a direct array - **After 0.25.0:** `response.data.data` is now an object `{ items: [...], meta: {...} }` Reference: https://github.com/docmost/docmost/discussions/1903 In `build/index.js` line 227, the comment even acknowledges the old assumption: ```js // Filter search results (data is directly an array) const items = response.data?.data || []; const filteredItems = items.map((item) => filterSearchResult(item)); ``` `items.map` fails because `items` is now `{ items: [...] }` not an array. ## Fix ```js const data = response.data?.data; const items = Array.isArray(data) ? data : data?.items || []; const filteredItems = items.map((item) => filterSearchResult(item)); ``` This handles both old and new API formats for backwards compatibility. ## Environment - docmost-mcp: 1.0.1 - Docmost: 0.80.2 (API change introduced in 0.25.0)
Sign in to join this conversation.