ofw-mcp 2.28.1 → 2.29.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/dist/bundle.js +183 -8
- package/dist/tools/messages.js +15 -5
- package/dist/tools/plain-text.js +211 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/skills/ofw/SKILL.md +4 -2
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "OurFamilyWizard tools for Claude Code",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.29.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"displayName": "OurFamilyWizard",
|
|
15
15
|
"source": "./",
|
|
16
16
|
"description": "OurFamilyWizard co-parenting tools for Claude — messages, calendar, expenses, and journal via MCP",
|
|
17
|
-
"version": "2.
|
|
17
|
+
"version": "2.29.0",
|
|
18
18
|
"author": {
|
|
19
19
|
"name": "Chris Chall"
|
|
20
20
|
},
|
package/dist/bundle.js
CHANGED
|
@@ -47852,7 +47852,7 @@ function describeTokenlessLogin(record2) {
|
|
|
47852
47852
|
|
|
47853
47853
|
// src/version.ts
|
|
47854
47854
|
var SERVER_NAME = "ofw-mcp";
|
|
47855
|
-
var VERSION = "2.
|
|
47855
|
+
var VERSION = "2.29.0";
|
|
47856
47856
|
|
|
47857
47857
|
// src/auth.ts
|
|
47858
47858
|
function fetchproxyDisabled() {
|
|
@@ -51821,6 +51821,174 @@ function withPaginationFirst(input2) {
|
|
|
51821
51821
|
return { ...head, ...body, ...head };
|
|
51822
51822
|
}
|
|
51823
51823
|
|
|
51824
|
+
// src/tools/plain-text.ts
|
|
51825
|
+
var CHANGE_ORDER = [
|
|
51826
|
+
"headings",
|
|
51827
|
+
"bold/italic",
|
|
51828
|
+
"links",
|
|
51829
|
+
"list markers",
|
|
51830
|
+
"list numbering",
|
|
51831
|
+
"list indentation"
|
|
51832
|
+
];
|
|
51833
|
+
var PH_OPEN = "\uE000";
|
|
51834
|
+
var PH_CLOSE = "\uE001";
|
|
51835
|
+
var PLACEHOLDER = /(\d+)/g;
|
|
51836
|
+
function convertInline(line, changes) {
|
|
51837
|
+
if (line.includes(PH_OPEN) || line.includes(PH_CLOSE)) return line;
|
|
51838
|
+
const kept = [];
|
|
51839
|
+
const protect = (s2) => `${PH_OPEN}${kept.push(s2) - 1}${PH_CLOSE}`;
|
|
51840
|
+
let s = line.replace(/(`+)[^`]+?\1(?!`)/g, protect);
|
|
51841
|
+
const beforeLinks = s;
|
|
51842
|
+
s = s.replace(/<(https?:\/\/[^\s<>]+)>/g, (_m, url2) => protect(url2));
|
|
51843
|
+
s = s.replace(/!?\[([^\]\n]+)\]\(([^)\s]+)\)/g, (_m, text, url2) => {
|
|
51844
|
+
const bare = (u) => u.replace(/^https?:\/\//, "").replace(/\/$/, "");
|
|
51845
|
+
return bare(text) === bare(url2) ? protect(url2) : `${text} (${protect(url2)})`;
|
|
51846
|
+
});
|
|
51847
|
+
if (s !== beforeLinks) changes.add("links");
|
|
51848
|
+
s = s.replace(/https?:\/\/\S+/g, protect);
|
|
51849
|
+
const beforeEmphasis = s;
|
|
51850
|
+
s = s.replace(/\*\*(?=\S)(.+?)(?<=\S)\*\*/g, "$1");
|
|
51851
|
+
s = s.replace(/(?<![\w_])__(?=\S)(.+?)(?<=\S)__(?![\w_])/g, "$1");
|
|
51852
|
+
s = s.replace(/(?<![\w*])\*(?![\s*])(.+?)(?<![\s*])\*(?![\w*])/g, "$1");
|
|
51853
|
+
s = s.replace(/(?<![\w_])_(?![\s_])(.+?)(?<![\s_])_(?![\w_])/g, "$1");
|
|
51854
|
+
if (s !== beforeEmphasis) changes.add("bold/italic");
|
|
51855
|
+
while (s.includes(PH_OPEN)) {
|
|
51856
|
+
s = s.replace(PLACEHOLDER, (_m, i) => kept[Number(i)]);
|
|
51857
|
+
}
|
|
51858
|
+
return s;
|
|
51859
|
+
}
|
|
51860
|
+
var HEADING = /^ {0,3}#{1,6}[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/;
|
|
51861
|
+
var FENCE = /^ {0,3}(`{3,}|~{3,})/;
|
|
51862
|
+
var ITEM = /^([ \t]*)([-*+]|\d{1,9}[.)]|[a-z]{1,2}[.)])([ \t]+)(\S.*)$/;
|
|
51863
|
+
function indentWidth(ws) {
|
|
51864
|
+
let n = 0;
|
|
51865
|
+
for (const ch of ws) n += ch === " " ? 4 : 1;
|
|
51866
|
+
return n;
|
|
51867
|
+
}
|
|
51868
|
+
function alphaIndex(token) {
|
|
51869
|
+
let n = 0;
|
|
51870
|
+
for (const ch of token) n = n * 26 + (ch.charCodeAt(0) - 96);
|
|
51871
|
+
return n;
|
|
51872
|
+
}
|
|
51873
|
+
function toAlpha(n) {
|
|
51874
|
+
let s = "";
|
|
51875
|
+
for (let k = Math.max(1, n); k > 0; k = Math.floor((k - 1) / 26)) {
|
|
51876
|
+
s = String.fromCharCode(97 + (k - 1) % 26) + s;
|
|
51877
|
+
}
|
|
51878
|
+
return s;
|
|
51879
|
+
}
|
|
51880
|
+
function markdownToPlainText(input2) {
|
|
51881
|
+
const eol = input2.includes("\r\n") ? "\r\n" : "\n";
|
|
51882
|
+
const lines = input2.split(/\r?\n/);
|
|
51883
|
+
const out = [...lines];
|
|
51884
|
+
const changes = /* @__PURE__ */ new Set();
|
|
51885
|
+
const runs = [];
|
|
51886
|
+
let fence = null;
|
|
51887
|
+
let stack = [];
|
|
51888
|
+
let prevBlank = true;
|
|
51889
|
+
const endList = () => {
|
|
51890
|
+
stack = [];
|
|
51891
|
+
};
|
|
51892
|
+
lines.forEach((line, i) => {
|
|
51893
|
+
if (fence !== null) {
|
|
51894
|
+
if (line.trimStart().startsWith(fence)) fence = null;
|
|
51895
|
+
return;
|
|
51896
|
+
}
|
|
51897
|
+
const fenceOpen = FENCE.exec(line);
|
|
51898
|
+
if (fenceOpen) {
|
|
51899
|
+
fence = fenceOpen[1];
|
|
51900
|
+
endList();
|
|
51901
|
+
prevBlank = false;
|
|
51902
|
+
return;
|
|
51903
|
+
}
|
|
51904
|
+
if (line.trim() === "") {
|
|
51905
|
+
prevBlank = true;
|
|
51906
|
+
return;
|
|
51907
|
+
}
|
|
51908
|
+
const m = ITEM.exec(line);
|
|
51909
|
+
if (m) {
|
|
51910
|
+
const [, ws, marker, sep3, content] = m;
|
|
51911
|
+
const indent = indentWidth(ws);
|
|
51912
|
+
const bullet = /^[-*+]$/.test(marker);
|
|
51913
|
+
const letter = /^[a-z]/.test(marker);
|
|
51914
|
+
const token = bullet ? "" : marker.slice(0, -1);
|
|
51915
|
+
const accepted = letter ? stack.length > 0 && indent >= stack[0].indent + 2 : stack.length > 0 || prevBlank || bullet || token === "1";
|
|
51916
|
+
if (accepted) {
|
|
51917
|
+
const kind = bullet ? "bullet" : "ordered";
|
|
51918
|
+
const start = bullet ? 0 : letter ? alphaIndex(token) : Number(token);
|
|
51919
|
+
const item = { line: i, indent: ws, marker, sep: sep3, content };
|
|
51920
|
+
const newRun = (level) => {
|
|
51921
|
+
const run = { kind, level, start, items: [item] };
|
|
51922
|
+
runs.push(run);
|
|
51923
|
+
return run;
|
|
51924
|
+
};
|
|
51925
|
+
if (stack.length === 0) {
|
|
51926
|
+
stack.push({ indent, run: newRun(0) });
|
|
51927
|
+
} else {
|
|
51928
|
+
while (stack.length > 1 && indent <= stack[stack.length - 1].indent - 2) stack.pop();
|
|
51929
|
+
const top = stack[stack.length - 1];
|
|
51930
|
+
if (indent >= top.indent + 2) {
|
|
51931
|
+
stack.push({ indent, run: newRun(stack.length) });
|
|
51932
|
+
} else if (top.run.kind !== kind) {
|
|
51933
|
+
top.run = newRun(stack.length - 1);
|
|
51934
|
+
} else {
|
|
51935
|
+
top.run.items.push(item);
|
|
51936
|
+
}
|
|
51937
|
+
}
|
|
51938
|
+
prevBlank = false;
|
|
51939
|
+
return;
|
|
51940
|
+
}
|
|
51941
|
+
}
|
|
51942
|
+
if (stack.length > 0 && /^[ \t]/.test(line)) {
|
|
51943
|
+
out[i] = convertInline(line, changes);
|
|
51944
|
+
prevBlank = false;
|
|
51945
|
+
return;
|
|
51946
|
+
}
|
|
51947
|
+
endList();
|
|
51948
|
+
const heading = HEADING.exec(line);
|
|
51949
|
+
if (heading) {
|
|
51950
|
+
out[i] = convertInline(heading[1], changes);
|
|
51951
|
+
changes.add("headings");
|
|
51952
|
+
} else {
|
|
51953
|
+
out[i] = convertInline(line, changes);
|
|
51954
|
+
}
|
|
51955
|
+
prevBlank = false;
|
|
51956
|
+
});
|
|
51957
|
+
for (const run of runs) {
|
|
51958
|
+
const lettered = run.kind === "ordered" && run.level % 2 === 1;
|
|
51959
|
+
const markers = run.items.map((_, k) => {
|
|
51960
|
+
if (run.kind === "bullet") return "-";
|
|
51961
|
+
return `${lettered ? toAlpha(run.start + k) : run.start + k}.`;
|
|
51962
|
+
});
|
|
51963
|
+
const width = Math.max(...markers.map((mk) => mk.length));
|
|
51964
|
+
run.items.forEach((item, k) => {
|
|
51965
|
+
const indent = " ".repeat(4 * run.level);
|
|
51966
|
+
const sep3 = " ".repeat(width - markers[k].length + 1);
|
|
51967
|
+
if (indent !== item.indent) changes.add("list indentation");
|
|
51968
|
+
const origToken = item.marker.replace(/[.)]$/, "");
|
|
51969
|
+
const newToken = markers[k].replace(/\.$/, "");
|
|
51970
|
+
if (run.kind === "bullet" ? item.marker !== "-" : item.marker.endsWith(")")) changes.add("list markers");
|
|
51971
|
+
if (run.kind === "ordered" && origToken !== newToken) changes.add("list numbering");
|
|
51972
|
+
if (sep3 !== item.sep) changes.add(run.kind === "ordered" && width > 2 ? "list numbering" : "list markers");
|
|
51973
|
+
out[item.line] = `${indent}${markers[k]}${sep3}${convertInline(item.content, changes)}`;
|
|
51974
|
+
});
|
|
51975
|
+
}
|
|
51976
|
+
if (changes.size === 0) return { text: input2, changes: [] };
|
|
51977
|
+
return { text: out.join(eol), changes: CHANGE_ORDER.filter((c) => changes.has(c)) };
|
|
51978
|
+
}
|
|
51979
|
+
var BODY_FORMAT_DESCRIPTION = 'How to treat `body`. OurFamilyWizard shows message bodies as PLAIN TEXT \u2014 Markdown is never rendered, so **bold** would reach the co-parent with its asterisks. Default "markdown": Markdown is converted to plain text before anything is saved or sent (bold/italic markers and # heading markers dropped; [text](url) \u2192 "text (url)"; lists normalized to "-" bullets and renumbered 1., 2., \u2026 with a., b. for the second level, 4 spaces per nesting level; code, URLs and ~~strikethrough~~ left as written), and the response reports what changed under bodyConversion. "plain": send the body byte-for-byte. Line breaks, blank lines and leading spaces always survive; full https:// URLs, email addresses and phone numbers become links for the reader.';
|
|
51980
|
+
function prepareBody(body, format) {
|
|
51981
|
+
if (format === "plain") return { body, conversion: null, noteLine: null };
|
|
51982
|
+
const { text, changes } = markdownToPlainText(body);
|
|
51983
|
+
if (changes.length === 0) return { body, conversion: null, noteLine: null };
|
|
51984
|
+
const note = `OurFamilyWizard shows bodies as plain text, so Markdown was converted (${changes.join(", ")}). What was saved/sent is the converted text; pass bodyFormat:"plain" to send a body exactly as written.`;
|
|
51985
|
+
return {
|
|
51986
|
+
body: text,
|
|
51987
|
+
conversion: { changes, note },
|
|
51988
|
+
noteLine: `NOTE: the body was converted from Markdown to plain text (${changes.join(", ")}).`
|
|
51989
|
+
};
|
|
51990
|
+
}
|
|
51991
|
+
|
|
51824
51992
|
// src/tools/messages.ts
|
|
51825
51993
|
var WRITE_VIEW_NOTE = 'compact omits OurFamilyWizard\'s raw `listData` echo (which repeats the body, subject, recipients and a date block) and replaces the body you just wrote with `bodyLength` + `bodySha256` (the first 16 hex characters of its SHA-256) to confirm what landed. Pass "full" for both.';
|
|
51826
51994
|
var DRAFT_KEY_NULL_REASON = "No draftKey: this draft was not saved through this server's cache \u2014 it may have been created in the OurFamilyWizard web app or replaced from another session \u2014 so its lineage is unknown. The next ofw_save_draft on it starts a new key.";
|
|
@@ -52431,6 +52599,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52431
52599
|
inputSchema: external_exports.object({
|
|
52432
52600
|
subject: external_exports.string().describe("Message subject. Required unless draftId/messageId is given (then it overrides the server draft's subject).").optional(),
|
|
52433
52601
|
body: external_exports.string().describe("Message body text. Required unless draftId/messageId is given (then it overrides the server draft's body \u2014 omit it to send exactly what is on OurFamilyWizard).").optional(),
|
|
52602
|
+
bodyFormat: external_exports.enum(["markdown", "plain"]).describe(`${BODY_FORMAT_DESCRIPTION} Applies only to a body passed here: a draft sent by id goes out exactly as it is on OurFamilyWizard.`).optional(),
|
|
52434
52603
|
recipientIds: external_exports.array(external_exports.number()).describe("Array of recipient user IDs (get from ofw_get_profile). Usually required even when sending a draft: OurFamilyWizard does not persist recipients on drafts.").optional(),
|
|
52435
52604
|
replyToId: external_exports.number().describe("ID of the message being replied to. Defaults to the draft's stored reply target when sending by draftId.").optional(),
|
|
52436
52605
|
draftId: external_exports.number().describe("ID of an existing draft to send. The draft is re-read from OurFamilyWizard and its SERVER content is sent; missing subject/body default from it. Guarded: a draft that changed since you read it, or that was already sent/deleted, refuses rather than sending blind.").optional(),
|
|
@@ -52457,7 +52626,8 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52457
52626
|
{ store: blobStore, readBlobs: true }
|
|
52458
52627
|
);
|
|
52459
52628
|
let subject = args.subject;
|
|
52460
|
-
|
|
52629
|
+
const prepared = args.body === void 0 ? null : prepareBody(args.body, args.bodyFormat);
|
|
52630
|
+
let body = prepared?.body;
|
|
52461
52631
|
let recipientIds = args.recipientIds;
|
|
52462
52632
|
let draftReplyToId = null;
|
|
52463
52633
|
let guardNote = null;
|
|
@@ -52534,6 +52704,7 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52534
52704
|
...unresolved.length > 0 ? { recipientNote: `No name on file for user id(s) ${unresolved.join(", ")} \u2014 verify the recipient before approving.` } : {},
|
|
52535
52705
|
subject,
|
|
52536
52706
|
body,
|
|
52707
|
+
...prepared?.conversion ? { bodyConversion: prepared.conversion } : {},
|
|
52537
52708
|
replyTo: resolvedReplyTo === null ? null : { messageId: resolvedReplyTo, subject: replyParent?.subject ?? null, from: replyParent?.fromUser || null },
|
|
52538
52709
|
attachments,
|
|
52539
52710
|
...pending.length > 0 ? { newAttachments: describePending(pending) } : {},
|
|
@@ -52722,10 +52893,11 @@ function registerMessageTools(server, client2, cacheProvider, attachmentIO) {
|
|
|
52722
52893
|
...resolveView(args.view, MESSAGE_VIEWS) === "full" ? persisted : compactSentMessage(persisted),
|
|
52723
52894
|
...attachmentCheck !== null ? { attachments: attachmentCheck } : {},
|
|
52724
52895
|
...newFiles.length > 0 ? { attachmentsUploaded: newFiles } : {},
|
|
52725
|
-
...uploadWarnings.length > 0 ? { warnings: uploadWarnings } : {}
|
|
52896
|
+
...uploadWarnings.length > 0 ? { warnings: uploadWarnings } : {},
|
|
52897
|
+
...prepared?.conversion ? { bodyConversion: prepared.conversion } : {}
|
|
52726
52898
|
};
|
|
52727
52899
|
return notedJsonResponse(
|
|
52728
|
-
[guardNote, rewriteNote, verifyNote, threadNote, attachmentNote, unconfirmedNote, retainNote],
|
|
52900
|
+
[guardNote, rewriteNote, prepared?.noteLine ?? null, verifyNote, threadNote, attachmentNote, unconfirmedNote, retainNote],
|
|
52729
52901
|
responseObj,
|
|
52730
52902
|
"Message sent successfully."
|
|
52731
52903
|
);
|
|
@@ -52903,6 +53075,7 @@ ${jsonText(
|
|
|
52903
53075
|
inputSchema: external_exports.object({
|
|
52904
53076
|
subject: external_exports.string().describe("Message subject"),
|
|
52905
53077
|
body: external_exports.string().describe("Message body text"),
|
|
53078
|
+
bodyFormat: external_exports.enum(["markdown", "plain"]).describe(BODY_FORMAT_DESCRIPTION).optional(),
|
|
52906
53079
|
recipientIds: external_exports.array(external_exports.number()).describe("Array of recipient user IDs (optional for drafts)").optional(),
|
|
52907
53080
|
messageId: external_exports.number().describe("ID of an existing draft to replace (the new draft will have a new id; the old is deleted)").optional(),
|
|
52908
53081
|
replyToId: external_exports.number().nullable().describe("ID of the message this draft replies to. When replacing a draft (messageId), omit it to keep the draft's own reply target, or pass null to make the draft a new top-level message.").optional(),
|
|
@@ -52917,6 +53090,7 @@ ${jsonText(
|
|
|
52917
53090
|
}, async (args) => {
|
|
52918
53091
|
const cache = cacheProvider();
|
|
52919
53092
|
const view = resolveView(args.view, MESSAGE_VIEWS);
|
|
53093
|
+
const prepared = prepareBody(args.body, args.bodyFormat);
|
|
52920
53094
|
const blobStore = args.blobKeys?.length ? blobStoreFromEnv() : void 0;
|
|
52921
53095
|
const pending = await planAttachments(
|
|
52922
53096
|
{ inline: args.inlineAttachments, blobKeys: args.blobKeys },
|
|
@@ -52968,7 +53142,7 @@ ${jsonText(
|
|
|
52968
53142
|
]).filter((id2) => !removed.has(id2));
|
|
52969
53143
|
const payload = {
|
|
52970
53144
|
subject: args.subject,
|
|
52971
|
-
body:
|
|
53145
|
+
body: prepared.body,
|
|
52972
53146
|
recipientIds: args.recipientIds ?? serverRecipientIds ?? [],
|
|
52973
53147
|
attachments: { myFileIDs },
|
|
52974
53148
|
draft: true,
|
|
@@ -52992,7 +53166,7 @@ ${jsonText(
|
|
|
52992
53166
|
let draftKey = null;
|
|
52993
53167
|
const warnings = [...uploadWarnings];
|
|
52994
53168
|
if (newId !== null) {
|
|
52995
|
-
verifyNote = verifyWriteLanded("draft", { subject: args.subject, body:
|
|
53169
|
+
verifyNote = verifyWriteLanded("draft", { subject: args.subject, body: prepared.body }, detail);
|
|
52996
53170
|
const reply = draftReplyTarget([detail], resolvedReplyTo);
|
|
52997
53171
|
const effectiveReplyTo = reply.replyToId;
|
|
52998
53172
|
replyToSource = reply.replyToSource;
|
|
@@ -53085,11 +53259,12 @@ ${jsonText(
|
|
|
53085
53259
|
},
|
|
53086
53260
|
...newFiles.length > 0 ? { attachmentsUploaded: newFiles } : {},
|
|
53087
53261
|
...warnings.length > 0 ? { warnings } : {},
|
|
53088
|
-
...recipientsNote !== null ? { recipientsNote } : {}
|
|
53262
|
+
...recipientsNote !== null ? { recipientsNote } : {},
|
|
53263
|
+
...prepared.conversion !== null ? { bodyConversion: prepared.conversion } : {}
|
|
53089
53264
|
} : raw;
|
|
53090
53265
|
const warnNote = warnings.length > 0 ? `WARNING: ${warnings.join("\n\n")}` : null;
|
|
53091
53266
|
return notedJsonResponse(
|
|
53092
|
-
[forceNote, rewriteNote, verifyNote, warnNote, recipientsNote, replaceNote],
|
|
53267
|
+
[forceNote, rewriteNote, prepared.noteLine, verifyNote, warnNote, recipientsNote, replaceNote],
|
|
53093
53268
|
responseObj,
|
|
53094
53269
|
"Draft saved."
|
|
53095
53270
|
);
|
package/dist/tools/messages.js
CHANGED
|
@@ -27,6 +27,7 @@ const WRITE_VIEW_NOTE = 'compact omits OurFamilyWizard\'s raw `listData` echo (w
|
|
|
27
27
|
import { resolveView, viewParam } from '@chrischall/mcp-utils';
|
|
28
28
|
import { displayTimeZone, formatInstant, normalizeTimestampsInValue, nowNaiveWallClock, toNaiveWallClock } from '../timestamps.js';
|
|
29
29
|
import { READ_OVERRIDE_NOTE, UNREAD_ON_NO_READ_DAY, auditReadOverride, readingBlockedToday } from '../read-days.js';
|
|
30
|
+
import { BODY_FORMAT_DESCRIPTION, prepareBody } from './plain-text.js';
|
|
30
31
|
/** Why a draft has no draftKey — said instead of a bare null. */
|
|
31
32
|
export const DRAFT_KEY_NULL_REASON = 'No draftKey: this draft was not saved through this server\'s cache — it may have been created in the OurFamilyWizard web app or replaced from another session — so its lineage is unknown. The next ofw_save_draft on it starts a new key.';
|
|
32
33
|
/** `{draftKey, draftKeyInferred?}` or `{draftKey: null, draftKeyReason}` for one draft. */
|
|
@@ -903,6 +904,7 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
903
904
|
inputSchema: z.object({
|
|
904
905
|
subject: z.string().describe('Message subject. Required unless draftId/messageId is given (then it overrides the server draft\'s subject).').optional(),
|
|
905
906
|
body: z.string().describe('Message body text. Required unless draftId/messageId is given (then it overrides the server draft\'s body — omit it to send exactly what is on OurFamilyWizard).').optional(),
|
|
907
|
+
bodyFormat: z.enum(['markdown', 'plain']).describe(`${BODY_FORMAT_DESCRIPTION} Applies only to a body passed here: a draft sent by id goes out exactly as it is on OurFamilyWizard.`).optional(),
|
|
906
908
|
recipientIds: z.array(z.number()).describe('Array of recipient user IDs (get from ofw_get_profile). Usually required even when sending a draft: OurFamilyWizard does not persist recipients on drafts.').optional(),
|
|
907
909
|
replyToId: z.number().describe('ID of the message being replied to. Defaults to the draft\'s stored reply target when sending by draftId.').optional(),
|
|
908
910
|
draftId: z.number().describe('ID of an existing draft to send. The draft is re-read from OurFamilyWizard and its SERVER content is sent; missing subject/body default from it. Guarded: a draft that changed since you read it, or that was already sent/deleted, refuses rather than sending blind.').optional(),
|
|
@@ -929,7 +931,10 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
929
931
|
const blobStore = args.blobKeys?.length ? blobStoreFromEnv() : undefined;
|
|
930
932
|
const pending = await planAttachments({ inline: args.inlineAttachments, blobKeys: args.blobKeys }, { store: blobStore, readBlobs: true });
|
|
931
933
|
let subject = args.subject;
|
|
932
|
-
|
|
934
|
+
// Only a body the CALLER supplies is converted. A draft sent by id goes
|
|
935
|
+
// out as it is on OFW — the artifact sent is the artifact on the server.
|
|
936
|
+
const prepared = args.body === undefined ? null : prepareBody(args.body, args.bodyFormat);
|
|
937
|
+
let body = prepared?.body;
|
|
933
938
|
let recipientIds = args.recipientIds;
|
|
934
939
|
let draftReplyToId = null;
|
|
935
940
|
let guardNote = null;
|
|
@@ -1044,6 +1049,7 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
1044
1049
|
: {}),
|
|
1045
1050
|
subject,
|
|
1046
1051
|
body,
|
|
1052
|
+
...(prepared?.conversion ? { bodyConversion: prepared.conversion } : {}),
|
|
1047
1053
|
replyTo: resolvedReplyTo === null
|
|
1048
1054
|
? null
|
|
1049
1055
|
: { messageId: resolvedReplyTo, subject: replyParent?.subject ?? null, from: replyParent?.fromUser || null },
|
|
@@ -1288,8 +1294,9 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
1288
1294
|
...(attachmentCheck !== null ? { attachments: attachmentCheck } : {}),
|
|
1289
1295
|
...(newFiles.length > 0 ? { attachmentsUploaded: newFiles } : {}),
|
|
1290
1296
|
...(uploadWarnings.length > 0 ? { warnings: uploadWarnings } : {}),
|
|
1297
|
+
...(prepared?.conversion ? { bodyConversion: prepared.conversion } : {}),
|
|
1291
1298
|
};
|
|
1292
|
-
return notedJsonResponse([guardNote, rewriteNote, verifyNote, threadNote, attachmentNote, unconfirmedNote, retainNote], responseObj, 'Message sent successfully.');
|
|
1299
|
+
return notedJsonResponse([guardNote, rewriteNote, prepared?.noteLine ?? null, verifyNote, threadNote, attachmentNote, unconfirmedNote, retainNote], responseObj, 'Message sent successfully.');
|
|
1293
1300
|
});
|
|
1294
1301
|
async function guardDestructiveDraftOp(input) {
|
|
1295
1302
|
const { cache, draftId, expectedRevision, force, action } = input;
|
|
@@ -1497,6 +1504,7 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
1497
1504
|
inputSchema: z.object({
|
|
1498
1505
|
subject: z.string().describe('Message subject'),
|
|
1499
1506
|
body: z.string().describe('Message body text'),
|
|
1507
|
+
bodyFormat: z.enum(['markdown', 'plain']).describe(BODY_FORMAT_DESCRIPTION).optional(),
|
|
1500
1508
|
recipientIds: z.array(z.number()).describe('Array of recipient user IDs (optional for drafts)').optional(),
|
|
1501
1509
|
messageId: z.number().describe('ID of an existing draft to replace (the new draft will have a new id; the old is deleted)').optional(),
|
|
1502
1510
|
replyToId: z.number().nullable().describe('ID of the message this draft replies to. When replacing a draft (messageId), omit it to keep the draft\'s own reply target, or pass null to make the draft a new top-level message.').optional(),
|
|
@@ -1511,6 +1519,7 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
1511
1519
|
}, async (args) => {
|
|
1512
1520
|
const cache = cacheProvider();
|
|
1513
1521
|
const view = resolveView(args.view, MESSAGE_VIEWS);
|
|
1522
|
+
const prepared = prepareBody(args.body, args.bodyFormat);
|
|
1514
1523
|
// New attachments are validated before ANYTHING happens, so a bad entry
|
|
1515
1524
|
// fails the call with nothing uploaded and nothing saved.
|
|
1516
1525
|
const blobStore = args.blobKeys?.length ? blobStoreFromEnv() : undefined;
|
|
@@ -1576,7 +1585,7 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
1576
1585
|
// messageId, we delete the old draft afterward (the "replace" path).
|
|
1577
1586
|
const payload = {
|
|
1578
1587
|
subject: args.subject,
|
|
1579
|
-
body:
|
|
1588
|
+
body: prepared.body,
|
|
1580
1589
|
recipientIds: args.recipientIds ?? serverRecipientIds ?? [],
|
|
1581
1590
|
attachments: { myFileIDs },
|
|
1582
1591
|
draft: true,
|
|
@@ -1597,7 +1606,7 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
1597
1606
|
// loss must be reported. Never a silent drop (Defect 3).
|
|
1598
1607
|
const warnings = [...uploadWarnings];
|
|
1599
1608
|
if (newId !== null) {
|
|
1600
|
-
verifyNote = verifyWriteLanded('draft', { subject: args.subject, body:
|
|
1609
|
+
verifyNote = verifyWriteLanded('draft', { subject: args.subject, body: prepared.body }, detail);
|
|
1601
1610
|
// Trust the re-fetched server detail as the source of truth for the stored
|
|
1602
1611
|
// replyToId — NOT `resolvedReplyTo` (what we intended to post). OFW
|
|
1603
1612
|
// normalizes/drops threading after a save, and masking that with our own
|
|
@@ -1755,12 +1764,13 @@ export function registerMessageTools(server, client, cacheProvider, attachmentIO
|
|
|
1755
1764
|
...(newFiles.length > 0 ? { attachmentsUploaded: newFiles } : {}),
|
|
1756
1765
|
...(warnings.length > 0 ? { warnings } : {}),
|
|
1757
1766
|
...(recipientsNote !== null ? { recipientsNote } : {}),
|
|
1767
|
+
...(prepared.conversion !== null ? { bodyConversion: prepared.conversion } : {}),
|
|
1758
1768
|
}
|
|
1759
1769
|
: raw;
|
|
1760
1770
|
const warnNote = warnings.length > 0
|
|
1761
1771
|
? `WARNING: ${warnings.join('\n\n')}`
|
|
1762
1772
|
: null;
|
|
1763
|
-
return notedJsonResponse([forceNote, rewriteNote, verifyNote, warnNote, recipientsNote, replaceNote], responseObj, 'Draft saved.');
|
|
1773
|
+
return notedJsonResponse([forceNote, rewriteNote, prepared.noteLine, verifyNote, warnNote, recipientsNote, replaceNote], responseObj, 'Draft saved.');
|
|
1764
1774
|
});
|
|
1765
1775
|
if (allowDrafts)
|
|
1766
1776
|
server.registerTool('ofw_delete_draft', {
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown → plain text for OurFamilyWizard message bodies.
|
|
3
|
+
*
|
|
4
|
+
* OFW renders a body as plain text: verified in the web app 2026-11-11, the
|
|
5
|
+
* read view HTML-escapes the body (a `&` arrives as `&`), auto-links
|
|
6
|
+
* https URLs, emails and phone numbers, and shows it in a `white-space:
|
|
7
|
+
* pre-wrap` span. Markdown is never rendered, so `**urgent**` reaches the
|
|
8
|
+
* co-parent — and the court-visible record — with its asterisks. Models write
|
|
9
|
+
* Markdown by habit, so the write tools run the body through this first.
|
|
10
|
+
*
|
|
11
|
+
* Rules, all deliberately conservative (when in doubt, leave the text alone):
|
|
12
|
+
* - bold/italic markers are stripped; word-internal `_`/`*` (snake_case,
|
|
13
|
+
* a*b) and spaced `*` (3 * 4) are not emphasis
|
|
14
|
+
* - `[text](url)` → `text (url)` (OFW auto-links the url); `<url>` → url
|
|
15
|
+
* - `# Heading` → `Heading`
|
|
16
|
+
* - lists: `*`/`+` → `-`; 4 spaces per nesting level; numbered lists are
|
|
17
|
+
* renumbered from their first number (Markdown's `1. 1. 1.` means 1, 2, 3),
|
|
18
|
+
* the second level is lettered (a., b.), and markers are padded so item
|
|
19
|
+
* text lines up past 9
|
|
20
|
+
* - code spans, fenced blocks, URLs and ~~strikethrough~~ (stripping it would
|
|
21
|
+
* invert its meaning) are left exactly as written
|
|
22
|
+
*
|
|
23
|
+
* Idempotent: converting the output again changes nothing, so a draft that
|
|
24
|
+
* is re-saved does not drift. When nothing changes the input is returned
|
|
25
|
+
* byte-for-byte (line endings included).
|
|
26
|
+
*/
|
|
27
|
+
const CHANGE_ORDER = [
|
|
28
|
+
'headings', 'bold/italic', 'links', 'list markers', 'list numbering', 'list indentation',
|
|
29
|
+
];
|
|
30
|
+
const PH_OPEN = '';
|
|
31
|
+
const PH_CLOSE = '';
|
|
32
|
+
const PLACEHOLDER = /(\d+)/g;
|
|
33
|
+
function convertInline(line, changes) {
|
|
34
|
+
// A body that already holds our private-use markers is left alone rather
|
|
35
|
+
// than risk restoring the wrong span into it.
|
|
36
|
+
if (line.includes(PH_OPEN) || line.includes(PH_CLOSE))
|
|
37
|
+
return line;
|
|
38
|
+
const kept = [];
|
|
39
|
+
const protect = (s) => `${PH_OPEN}${kept.push(s) - 1}${PH_CLOSE}`;
|
|
40
|
+
let s = line.replace(/(`+)[^`]+?\1(?!`)/g, protect);
|
|
41
|
+
const beforeLinks = s;
|
|
42
|
+
s = s.replace(/<(https?:\/\/[^\s<>]+)>/g, (_m, url) => protect(url));
|
|
43
|
+
s = s.replace(/!?\[([^\]\n]+)\]\(([^)\s]+)\)/g, (_m, text, url) => {
|
|
44
|
+
const bare = (u) => u.replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
45
|
+
return bare(text) === bare(url) ? protect(url) : `${text} (${protect(url)})`;
|
|
46
|
+
});
|
|
47
|
+
if (s !== beforeLinks)
|
|
48
|
+
changes.add('links');
|
|
49
|
+
s = s.replace(/https?:\/\/\S+/g, protect);
|
|
50
|
+
const beforeEmphasis = s;
|
|
51
|
+
s = s.replace(/\*\*(?=\S)(.+?)(?<=\S)\*\*/g, '$1');
|
|
52
|
+
s = s.replace(/(?<![\w_])__(?=\S)(.+?)(?<=\S)__(?![\w_])/g, '$1');
|
|
53
|
+
s = s.replace(/(?<![\w*])\*(?![\s*])(.+?)(?<![\s*])\*(?![\w*])/g, '$1');
|
|
54
|
+
s = s.replace(/(?<![\w_])_(?![\s_])(.+?)(?<![\s_])_(?![\w_])/g, '$1');
|
|
55
|
+
if (s !== beforeEmphasis)
|
|
56
|
+
changes.add('bold/italic');
|
|
57
|
+
while (s.includes(PH_OPEN)) {
|
|
58
|
+
s = s.replace(PLACEHOLDER, (_m, i) => kept[Number(i)]);
|
|
59
|
+
}
|
|
60
|
+
return s;
|
|
61
|
+
}
|
|
62
|
+
const HEADING = /^ {0,3}#{1,6}[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/;
|
|
63
|
+
const FENCE = /^ {0,3}(`{3,}|~{3,})/;
|
|
64
|
+
const ITEM = /^([ \t]*)([-*+]|\d{1,9}[.)]|[a-z]{1,2}[.)])([ \t]+)(\S.*)$/;
|
|
65
|
+
function indentWidth(ws) {
|
|
66
|
+
let n = 0;
|
|
67
|
+
for (const ch of ws)
|
|
68
|
+
n += ch === '\t' ? 4 : 1;
|
|
69
|
+
return n;
|
|
70
|
+
}
|
|
71
|
+
/** a=1 … z=26, aa=27 … */
|
|
72
|
+
function alphaIndex(token) {
|
|
73
|
+
let n = 0;
|
|
74
|
+
for (const ch of token)
|
|
75
|
+
n = n * 26 + (ch.charCodeAt(0) - 96);
|
|
76
|
+
return n;
|
|
77
|
+
}
|
|
78
|
+
function toAlpha(n) {
|
|
79
|
+
let s = '';
|
|
80
|
+
for (let k = Math.max(1, n); k > 0; k = Math.floor((k - 1) / 26)) {
|
|
81
|
+
s = String.fromCharCode(97 + ((k - 1) % 26)) + s;
|
|
82
|
+
}
|
|
83
|
+
return s;
|
|
84
|
+
}
|
|
85
|
+
export function markdownToPlainText(input) {
|
|
86
|
+
const eol = input.includes('\r\n') ? '\r\n' : '\n';
|
|
87
|
+
const lines = input.split(/\r?\n/);
|
|
88
|
+
const out = [...lines];
|
|
89
|
+
const changes = new Set();
|
|
90
|
+
const runs = [];
|
|
91
|
+
let fence = null;
|
|
92
|
+
let stack = [];
|
|
93
|
+
let prevBlank = true;
|
|
94
|
+
const endList = () => { stack = []; };
|
|
95
|
+
lines.forEach((line, i) => {
|
|
96
|
+
if (fence !== null) {
|
|
97
|
+
if (line.trimStart().startsWith(fence))
|
|
98
|
+
fence = null;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const fenceOpen = FENCE.exec(line);
|
|
102
|
+
if (fenceOpen) {
|
|
103
|
+
fence = fenceOpen[1];
|
|
104
|
+
endList();
|
|
105
|
+
prevBlank = false;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (line.trim() === '') {
|
|
109
|
+
prevBlank = true;
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const m = ITEM.exec(line);
|
|
113
|
+
if (m) {
|
|
114
|
+
const [, ws, marker, sep, content] = m;
|
|
115
|
+
const indent = indentWidth(ws);
|
|
116
|
+
const bullet = /^[-*+]$/.test(marker);
|
|
117
|
+
const letter = /^[a-z]/.test(marker);
|
|
118
|
+
const token = bullet ? '' : marker.slice(0, -1);
|
|
119
|
+
const accepted = letter
|
|
120
|
+
? stack.length > 0 && indent >= stack[0].indent + 2
|
|
121
|
+
: stack.length > 0 || prevBlank || bullet || token === '1';
|
|
122
|
+
if (accepted) {
|
|
123
|
+
const kind = bullet ? 'bullet' : 'ordered';
|
|
124
|
+
const start = bullet ? 0 : letter ? alphaIndex(token) : Number(token);
|
|
125
|
+
const item = { line: i, indent: ws, marker, sep, content };
|
|
126
|
+
const newRun = (level) => {
|
|
127
|
+
const run = { kind, level, start, items: [item] };
|
|
128
|
+
runs.push(run);
|
|
129
|
+
return run;
|
|
130
|
+
};
|
|
131
|
+
if (stack.length === 0) {
|
|
132
|
+
stack.push({ indent, run: newRun(0) });
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
while (stack.length > 1 && indent <= stack[stack.length - 1].indent - 2)
|
|
136
|
+
stack.pop();
|
|
137
|
+
const top = stack[stack.length - 1];
|
|
138
|
+
if (indent >= top.indent + 2) {
|
|
139
|
+
stack.push({ indent, run: newRun(stack.length) });
|
|
140
|
+
}
|
|
141
|
+
else if (top.run.kind !== kind) {
|
|
142
|
+
top.run = newRun(stack.length - 1);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
top.run.items.push(item);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
prevBlank = false;
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (stack.length > 0 && /^[ \t]/.test(line)) {
|
|
153
|
+
// An indented line inside a list continues the item above it.
|
|
154
|
+
out[i] = convertInline(line, changes);
|
|
155
|
+
prevBlank = false;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
endList();
|
|
159
|
+
const heading = HEADING.exec(line);
|
|
160
|
+
if (heading) {
|
|
161
|
+
out[i] = convertInline(heading[1], changes);
|
|
162
|
+
changes.add('headings');
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
out[i] = convertInline(line, changes);
|
|
166
|
+
}
|
|
167
|
+
prevBlank = false;
|
|
168
|
+
});
|
|
169
|
+
for (const run of runs) {
|
|
170
|
+
const lettered = run.kind === 'ordered' && run.level % 2 === 1;
|
|
171
|
+
const markers = run.items.map((_, k) => {
|
|
172
|
+
if (run.kind === 'bullet')
|
|
173
|
+
return '-';
|
|
174
|
+
return `${lettered ? toAlpha(run.start + k) : run.start + k}.`;
|
|
175
|
+
});
|
|
176
|
+
const width = Math.max(...markers.map((mk) => mk.length));
|
|
177
|
+
run.items.forEach((item, k) => {
|
|
178
|
+
const indent = ' '.repeat(4 * run.level);
|
|
179
|
+
const sep = ' '.repeat(width - markers[k].length + 1);
|
|
180
|
+
if (indent !== item.indent)
|
|
181
|
+
changes.add('list indentation');
|
|
182
|
+
const origToken = item.marker.replace(/[.)]$/, '');
|
|
183
|
+
const newToken = markers[k].replace(/\.$/, '');
|
|
184
|
+
if (run.kind === 'bullet' ? item.marker !== '-' : item.marker.endsWith(')'))
|
|
185
|
+
changes.add('list markers');
|
|
186
|
+
if (run.kind === 'ordered' && origToken !== newToken)
|
|
187
|
+
changes.add('list numbering');
|
|
188
|
+
if (sep !== item.sep)
|
|
189
|
+
changes.add(run.kind === 'ordered' && width > 2 ? 'list numbering' : 'list markers');
|
|
190
|
+
out[item.line] = `${indent}${markers[k]}${sep}${convertInline(item.content, changes)}`;
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
if (changes.size === 0)
|
|
194
|
+
return { text: input, changes: [] };
|
|
195
|
+
return { text: out.join(eol), changes: CHANGE_ORDER.filter((c) => changes.has(c)) };
|
|
196
|
+
}
|
|
197
|
+
export const BODY_FORMAT_DESCRIPTION = 'How to treat `body`. OurFamilyWizard shows message bodies as PLAIN TEXT — Markdown is never rendered, so **bold** would reach the co-parent with its asterisks. Default "markdown": Markdown is converted to plain text before anything is saved or sent (bold/italic markers and # heading markers dropped; [text](url) → "text (url)"; lists normalized to "-" bullets and renumbered 1., 2., … with a., b. for the second level, 4 spaces per nesting level; code, URLs and ~~strikethrough~~ left as written), and the response reports what changed under bodyConversion. "plain": send the body byte-for-byte. Line breaks, blank lines and leading spaces always survive; full https:// URLs, email addresses and phone numbers become links for the reader.';
|
|
198
|
+
/** Apply the write tools' `bodyFormat` to a caller-supplied body. */
|
|
199
|
+
export function prepareBody(body, format) {
|
|
200
|
+
if (format === 'plain')
|
|
201
|
+
return { body, conversion: null, noteLine: null };
|
|
202
|
+
const { text, changes } = markdownToPlainText(body);
|
|
203
|
+
if (changes.length === 0)
|
|
204
|
+
return { body, conversion: null, noteLine: null };
|
|
205
|
+
const note = `OurFamilyWizard shows bodies as plain text, so Markdown was converted (${changes.join(', ')}). What was saved/sent is the converted text; pass bodyFormat:"plain" to send a body exactly as written.`;
|
|
206
|
+
return {
|
|
207
|
+
body: text,
|
|
208
|
+
conversion: { changes, note },
|
|
209
|
+
noteLine: `NOTE: the body was converted from Markdown to plain text (${changes.join(', ')}).`,
|
|
210
|
+
};
|
|
211
|
+
}
|
package/dist/version.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// package.json drift. Importing these instead of package.json keeps the whole
|
|
5
5
|
// manifest — npm scripts included — out of dist/bundle.js.
|
|
6
6
|
export const SERVER_NAME = 'ofw-mcp';
|
|
7
|
-
export const VERSION = '2.
|
|
7
|
+
export const VERSION = '2.29.0'; // x-release-please-version
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/chrischall/ofw-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.29.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "ofw-mcp",
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.29.0",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
},
|
package/skills/ofw/SKILL.md
CHANGED
|
@@ -94,10 +94,10 @@ Always pass `--config ~/.mcporter/mcporter.json` unless a local `config/mcporter
|
|
|
94
94
|
| `ofw_list_message_folders` | List OFW folders with unread counts. Most reads use the cache; this is mainly for folder IDs and live unread counts. |
|
|
95
95
|
| `ofw_list_messages(folderId?, since?, until?, q?, sort?, page?, size?, autoRefresh?, view?)` | Cache-backed list. Supports folder ("inbox"/"sent"/"both"), date range, and substring search. `sort:"oldest"` starts at the old end of a range instead of paging to it (default `"newest"`). Returns `complete` for the RESULT SET plus **`nextPage`** (null when done) — and the paging keys come FIRST in the JSON, before `messages`. `returned` carries the record count as a scalar, beside `total`. An **empty** result from a non-fresh cache is refused (`UNVERIFIED_EMPTY`) — pass `autoRefresh:true` to sync and answer instead. |
|
|
96
96
|
| `ofw_get_message(messageId, allowMarkRead?, view?)` | Read a message OR draft body. Cache-first. Ids in the drafts cache return `folder: "drafts"`. ⚠️ Falls through to OFW for unread inbox messages, which marks them read AND stamps a "First Viewed" time the co-parent can see — irreversible. Pass `allowMarkRead:false` to refuse that fetch instead; cached, sent and already-read messages are unaffected. If the server runs with `OFW_CONFIRM_MARK_READ`, the first call returns a preview (subject, sender, sent time) instead of the body: show it to the user and repeat the call with its `confirmToken` only after they say yes. On a server-configured no-read day (`readingBlocked` / `READING_BLOCKED` in the response) the body is withheld (`bodyWithheld: true`) — report the sender, date and subject, say when `nextReadableDay` is, and do not try to work around it. |
|
|
97
|
-
| `ofw_send_message(draftId?, subject?, body?, recipientIds?, replyToId?, expectedRevision?, deleteDraftOnSuccess?, myFileIDs?, inlineAttachments?, blobKeys?, force?)` | Send a message — **the one irreversible operation**. Preferred path: pass `draftId` (+ `expectedRevision`) to send an existing draft **as it exists on the server** — the tool re-reads it from OFW first and refuses if it changed since you read it (or was already sent/deleted); `subject`/`body` become optional overrides. `recipientIds` is usually still required: OFW does not store recipients on drafts. After a **confirmed** send the draft is auto-deleted (`deleteDraftOnSuccess:false` to keep it); on any failure or ambiguity it is retained and the response says why (`draftRetained`). Response leads with `sentMessageId`, `draftKey`, `threaded`, `draftDeleted`. Compose from scratch by passing `subject`/`body`/`recipientIds` with no `draftId`. Sending a draft attaches its held files as they are (PRIVATE files attach fine); new files upload PRIVATE only after approval, and the response's `attachments.verified`/`missing` says what OFW actually attached. A replace without `recipientIds` keeps the draft's recipients. A draft with no `draftKey` says why (`draftKeyReason`). |
|
|
97
|
+
| `ofw_send_message(draftId?, subject?, body?, bodyFormat?, recipientIds?, replyToId?, expectedRevision?, deleteDraftOnSuccess?, myFileIDs?, inlineAttachments?, blobKeys?, force?)` | Send a message — **the one irreversible operation**. Preferred path: pass `draftId` (+ `expectedRevision`) to send an existing draft **as it exists on the server** — the tool re-reads it from OFW first and refuses if it changed since you read it (or was already sent/deleted); `subject`/`body` become optional overrides. `recipientIds` is usually still required: OFW does not store recipients on drafts. After a **confirmed** send the draft is auto-deleted (`deleteDraftOnSuccess:false` to keep it); on any failure or ambiguity it is retained and the response says why (`draftRetained`). Response leads with `sentMessageId`, `draftKey`, `threaded`, `draftDeleted`. Compose from scratch by passing `subject`/`body`/`recipientIds` with no `draftId`. Sending a draft attaches its held files as they are (PRIVATE files attach fine); new files upload PRIVATE only after approval, and the response's `attachments.verified`/`missing` says what OFW actually attached. A replace without `recipientIds` keeps the draft's recipients. A draft with no `draftKey` says why (`draftKeyReason`). |
|
|
98
98
|
| `ofw_get_unread_sent(page?, size?, autoRefresh?)` | Sent messages your co-parent hasn't read yet (from cache). Leads with `complete`/`hasMore`/`nextPage`, then `scanned`/`total`, then `unread`; an empty sent cache that is not fresh is refused rather than reported as "nothing sent". |
|
|
99
99
|
| `ofw_list_drafts(page?, size?, verify?, autoRefresh?, view?)` | Leads with `complete`/`hasMore`/`nextPage`; `drafts` comes last. List saved drafts, **auto-verified**: when the cache is not verified-fresh a cheap drafts sync runs first (default `verify:true`), so one call answers server-confirmed. `verify:false` serves straight from cache. Each draft carries `serverConfirmed`, `revision` and `draftKey`. Returns `complete` — **check it before saying "you have N drafts"**. See [Freshness](#freshness). |
|
|
100
|
-
| `ofw_save_draft(subject, body, recipientIds?, messageId?, replyToId?, myFileIDs?, removeFileIDs?, inlineAttachments?, blobKeys?, expectedRevision?, force?)` | Create a new draft. Pass `messageId` to **replace** an existing draft: the tool creates a fresh draft and deletes the old one (OFW's update-in-place endpoint silently no-ops). The returned `id` is the NEW id; the response leads with `draftKey`, which stays the same across every edit — **track that, not the id**. Note: OFW does **not** store recipients on drafts — `recipientIds` are accepted but come back empty (a one-line NOTE says so; supply them at send time instead). Threading warnings fire only on genuine drops — a draft echoing `inReplyTo`/`showContext` IS threaded. **OFW drafts can't hold files**: attachments are HELD by the server (`attachments.held`), kept across edits (`removeFileIDs` drops one), and attached when the draft is sent. They don't appear on the draft in the OFW web app; that's expected. `inlineAttachments`/`blobKeys` upload and add new files in the same call. |
|
|
100
|
+
| `ofw_save_draft(subject, body, bodyFormat?, recipientIds?, messageId?, replyToId?, myFileIDs?, removeFileIDs?, inlineAttachments?, blobKeys?, expectedRevision?, force?)` | Create a new draft. Pass `messageId` to **replace** an existing draft: the tool creates a fresh draft and deletes the old one (OFW's update-in-place endpoint silently no-ops). The returned `id` is the NEW id; the response leads with `draftKey`, which stays the same across every edit — **track that, not the id**. Note: OFW does **not** store recipients on drafts — `recipientIds` are accepted but come back empty (a one-line NOTE says so; supply them at send time instead). Threading warnings fire only on genuine drops — a draft echoing `inReplyTo`/`showContext` IS threaded. **OFW drafts can't hold files**: attachments are HELD by the server (`attachments.held`), kept across edits (`removeFileIDs` drops one), and attached when the draft is sent. They don't appear on the draft in the OFW web app; that's expected. `inlineAttachments`/`blobKeys` upload and add new files in the same call. |
|
|
101
101
|
| `ofw_delete_draft(messageId)` | Delete a draft. |
|
|
102
102
|
| `ofw_upload_attachment(path \| inline \| uploadSlots \| blobKeys, shareClass?, label?, description?)` | Upload to My Files; returns fileIds for `myFileIDs`. Exactly one source. **Hosted connector (claude.ai): `path` cannot work.** For real files (photos), call `uploadSlots:[{filename}]`, run each slot's `curl` with the file, then call again with `blobKeys`; for a small file pass `inline:{filename, contentBase64}`. Local installs: `path` inside the upload directory (`OFW_UPLOAD_DIR`). Up to 10 files per call, 25 MiB each; a batch reports per-file `results`. `shareClass:"SHARED"` is one file, confirm-gated, mode `all`. |
|
|
103
103
|
| `ofw_download_attachment(fileId, inline?, saveTo?, force?, extract?, maxChars?, parts?, link?, linkMinutes?)` | Download an attachment. Inline delivery returns the first rung that works: image → `ImageContent`; .xlsx/.csv/.pdf/.docx/.pptx/text → **extracted content** under `extracted` (per-sheet CSV, per-page/slide text); anything else → raw bytes. Default writes to `~/Downloads/ofw-mcp/` (add `extract:true` for content too). Use `parts:"1-2"` / a sheet name and `maxChars` on large files. Images and raw bytes over 10 MiB are not returned inline (tool error) — use disk mode or open the file in OFW. On a hosted connector, `inline:false`/`link:true` returns a private expiring download link instead, and an over-10-MiB inline image falls back to one. |
|
|
@@ -270,6 +270,8 @@ Editing a draft mints a **new OFW id every time** — `ofw_save_draft` replaces
|
|
|
270
270
|
2. `ofw_list_messages(folderId)` → list messages
|
|
271
271
|
3. `ofw_get_message(messageId)` → read a specific message
|
|
272
272
|
|
|
273
|
+
**Writing a message body:** OFW shows bodies as plain text — Markdown is never rendered. Write plain text: blank lines between paragraphs, `-` bullets, `1.` numbered lists, full `https://` links (those, emails and phone numbers become clickable). Any Markdown that slips in is converted before saving/sending (`bodyConversion` in the response says what changed; the send preview shows the converted text). `bodyFormat: "plain"` sends a body byte-for-byte.
|
|
274
|
+
|
|
273
275
|
**Send a message:**
|
|
274
276
|
1. `ofw_get_profile` → get co-parent's user ID
|
|
275
277
|
2. `ofw_send_message(subject, body, [coParentId])`
|