@workover/mcp 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib.mjs +19 -1
  2. package/package.json +1 -1
package/lib.mjs CHANGED
@@ -170,7 +170,25 @@ export function makeDispatch({ auth, api, apiPost, fetchImpl = fetch, readFile }
170
170
  if (docId === null) return badIdErr('document', args.docId);
171
171
  const d = await api(`/project/doc/${docId}`);
172
172
  if (!d || !d.id) return err(`Document ${docId} not found (or no access).`);
173
- const body = d.bodyText || stripHtml(d.content) || '(empty document)';
173
+ // Prefer the LIVE body, which is the only one with images in it.
174
+ //
175
+ // `bodyText` is plain text kept for search and `content` is only written on a WordPress
176
+ // import, so a document written in the editor read as empty here, and one made of
177
+ // screenshots read as empty EXACTLY — plain text of an image is nothing. An agent that
178
+ // reads "(empty document)" and then edits is working from a blank page that is not blank.
179
+ //
180
+ // Best-effort: an api that predates this route still answers the row.
181
+ let live = null;
182
+ try {
183
+ live = await api(`/project/doc/${docId}/content`);
184
+ } catch {
185
+ live = null;
186
+ }
187
+ const body =
188
+ live?.markdown?.trim() ||
189
+ d.bodyText ||
190
+ stripHtml(d.content) ||
191
+ '(empty document)';
174
192
  return text(`# ${d.title || 'Untitled'} (id ${d.id})\n\n${body}`);
175
193
  }
176
194
  if (name === 'workover_list_projects') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workover/mcp",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Workover MCP server — let Claude Code and other MCP clients read and cowork on your Workover documents.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ScaleMath",