ofw-mcp 2.27.0 → 2.27.1
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/README.md +6 -4
- package/dist/bundle.js +902 -678
- package/dist/tools/_shared.js +1 -1
- package/dist/tools/draft-freshness.js +17 -5
- package/dist/tools/held-attachments.js +50 -0
- package/dist/tools/lifecycle.js +7 -4
- package/dist/tools/messages.js +168 -43
- package/dist/tools/uploads.js +38 -115
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/server.json +2 -2
- package/skills/ofw/SKILL.md +2 -2
package/dist/tools/uploads.js
CHANGED
|
@@ -23,95 +23,31 @@
|
|
|
23
23
|
// Both converge on a {@link ResolvedUpload}, the same shape a disk `path`
|
|
24
24
|
// resolves to, so everything after this point — the My Files POST, the
|
|
25
25
|
// SHARED confirmation, the attachment cache — is one code path.
|
|
26
|
-
import { createHash
|
|
26
|
+
import { createHash } from 'node:crypto';
|
|
27
27
|
import { z } from 'zod';
|
|
28
28
|
import { parseLenient } from '@chrischall/mcp-utils';
|
|
29
|
+
import { checkUploadSize as sharedCheckUploadSize, decodeBase64Strict, inlineFileSchema, MAX_UPLOAD_FILES, mintUploadSlot as sharedMintUploadSlot, resolveUploadMime, sanitizeUploadFilename, UPLOAD_KEY_PREFIX, UPLOAD_SLOT_DEFAULT_TTL_MS, uploadFileNameFromKey, uploadSlotRequestSchema, } from '@chrischall/mcp-utils/export';
|
|
29
30
|
import { MAX_UPLOAD_BYTES, mimeFromName, normalizeMimeType } from './attachments.js';
|
|
30
31
|
import { formatInstant } from '../timestamps.js';
|
|
32
|
+
// The filename / MIME / base64 / slot rules are the fleet's, from
|
|
33
|
+
// @chrischall/mcp-utils/export (3.6), which was lifted out of this file. The
|
|
34
|
+
// names below keep this module's API so callers and tests did not move; the
|
|
35
|
+
// only local policy is the 25 MiB cap and the offset-bearing expiresAt.
|
|
31
36
|
/** Most files one call may upload (inline array, blobKeys, uploadSlots). */
|
|
32
|
-
export const MAX_FILES_PER_CALL =
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
* run a curl; short, because the URL is a credential to write this key.
|
|
36
|
-
*/
|
|
37
|
-
export const UPLOAD_SLOT_TTL_MS = 30 * 60 * 1000;
|
|
37
|
+
export const MAX_FILES_PER_CALL = MAX_UPLOAD_FILES;
|
|
38
|
+
/** How long an upload slot's PUT URL works. */
|
|
39
|
+
export const UPLOAD_SLOT_TTL_MS = UPLOAD_SLOT_DEFAULT_TTL_MS;
|
|
38
40
|
/** Object-key prefix for caller uploads — the only keys `blobKeys` accepts. */
|
|
39
|
-
export const UPLOAD_BLOB_PREFIX =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export const inlineFileSchema = z.object({
|
|
43
|
-
filename: z.string().describe('Filename OFW will show, e.g. "Finn_Think_Sheet_2026-11-03.jpg" — a bare name, no path, not starting with a dot. Its extension sets the MIME type when mimeType is omitted.'),
|
|
44
|
-
contentBase64: z.string().describe('The file\'s bytes, standard base64 (line breaks and a "data:<type>;base64," prefix are tolerated).'),
|
|
45
|
-
mimeType: z.string().describe('MIME type, e.g. "image/jpeg". Default: inferred from the filename extension (jpg/jpeg, png, heic, pdf, docx, …).').optional(),
|
|
46
|
-
});
|
|
47
|
-
export const uploadSlotRequestSchema = z.object({
|
|
48
|
-
filename: z.string().describe('Filename OFW will show — a bare name, no path, not starting with a dot.'),
|
|
49
|
-
mimeType: z.string().describe('MIME type. Default: inferred from the filename extension. The PUT must send exactly this Content-Type.').optional(),
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* A caller-supplied filename, as the name OFW will show. It must be ONE
|
|
53
|
-
* plain segment: it names the file in the co-parent's view, so a path or a
|
|
54
|
-
* hidden-file name has no legitimate use and is refused rather than repaired.
|
|
55
|
-
*/
|
|
56
|
-
export function sanitizeUploadFilename(raw) {
|
|
57
|
-
const name = raw.trim();
|
|
58
|
-
if (name.length === 0)
|
|
59
|
-
throw new Error('filename is empty.');
|
|
60
|
-
if (/[/\\]/.test(name)) {
|
|
61
|
-
throw new Error(`filename ${JSON.stringify(name)} must be a bare filename, not a path — pass just the name OFW should show, e.g. "photo.jpg".`);
|
|
62
|
-
}
|
|
63
|
-
// eslint-disable-next-line no-control-regex
|
|
64
|
-
if (/[\x00-\x1f\x7f]/.test(name))
|
|
65
|
-
throw new Error(`filename ${JSON.stringify(name)} contains control characters.`);
|
|
66
|
-
if (name.startsWith('.')) {
|
|
67
|
-
throw new Error(`filename ${JSON.stringify(name)} must not start with a dot (hidden files are never uploaded).`);
|
|
68
|
-
}
|
|
69
|
-
if (name.length > 200)
|
|
70
|
-
throw new Error('filename is longer than 200 characters.');
|
|
71
|
-
return name;
|
|
72
|
-
}
|
|
73
|
-
const MEDIA_TYPE = /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/;
|
|
74
|
-
/** The MIME type to upload under: an explicit one (bare, validated), else the extension's. */
|
|
75
|
-
export function resolveUploadMime(fileName, mimeType) {
|
|
76
|
-
if (mimeType === undefined)
|
|
77
|
-
return mimeFromName(fileName);
|
|
78
|
-
const bare = normalizeMimeType(mimeType);
|
|
79
|
-
if (!MEDIA_TYPE.test(bare)) {
|
|
80
|
-
throw new Error(`mimeType ${JSON.stringify(mimeType)} is not a type/subtype media type such as "image/jpeg".`);
|
|
81
|
-
}
|
|
82
|
-
return bare;
|
|
83
|
-
}
|
|
84
|
-
/** Refuse an empty file or one over the upload cap, naming the limit. */
|
|
41
|
+
export const UPLOAD_BLOB_PREFIX = UPLOAD_KEY_PREFIX;
|
|
42
|
+
export { inlineFileSchema, resolveUploadMime, sanitizeUploadFilename, uploadSlotRequestSchema };
|
|
43
|
+
/** Refuse an empty file or one over the 25 MiB upload cap, naming the limit. */
|
|
85
44
|
export function checkUploadSize(fileName, size) {
|
|
86
|
-
|
|
87
|
-
throw new Error(`${fileName} is empty (0 bytes); nothing to upload.`);
|
|
88
|
-
if (size > MAX_UPLOAD_BYTES) {
|
|
89
|
-
throw new Error(`${fileName} is too large (${size} bytes); the upload limit is ${LIMIT_TEXT}.`);
|
|
90
|
-
}
|
|
45
|
+
sharedCheckUploadSize(fileName, size, MAX_UPLOAD_BYTES);
|
|
91
46
|
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Decode caller base64 STRICTLY. `Buffer.from(s, 'base64')` never throws — it
|
|
95
|
-
* silently drops what it does not recognise — so a truncated or mangled
|
|
96
|
-
* payload would otherwise be uploaded as a corrupt file and only discovered
|
|
97
|
-
* by the co-parent. The size is checked from the encoded length before any
|
|
98
|
-
* allocation, so an oversized payload costs nothing to refuse.
|
|
99
|
-
*/
|
|
47
|
+
/** Strict base64 → bytes, capped at the upload limit (see `decodeBase64Strict`). */
|
|
100
48
|
export function decodeBase64Content(content, fileName) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
throw new Error(`${fileName} is empty (0 bytes); nothing to upload.`);
|
|
104
|
-
const invalid = () => new Error(`${fileName}: contentBase64 is not valid base64 (standard alphabet A-Z a-z 0-9 + /, padded with = to a multiple of 4 characters). It may have been truncated.`);
|
|
105
|
-
if (compact.length % 4 !== 0 || !BASE64.test(compact))
|
|
106
|
-
throw invalid();
|
|
107
|
-
const padding = compact.endsWith('==') ? 2 : compact.endsWith('=') ? 1 : 0;
|
|
108
|
-
checkUploadSize(fileName, (compact.length / 4) * 3 - padding);
|
|
109
|
-
const bytes = Buffer.from(compact, 'base64');
|
|
110
|
-
// Non-canonical trailing bits decode to the same bytes as a different
|
|
111
|
-
// string; the round trip refuses them rather than guessing intent.
|
|
112
|
-
if (bytes.toString('base64') !== compact)
|
|
113
|
-
throw invalid();
|
|
114
|
-
return bytes;
|
|
49
|
+
const bytes = decodeBase64Strict(content, { fileName, maxBytes: MAX_UPLOAD_BYTES });
|
|
50
|
+
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
115
51
|
}
|
|
116
52
|
/** An `inline` entry → the upload it describes, validated end to end. */
|
|
117
53
|
export function resolveInlineUpload(file) {
|
|
@@ -120,42 +56,28 @@ export function resolveInlineUpload(file) {
|
|
|
120
56
|
const bytes = decodeBase64Content(file.contentBase64, fileName);
|
|
121
57
|
return { blob: new Blob([new Uint8Array(bytes)], { type: mimeType }), fileName, mimeType, sizeBytes: bytes.length };
|
|
122
58
|
}
|
|
123
|
-
// ── Blob upload slots ────────────────────────────────────────────────────
|
|
124
|
-
// The filename rides in the key, base64url-encoded: the blob store only
|
|
125
|
-
// accepts [A-Za-z0-9._~-] segments, and a photo name routinely has spaces.
|
|
126
|
-
// A random UUID segment makes the key unguessable and per-slot unique.
|
|
127
|
-
const UPLOAD_KEY = new RegExp(`^${UPLOAD_BLOB_PREFIX}/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/([A-Za-z0-9_-]+)$`);
|
|
128
59
|
/**
|
|
129
|
-
* The filename an upload key was minted for. Only
|
|
130
|
-
*
|
|
131
|
-
* pointed at another object in this registration's store (a
|
|
132
|
-
* an export zip) and pass it off as an upload.
|
|
60
|
+
* The filename an upload key was minted for. Only the exact
|
|
61
|
+
* `uploads/<uuid>/<base64url(name)>` shape is accepted, so `blobKeys` can
|
|
62
|
+
* never be pointed at another object in this registration's store (a
|
|
63
|
+
* calendar export, an export zip) and pass it off as an upload.
|
|
133
64
|
*/
|
|
134
65
|
export function fileNameFromBlobKey(key) {
|
|
135
|
-
|
|
136
|
-
|
|
66
|
+
try {
|
|
67
|
+
return uploadFileNameFromKey(key, { prefix: UPLOAD_BLOB_PREFIX });
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
// The shared message is tool-agnostic; name the tool that mints keys here.
|
|
71
|
+
const message = e.message;
|
|
72
|
+
if (!message.includes('is not an upload key'))
|
|
73
|
+
throw e;
|
|
137
74
|
throw new Error(`blobKey ${JSON.stringify(key)} is not an upload key. Pass the blobKey exactly as ofw_upload_attachment's uploadSlots returned it.`);
|
|
138
75
|
}
|
|
139
|
-
return sanitizeUploadFilename(Buffer.from(match[1], 'base64url').toString('utf8'));
|
|
140
76
|
}
|
|
141
77
|
/** Mint one signed PUT slot for a caller upload. */
|
|
142
78
|
export function mintUploadSlot(store, req) {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
const blobKey = `${UPLOAD_BLOB_PREFIX}/${randomUUID()}/${Buffer.from(filename, 'utf8').toString('base64url')}`;
|
|
146
|
-
const { url, expiresAtMs } = store.signPutUrl(blobKey, mimeType, { ttlMs: UPLOAD_SLOT_TTL_MS });
|
|
147
|
-
const shellName = filename.replace(/'/g, `'\\''`);
|
|
148
|
-
return {
|
|
149
|
-
filename,
|
|
150
|
-
mimeType,
|
|
151
|
-
blobKey,
|
|
152
|
-
method: 'PUT',
|
|
153
|
-
uploadUrl: url,
|
|
154
|
-
expiresAt: formatInstant(new Date(expiresAtMs)).iso,
|
|
155
|
-
// The signature commits to the Content-Type, so the header must match it
|
|
156
|
-
// byte for byte; --fail turns a refused PUT into a non-zero exit.
|
|
157
|
-
curl: `curl -sS --fail -X PUT -H 'Content-Type: ${mimeType}' --data-binary @'<path to ${shellName}>' '${url}'`,
|
|
158
|
-
};
|
|
79
|
+
const { expiresAtMs, ...slot } = sharedMintUploadSlot(store, req, { prefix: UPLOAD_BLOB_PREFIX, ttlMs: UPLOAD_SLOT_TTL_MS });
|
|
80
|
+
return { ...slot, expiresAt: formatInstant(new Date(expiresAtMs)).iso };
|
|
159
81
|
}
|
|
160
82
|
/** A consumed blob object → the upload it holds. */
|
|
161
83
|
export function blobObjectToUpload(key, object) {
|
|
@@ -230,11 +152,11 @@ export function requireBlobStore(store, what) {
|
|
|
230
152
|
throw new Error(`${what} needs the blob store an mcp-host deployment provides, and this server has no blob store (it is a local install). Pass a \`path\` inside the upload directory, or the bytes with \`inline\`.`);
|
|
231
153
|
}
|
|
232
154
|
// ── Attaching in one step (ofw_save_draft / ofw_send_message) ────────────
|
|
233
|
-
export const inlineAttachmentsParam = z.array(inlineFileSchema).max(MAX_FILES_PER_CALL).describe('Files to attach, supplied as base64 BYTES ({filename, contentBase64, mimeType?}). Each is uploaded to My Files
|
|
234
|
-
+ '
|
|
155
|
+
export const inlineAttachmentsParam = z.array(inlineFileSchema).max(MAX_FILES_PER_CALL).describe('Files to attach, supplied as base64 BYTES ({filename, contentBase64, mimeType?}). Each is uploaded to My Files '
|
|
156
|
+
+ '(PRIVATE when a draft holds it; SHARED when sent, as the web app attaches files) and attached alongside any myFileIDs. Use for small files; on a hosted deployment, larger files (phone photos) go faster '
|
|
235
157
|
+ 'through ofw_upload_attachment uploadSlots + blobKeys here. Every entry is validated before anything is uploaded.').optional();
|
|
236
158
|
export const blobKeysParam = z.array(z.string()).max(MAX_FILES_PER_CALL).describe('Hosted deployments: blobKeys from ofw_upload_attachment uploadSlots whose files you have already PUT. Each is uploaded to '
|
|
237
|
-
+ 'My Files
|
|
159
|
+
+ 'My Files (PRIVATE when a draft holds it; SHARED when sent), attached alongside any myFileIDs, and deleted from the upload store.').optional();
|
|
238
160
|
/**
|
|
239
161
|
* Validate every new attachment BEFORE anything is uploaded, so a bad entry
|
|
240
162
|
* fails the call with nothing half-done. With `readBlobs`, blob objects are
|
|
@@ -268,7 +190,8 @@ export function describePending(pending) {
|
|
|
268
190
|
return pending.map((p) => ({ fileName: p.fileName, mimeType: p.mimeType, sizeBytes: p.sizeBytes, sha256: p.sha256, upload: 'PRIVATE, on approval' }));
|
|
269
191
|
}
|
|
270
192
|
/**
|
|
271
|
-
* Upload the planned attachments
|
|
193
|
+
* Upload the planned attachments, in order, under `ctx.shareClass` (PRIVATE
|
|
194
|
+
* when a draft holds them; SHARED at send, as the web app attaches files). A blob is consumed —
|
|
272
195
|
* deleted once OFW has it; a failed delete is a warning, never a failure. Any
|
|
273
196
|
* upload failure stops the batch and throws, naming what DID upload, so the
|
|
274
197
|
* caller can retry with those fileIds instead of uploading them twice.
|
|
@@ -279,7 +202,7 @@ export async function uploadPending(pending, ctx) {
|
|
|
279
202
|
for (const p of pending) {
|
|
280
203
|
try {
|
|
281
204
|
if (p.inline) {
|
|
282
|
-
uploaded.push(await uploadToMyFiles(ctx.client, ctx.cache, p.inline, { shareClass:
|
|
205
|
+
uploaded.push(await uploadToMyFiles(ctx.client, ctx.cache, p.inline, { shareClass: ctx.shareClass }));
|
|
283
206
|
continue;
|
|
284
207
|
}
|
|
285
208
|
const out = await ctx.store.consume(p.blobKey, async (object) => {
|
|
@@ -287,7 +210,7 @@ export async function uploadPending(pending, ctx) {
|
|
|
287
210
|
if (p.sha256 !== null && (await sha256Hex(upload.blob)) !== p.sha256) {
|
|
288
211
|
throw new Error(`${p.fileName} changed in the upload store after it was previewed`);
|
|
289
212
|
}
|
|
290
|
-
return uploadToMyFiles(ctx.client, ctx.cache, upload, { shareClass:
|
|
213
|
+
return uploadToMyFiles(ctx.client, ctx.cache, upload, { shareClass: ctx.shareClass });
|
|
291
214
|
}, { maxBytes: MAX_UPLOAD_BYTES });
|
|
292
215
|
uploaded.push(out.result);
|
|
293
216
|
if (!out.deleted) {
|
|
@@ -298,7 +221,7 @@ export async function uploadPending(pending, ctx) {
|
|
|
298
221
|
const done = uploaded.map((u) => `${u.fileName} (fileId ${u.fileId})`);
|
|
299
222
|
throw new Error(`Attachment ${p.fileName} could not be uploaded: ${e.message}. Nothing was ${ctx.nothingWas}.`
|
|
300
223
|
+ (done.length > 0
|
|
301
|
-
? ` Already uploaded to My Files (
|
|
224
|
+
? ` Already uploaded to My Files (${ctx.shareClass}): ${done.join(', ')} — pass those fileIds in myFileIDs when you retry instead of uploading them again.`
|
|
302
225
|
: ''));
|
|
303
226
|
}
|
|
304
227
|
}
|
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.27.
|
|
7
|
+
export const VERSION = '2.27.1'; // x-release-please-version
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ofw-mcp",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"mcpName": "io.github.chrischall/ofw-mcp",
|
|
6
6
|
"description": "OurFamilyWizard MCP server for Claude — developed and maintained by AI (Claude Code)",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@chrischall/mcp-utils": "^3.
|
|
37
|
+
"@chrischall/mcp-utils": "^3.6.0",
|
|
38
38
|
"@fetchproxy/bootstrap": "^3.6.2",
|
|
39
39
|
"@modelcontextprotocol/server": "^2.3.0",
|
|
40
40
|
"dotenv": "^18.0.0",
|
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.27.
|
|
9
|
+
"version": "2.27.1",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "ofw-mcp",
|
|
14
|
-
"version": "2.27.
|
|
14
|
+
"version": "2.27.1",
|
|
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`.
|
|
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. Everything goes out SHARED (new files uploaded SHARED, PRIVATE ones re-shared), only after approval, and the response's `attachments.verified`/`missing` says what OFW actually attached. |
|
|
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?, 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.
|
|
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. |
|
|
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. |
|