@mindstone/mcp-server-fathom 0.2.3 → 0.3.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/README.md +93 -4
- package/dist/bridge.d.ts +21 -0
- package/dist/bridge.js +66 -2
- package/dist/client.d.ts +6 -1
- package/dist/client.js +24 -3
- package/dist/server.js +3 -1
- package/dist/tools/configure.js +1 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/meetings.js +191 -19
- package/dist/tools/recordings.d.ts +3 -0
- package/dist/tools/recordings.js +76 -0
- package/dist/tools/teams.js +13 -3
- package/dist/tools/webhooks.d.ts +3 -0
- package/dist/tools/webhooks.js +109 -0
- package/dist/types.d.ts +39 -10
- package/dist/untrusted-content.d.ts +33 -0
- package/dist/untrusted-content.js +66 -0
- package/dist/utils.d.ts +7 -0
- package/dist/utils.js +27 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,13 +3,86 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@mindstone/mcp-server-fathom)
|
|
4
4
|
[](./LICENSE)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
List and search meetings, view details, read transcripts, and manage teams via Fathom AI.
|
|
7
|
+
|
|
8
|
+
*Local-only Fathom MCP. Not the official server — built before Fathom shipped theirs; tokens stay on disk and each release goes through our own security review.*
|
|
9
|
+
|
|
10
|
+
## Status
|
|
11
|
+
|
|
12
|
+
- **Version:** [0.3.0](./CHANGELOG.md) · [npm](https://www.npmjs.com/package/@mindstone/mcp-server-fathom)
|
|
13
|
+
- **Auth:** API key ([`FATHOM_API_KEY`](./server.json))
|
|
14
|
+
- **Tools:** [12](./src/tools/) (meetings, transcripts, action items, recordings, teams, webhooks)
|
|
15
|
+
- **Surface:** cloud-api
|
|
16
|
+
- **Machine-readable:** [`STATUS.json`](./STATUS.json)
|
|
17
|
+
|
|
18
|
+
## Why this exists
|
|
19
|
+
|
|
20
|
+
When we built this in early 2026, Fathom had not published an official MCP server, and the community options available at the time were thin and unmaintained — they listed meetings, but did not cover the team and transcript data our meeting-notes workflows depend on. We wrote our own so that any MCP host could pull Fathom transcripts and meeting details with the same credential handling, timeouts, and safety wrapping we apply across the rest of this repository. Fathom has since released an [official MCP server](https://developers.fathom.ai/mcp-docs); we continue to maintain this one because it runs locally on the user's machine and goes through our own security review before each release.
|
|
21
|
+
|
|
22
|
+
## Example interaction
|
|
23
|
+
|
|
24
|
+
> "Pull yesterday's Q3 planning meeting from Fathom and list the action items from the transcript."
|
|
25
|
+
|
|
26
|
+
Tools the host calls:
|
|
27
|
+
1. `list_fathom_meetings` — filtered by date range, finds the meeting and returns its ID.
|
|
28
|
+
2. `get_fathom_meeting` — fetches details, summary, and action items for that meeting ID. (For a cross-meeting view — "what are my open action items from customer calls this week?" — the host calls `get_fathom_action_items` directly.)
|
|
29
|
+
|
|
30
|
+
Response (trimmed):
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"meeting": {
|
|
35
|
+
"recording_id": 123456789,
|
|
36
|
+
"title": "<untrusted-content source=\"fathom:meeting:title\">Q3 planning</untrusted-content>",
|
|
37
|
+
"scheduled_start_time": "2026-05-18T15:00:00Z",
|
|
38
|
+
"action_items": [
|
|
39
|
+
{
|
|
40
|
+
"description": "<untrusted-content source=\"fathom:meeting:action_item\">Lock the JD by Friday</untrusted-content>",
|
|
41
|
+
"completed": false,
|
|
42
|
+
"assignee": { "name": "<untrusted-content source=\"fathom:meeting:assignee_name\">Bob</untrusted-content>", "email": "bob@example.com" }
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
7
48
|
|
|
8
49
|
## Requirements
|
|
9
50
|
|
|
10
51
|
- Node.js 20+
|
|
11
52
|
- npm
|
|
12
53
|
|
|
54
|
+
<!-- BEGIN INSTALL_LINKS: do not edit by hand; regenerated by scripts/gen-install-links.mjs -->
|
|
55
|
+
## One-click install
|
|
56
|
+
|
|
57
|
+
[](cursor://anysphere.cursor-deeplink/mcp/install?name=Fathom&config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBtaW5kc3RvbmUvbWNwLXNlcnZlci1mYXRob20iXSwiZW52Ijp7IkZBVEhPTV9BUElfS0VZIjoiIn19)
|
|
58
|
+
[](vscode:mcp/install?%7B%22name%22%3A%22Fathom%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40mindstone%2Fmcp-server-fathom%22%5D%2C%22env%22%3A%7B%22FATHOM_API_KEY%22%3A%22%22%7D%7D)
|
|
59
|
+
[](vscode-insiders:mcp/install?%7B%22name%22%3A%22Fathom%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40mindstone%2Fmcp-server-fathom%22%5D%2C%22env%22%3A%7B%22FATHOM_API_KEY%22%3A%22%22%7D%7D)
|
|
60
|
+
|
|
61
|
+
After clicking the button, your host will prompt you to fill: `FATHOM_API_KEY`.
|
|
62
|
+
|
|
63
|
+
<details>
|
|
64
|
+
<summary>Manual config for Claude Desktop / Claude Code / Goose / Continue.dev (Fathom)</summary>
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"mcpServers": {
|
|
69
|
+
"Fathom": {
|
|
70
|
+
"command": "npx",
|
|
71
|
+
"args": [
|
|
72
|
+
"-y",
|
|
73
|
+
"@mindstone/mcp-server-fathom"
|
|
74
|
+
],
|
|
75
|
+
"env": {
|
|
76
|
+
"FATHOM_API_KEY": ""
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
</details>
|
|
84
|
+
<!-- END INSTALL_LINKS -->
|
|
85
|
+
|
|
13
86
|
## Quick Start
|
|
14
87
|
|
|
15
88
|
### Install & build
|
|
@@ -74,20 +147,36 @@ node dist/index.js
|
|
|
74
147
|
}
|
|
75
148
|
```
|
|
76
149
|
|
|
77
|
-
## Tools (
|
|
150
|
+
## Tools (12)
|
|
78
151
|
|
|
79
152
|
### Configuration
|
|
80
153
|
- `configure_fathom_api_key` — Configure the Fathom API key
|
|
81
154
|
|
|
82
155
|
### Meetings
|
|
83
|
-
- `list_fathom_meetings` — List meetings with server-side filtering
|
|
84
|
-
- `get_fathom_meeting` — Get details for a single meeting
|
|
156
|
+
- `list_fathom_meetings` — List meetings with server-side filtering (optionally including action items)
|
|
157
|
+
- `get_fathom_meeting` — Get details for a single meeting, including summary and action items
|
|
85
158
|
- `get_fathom_transcript` — Get the transcript for a meeting
|
|
159
|
+
- `get_fathom_meeting_participants` — List the participants of a meeting
|
|
160
|
+
- `get_fathom_action_items` — List action items across meetings (open items by default)
|
|
161
|
+
|
|
162
|
+
### Recordings
|
|
163
|
+
- `request_fathom_recording_download` — Start async generation of a downloadable recording file
|
|
164
|
+
- `get_fathom_recording_download_status` — Poll a download for its short-lived signed URL
|
|
86
165
|
|
|
87
166
|
### Teams
|
|
88
167
|
- `list_fathom_teams` — List all accessible teams
|
|
89
168
|
- `list_fathom_team_members` — List members of a specific team
|
|
90
169
|
|
|
170
|
+
### Webhooks
|
|
171
|
+
- `create_fathom_webhook` — Push new-meeting data (summary, transcript, action items) to an HTTPS URL you control
|
|
172
|
+
- `delete_fathom_webhook` — Delete a webhook by id
|
|
173
|
+
|
|
174
|
+
All caller-controllable text returned by these tools (meeting titles, attendee
|
|
175
|
+
names, AI summaries, transcript lines, action item descriptions, team names) is
|
|
176
|
+
wrapped in `<untrusted-content>` envelopes so the host treats meeting content as
|
|
177
|
+
data, not instructions. The same applies to vendor API error bodies surfaced in
|
|
178
|
+
tool errors, which are additionally truncated.
|
|
179
|
+
|
|
91
180
|
## Licence
|
|
92
181
|
|
|
93
182
|
[FSL-1.1-MIT](./LICENSE) — Functional Source License, Version 1.1, with MIT future licence. The software converts to MIT licence on 2030-04-08.
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Path to bridge state file, supporting both current and legacy env vars.
|
|
3
|
+
*
|
|
4
|
+
* Threat-model note (AGENTS.md security invariant #5): this path is
|
|
5
|
+
* host-injected configuration — the host app sets the env var when it spawns
|
|
6
|
+
* this server, and it points at the host's own state directory (NOT
|
|
7
|
+
* `MCP_WORKSPACE_PATH` or `os.tmpdir()`), so workspace containment does not
|
|
8
|
+
* apply the way it does for model-supplied file paths. The model cannot
|
|
9
|
+
* influence this path. The read is still hardened below:
|
|
10
|
+
*
|
|
11
|
+
* - `O_NOFOLLOW` on the open, so a symlinked FINAL path component is refused
|
|
12
|
+
* atomically (no check-then-use race) on POSIX. Symlinked ANCESTORS stay
|
|
13
|
+
* allowed on purpose: legitimate host state dirs resolve through symlinks
|
|
14
|
+
* (e.g. macOS temp dirs under /var -> /private/var).
|
|
15
|
+
* - An `lstat` pre-check plus a post-open canonical cross-check
|
|
16
|
+
* (realpath inode vs opened-fd inode) for platforms where `O_NOFOLLOW` is
|
|
17
|
+
* not honoured — a swap raced against the open is detected and refused
|
|
18
|
+
* rather than silently read.
|
|
19
|
+
* - Same-descriptor fstat + read-through-fd (regular files only; no
|
|
20
|
+
* check-then-use race on the content itself).
|
|
21
|
+
* - Strict schema validation of the content — a non-integer `port`, for
|
|
22
|
+
* example, would otherwise be interpolated into the loopback URL and could
|
|
23
|
+
* redirect the request off-host.
|
|
3
24
|
*/
|
|
4
25
|
export declare const BRIDGE_STATE_PATH: string;
|
|
5
26
|
/**
|
package/dist/bridge.js
CHANGED
|
@@ -1,19 +1,83 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import { REQUEST_TIMEOUT_MS } from './types.js';
|
|
3
4
|
/**
|
|
4
5
|
* Path to bridge state file, supporting both current and legacy env vars.
|
|
6
|
+
*
|
|
7
|
+
* Threat-model note (AGENTS.md security invariant #5): this path is
|
|
8
|
+
* host-injected configuration — the host app sets the env var when it spawns
|
|
9
|
+
* this server, and it points at the host's own state directory (NOT
|
|
10
|
+
* `MCP_WORKSPACE_PATH` or `os.tmpdir()`), so workspace containment does not
|
|
11
|
+
* apply the way it does for model-supplied file paths. The model cannot
|
|
12
|
+
* influence this path. The read is still hardened below:
|
|
13
|
+
*
|
|
14
|
+
* - `O_NOFOLLOW` on the open, so a symlinked FINAL path component is refused
|
|
15
|
+
* atomically (no check-then-use race) on POSIX. Symlinked ANCESTORS stay
|
|
16
|
+
* allowed on purpose: legitimate host state dirs resolve through symlinks
|
|
17
|
+
* (e.g. macOS temp dirs under /var -> /private/var).
|
|
18
|
+
* - An `lstat` pre-check plus a post-open canonical cross-check
|
|
19
|
+
* (realpath inode vs opened-fd inode) for platforms where `O_NOFOLLOW` is
|
|
20
|
+
* not honoured — a swap raced against the open is detected and refused
|
|
21
|
+
* rather than silently read.
|
|
22
|
+
* - Same-descriptor fstat + read-through-fd (regular files only; no
|
|
23
|
+
* check-then-use race on the content itself).
|
|
24
|
+
* - Strict schema validation of the content — a non-integer `port`, for
|
|
25
|
+
* example, would otherwise be interpolated into the loopback URL and could
|
|
26
|
+
* redirect the request off-host.
|
|
5
27
|
*/
|
|
6
28
|
export const BRIDGE_STATE_PATH = process.env.MCP_HOST_BRIDGE_STATE || process.env.MINDSTONE_REBEL_BRIDGE_STATE || '';
|
|
29
|
+
const bridgeStateSchema = z.object({
|
|
30
|
+
port: z.number().int().min(1).max(65535),
|
|
31
|
+
token: z.string().min(1),
|
|
32
|
+
});
|
|
7
33
|
const loadBridgeState = () => {
|
|
8
34
|
if (!BRIDGE_STATE_PATH)
|
|
9
35
|
return null;
|
|
36
|
+
let fd = null;
|
|
10
37
|
try {
|
|
11
|
-
|
|
12
|
-
|
|
38
|
+
// Best-effort pre-check (the atomic refusal is O_NOFOLLOW below; this
|
|
39
|
+
// gives a clear stderr signal and covers platforms without O_NOFOLLOW).
|
|
40
|
+
if (fs.lstatSync(BRIDGE_STATE_PATH).isSymbolicLink()) {
|
|
41
|
+
console.error('[fathom] bridge state rejected: state path is a symbolic link');
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
fd = fs.openSync(BRIDGE_STATE_PATH, fs.constants.O_RDONLY | fs.constants.O_NOFOLLOW);
|
|
45
|
+
const opened = fs.fstatSync(fd);
|
|
46
|
+
if (!opened.isFile()) {
|
|
47
|
+
console.error('[fathom] bridge state rejected: not a regular file');
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
// Detect-and-refuse a swap raced against the open: the canonical path
|
|
51
|
+
// must resolve to the same file we actually opened.
|
|
52
|
+
const canonical = fs.statSync(fs.realpathSync(BRIDGE_STATE_PATH));
|
|
53
|
+
if (canonical.dev !== opened.dev || canonical.ino !== opened.ino) {
|
|
54
|
+
console.error('[fathom] bridge state rejected: path resolved to a different file than was opened');
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
const raw = fs.readFileSync(fd, 'utf8');
|
|
58
|
+
const parsed = bridgeStateSchema.safeParse(JSON.parse(raw));
|
|
59
|
+
if (!parsed.success) {
|
|
60
|
+
console.error('[fathom] bridge state rejected: content failed schema validation');
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return parsed.data;
|
|
13
64
|
}
|
|
14
65
|
catch {
|
|
66
|
+
// Unreadable, non-JSON, or symlink (ELOOP under O_NOFOLLOW) state file —
|
|
67
|
+
// bridge is simply unavailable; the caller surfaces an observable
|
|
68
|
+
// "Bridge not available" error.
|
|
15
69
|
return null;
|
|
16
70
|
}
|
|
71
|
+
finally {
|
|
72
|
+
if (fd !== null) {
|
|
73
|
+
try {
|
|
74
|
+
fs.closeSync(fd);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// ignore close errors
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
17
81
|
};
|
|
18
82
|
/**
|
|
19
83
|
* Send a request to the host app bridge.
|
package/dist/client.d.ts
CHANGED
|
@@ -7,9 +7,14 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* Make an authenticated request to the Fathom API.
|
|
9
9
|
*
|
|
10
|
+
* Retries 429 responses up to MAX_RATE_LIMIT_RETRIES times, honouring the
|
|
11
|
+
* Retry-After header (falling back to exponential backoff) — the same
|
|
12
|
+
* posture the official Fathom SDKs take.
|
|
13
|
+
*
|
|
10
14
|
* @param path API path relative to base, e.g. `/meetings`
|
|
11
15
|
* @param options Additional fetch options
|
|
16
|
+
* @param retryCount Internal retry counter for rate-limit handling
|
|
12
17
|
* @returns Parsed JSON response
|
|
13
18
|
*/
|
|
14
|
-
export declare function fathomFetch<T>(path: string, options?: RequestInit): Promise<T>;
|
|
19
|
+
export declare function fathomFetch<T>(path: string, options?: RequestInit, retryCount?: number): Promise<T>;
|
|
15
20
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.js
CHANGED
|
@@ -6,14 +6,24 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { getApiKey } from './auth.js';
|
|
8
8
|
import { FathomError, FATHOM_API_BASE, REQUEST_TIMEOUT_MS } from './types.js';
|
|
9
|
+
import { envelopeErrorText } from './utils.js';
|
|
10
|
+
const MAX_RATE_LIMIT_RETRIES = 3;
|
|
11
|
+
// Bound the wait so a busy rate-limit window cannot stall a tool call for
|
|
12
|
+
// minutes; Fathom's window is 60s, so a Retry-After beyond this is pathological.
|
|
13
|
+
const MAX_RATE_LIMIT_WAIT_MS = 60_000;
|
|
9
14
|
/**
|
|
10
15
|
* Make an authenticated request to the Fathom API.
|
|
11
16
|
*
|
|
17
|
+
* Retries 429 responses up to MAX_RATE_LIMIT_RETRIES times, honouring the
|
|
18
|
+
* Retry-After header (falling back to exponential backoff) — the same
|
|
19
|
+
* posture the official Fathom SDKs take.
|
|
20
|
+
*
|
|
12
21
|
* @param path API path relative to base, e.g. `/meetings`
|
|
13
22
|
* @param options Additional fetch options
|
|
23
|
+
* @param retryCount Internal retry counter for rate-limit handling
|
|
14
24
|
* @returns Parsed JSON response
|
|
15
25
|
*/
|
|
16
|
-
export async function fathomFetch(path, options = {}) {
|
|
26
|
+
export async function fathomFetch(path, options = {}, retryCount = 0) {
|
|
17
27
|
const key = getApiKey();
|
|
18
28
|
if (!key) {
|
|
19
29
|
throw new FathomError('Fathom API key not configured', 'AUTH_REQUIRED', 'Use configure_fathom_api_key to set your API key first.');
|
|
@@ -41,17 +51,28 @@ export async function fathomFetch(path, options = {}) {
|
|
|
41
51
|
throw new FathomError('Authentication failed', 'AUTH_FAILED', 'Your Fathom API key is invalid or revoked. Use configure_fathom_api_key to set a new key.');
|
|
42
52
|
}
|
|
43
53
|
if (response.status === 429) {
|
|
54
|
+
if (retryCount < MAX_RATE_LIMIT_RETRIES) {
|
|
55
|
+
const retryAfterSeconds = parseInt(response.headers.get('Retry-After') ?? '', 10);
|
|
56
|
+
const waitMs = Number.isFinite(retryAfterSeconds)
|
|
57
|
+
? Math.min(retryAfterSeconds * 1000, MAX_RATE_LIMIT_WAIT_MS)
|
|
58
|
+
: Math.min(1000 * Math.pow(2, retryCount), 8000);
|
|
59
|
+
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
60
|
+
return fathomFetch(path, options, retryCount + 1);
|
|
61
|
+
}
|
|
44
62
|
const retryAfter = response.headers.get('Retry-After');
|
|
45
63
|
const waitTime = retryAfter ? `${retryAfter} seconds` : 'a moment';
|
|
46
|
-
throw new FathomError(`Rate limited by Fathom API. Please wait ${waitTime} before retrying.`, 'RATE_LIMITED', `Wait ${waitTime} and try again. Fathom limits API requests to 60 calls per minute.`);
|
|
64
|
+
throw new FathomError(`Rate limited by Fathom API after ${MAX_RATE_LIMIT_RETRIES} retries. Please wait ${waitTime} before retrying.`, 'RATE_LIMITED', `Wait ${waitTime} and try again. Fathom limits API requests to 60 calls per minute.`);
|
|
47
65
|
}
|
|
48
66
|
if (response.status === 404) {
|
|
49
67
|
throw new FathomError('Resource not found', 'NOT_FOUND', 'The requested resource does not exist or you do not have permission to access it.');
|
|
50
68
|
}
|
|
51
69
|
if (!response.ok) {
|
|
52
70
|
const errorText = await response.text().catch(() => 'Unknown error');
|
|
53
|
-
throw new FathomError(`Fathom API error (${response.status}): ${errorText}`, 'API_ERROR', 'Check the request parameters and try again.');
|
|
71
|
+
throw new FathomError(`Fathom API error (${response.status}): ${envelopeErrorText(errorText, 'fathom:api.error_body')}`, 'API_ERROR', 'Check the request parameters and try again.');
|
|
54
72
|
}
|
|
73
|
+
// 204 No Content (e.g. webhook deletion) has no body to parse.
|
|
74
|
+
if (response.status === 204)
|
|
75
|
+
return undefined;
|
|
55
76
|
return response.json();
|
|
56
77
|
}
|
|
57
78
|
//# sourceMappingURL=client.js.map
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import { registerConfigureTools, registerMeetingTools, registerTeamTools, } from './tools/index.js';
|
|
3
|
+
import { registerConfigureTools, registerMeetingTools, registerTeamTools, registerRecordingTools, registerWebhookTools, } from './tools/index.js';
|
|
4
4
|
const require = createRequire(import.meta.url);
|
|
5
5
|
const pkg = require('../package.json');
|
|
6
6
|
export function createServer() {
|
|
@@ -11,6 +11,8 @@ export function createServer() {
|
|
|
11
11
|
registerConfigureTools(server);
|
|
12
12
|
registerMeetingTools(server);
|
|
13
13
|
registerTeamTools(server);
|
|
14
|
+
registerRecordingTools(server);
|
|
15
|
+
registerWebhookTools(server);
|
|
14
16
|
return server;
|
|
15
17
|
}
|
|
16
18
|
//# sourceMappingURL=server.js.map
|
package/dist/tools/configure.js
CHANGED
|
@@ -5,7 +5,7 @@ import { FathomError } from '../types.js';
|
|
|
5
5
|
import { withErrorHandling } from '../utils.js';
|
|
6
6
|
export function registerConfigureTools(server) {
|
|
7
7
|
server.registerTool('configure_fathom_api_key', {
|
|
8
|
-
description: '
|
|
8
|
+
description: 'Host-managed setup only. The user adds the Fathom API key in Settings → Connectors in the app. Do not ask for or accept the key in chat. ' +
|
|
9
9
|
'Get your API key from https://fathom.video/customize#api-access-header — ' +
|
|
10
10
|
'click "Add +", select "Generate API Key", name it (e.g., "MCP Server").',
|
|
11
11
|
inputSchema: z.object({
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { registerConfigureTools } from './configure.js';
|
|
2
2
|
export { registerMeetingTools } from './meetings.js';
|
|
3
3
|
export { registerTeamTools } from './teams.js';
|
|
4
|
+
export { registerRecordingTools } from './recordings.js';
|
|
5
|
+
export { registerWebhookTools } from './webhooks.js';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/tools/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { registerConfigureTools } from './configure.js';
|
|
2
2
|
export { registerMeetingTools } from './meetings.js';
|
|
3
3
|
export { registerTeamTools } from './teams.js';
|
|
4
|
+
export { registerRecordingTools } from './recordings.js';
|
|
5
|
+
export { registerWebhookTools } from './webhooks.js';
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
package/dist/tools/meetings.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { fathomFetch } from '../client.js';
|
|
3
3
|
import { withErrorHandling } from '../utils.js';
|
|
4
4
|
import { isConfigured } from '../auth.js';
|
|
5
|
+
import { wrapUntrusted } from '../untrusted-content.js';
|
|
5
6
|
import { FathomError, } from '../types.js';
|
|
6
7
|
function noApiKeyError() {
|
|
7
8
|
return JSON.stringify({
|
|
@@ -9,9 +10,7 @@ function noApiKeyError() {
|
|
|
9
10
|
error: 'Fathom API key not configured',
|
|
10
11
|
resolution: 'To use Fathom, you need to configure an API key first.',
|
|
11
12
|
next_step: {
|
|
12
|
-
action: '
|
|
13
|
-
tool_to_call: 'configure_fathom_api_key',
|
|
14
|
-
tool_parameters: { api_key: '<user_provided_key>' },
|
|
13
|
+
action: 'The user adds the Fathom API key in Settings → Connectors in the app. Do not ask for it in chat.',
|
|
15
14
|
get_key_from: 'https://fathom.video/customize#api-access-header',
|
|
16
15
|
},
|
|
17
16
|
});
|
|
@@ -20,13 +19,18 @@ function noApiKeyError() {
|
|
|
20
19
|
* Find a meeting by its recording ID by scanning through list pages.
|
|
21
20
|
* Fathom API does not have a GET /meetings/{id} endpoint.
|
|
22
21
|
*/
|
|
23
|
-
async function findMeetingByRecordingId(recordingId,
|
|
22
|
+
async function findMeetingByRecordingId(recordingId, options = {}) {
|
|
23
|
+
const maxPages = options.maxPages ?? 10;
|
|
24
24
|
let cursor;
|
|
25
25
|
let pageCount = 0;
|
|
26
26
|
do {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const params = new URLSearchParams();
|
|
28
|
+
if (options.includeActionItems)
|
|
29
|
+
params.set('include_action_items', 'true');
|
|
30
|
+
if (cursor)
|
|
31
|
+
params.set('cursor', cursor);
|
|
32
|
+
const qs = params.toString();
|
|
33
|
+
const path = qs ? `/meetings?${qs}` : '/meetings';
|
|
30
34
|
const response = await fathomFetch(path);
|
|
31
35
|
pageCount++;
|
|
32
36
|
const found = response.items.find((item) => item.recording_id === recordingId);
|
|
@@ -54,6 +58,47 @@ function getSpeakerName(entry) {
|
|
|
54
58
|
return 'Unknown';
|
|
55
59
|
return speaker.display_name || speaker.name || speaker.matched_calendar_invitee_email || speaker.email || 'Unknown';
|
|
56
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Wrap every caller-controllable text field of a meeting (titles, attendee
|
|
63
|
+
* names, AI summary, action items) in an untrusted-content envelope.
|
|
64
|
+
* Meeting content is authored by meeting participants, not by the user, so
|
|
65
|
+
* the host LLM must see it as data, not instructions (invariant #6).
|
|
66
|
+
* Connector-controlled metadata (ids, timestamps, URLs, emails) stays raw.
|
|
67
|
+
*/
|
|
68
|
+
function sanitizeMeeting(meeting) {
|
|
69
|
+
return {
|
|
70
|
+
...meeting,
|
|
71
|
+
title: wrapUntrusted(meeting.title, 'fathom:meeting:title') ?? meeting.title,
|
|
72
|
+
meeting_title: meeting.meeting_title == null
|
|
73
|
+
? meeting.meeting_title
|
|
74
|
+
: (wrapUntrusted(meeting.meeting_title, 'fathom:meeting:title') ?? null),
|
|
75
|
+
calendar_invitees: (meeting.calendar_invitees || []).map((invitee) => ({
|
|
76
|
+
...invitee,
|
|
77
|
+
name: wrapUntrusted(invitee.name, 'fathom:meeting:invitee_name'),
|
|
78
|
+
})),
|
|
79
|
+
recorded_by: meeting.recorded_by
|
|
80
|
+
? {
|
|
81
|
+
...meeting.recorded_by,
|
|
82
|
+
name: wrapUntrusted(meeting.recorded_by.name, 'fathom:meeting:recorder_name'),
|
|
83
|
+
}
|
|
84
|
+
: meeting.recorded_by,
|
|
85
|
+
default_summary: meeting.default_summary
|
|
86
|
+
? {
|
|
87
|
+
template_name: wrapUntrusted(meeting.default_summary.template_name, 'fathom:meeting:summary_template'),
|
|
88
|
+
markdown_formatted: wrapUntrusted(meeting.default_summary.markdown_formatted, 'fathom:meeting:summary'),
|
|
89
|
+
}
|
|
90
|
+
: meeting.default_summary,
|
|
91
|
+
action_items: meeting.action_items
|
|
92
|
+
? meeting.action_items.map((item) => ({
|
|
93
|
+
...item,
|
|
94
|
+
description: wrapUntrusted(item.description, 'fathom:meeting:action_item') ?? item.description,
|
|
95
|
+
assignee: item.assignee
|
|
96
|
+
? { ...item.assignee, name: wrapUntrusted(item.assignee.name, 'fathom:meeting:assignee_name') }
|
|
97
|
+
: item.assignee,
|
|
98
|
+
}))
|
|
99
|
+
: meeting.action_items,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
57
102
|
export function registerMeetingTools(server) {
|
|
58
103
|
server.registerTool('list_fathom_meetings', {
|
|
59
104
|
description: `List meetings from Fathom with server-side filtering.
|
|
@@ -70,6 +115,7 @@ Server-side filters (use these to narrow results efficiently):
|
|
|
70
115
|
- calendar_invitees_domains: Filter by attendee email domains (e.g., find all meetings with acme.com)
|
|
71
116
|
- meeting_type: 'internal' (same org) or 'external' (with outsiders)
|
|
72
117
|
- created_after/created_before: Date range filters (ISO format)
|
|
118
|
+
- include_action_items: Also return each meeting's action items (default false)
|
|
73
119
|
|
|
74
120
|
NOTE: Fathom does NOT have server-side keyword search. To find meetings by keyword, list meetings with filters then examine results yourself, or use get_fathom_transcript to search transcript content.
|
|
75
121
|
|
|
@@ -82,6 +128,7 @@ Rate limit: Fathom allows ~60 API calls/minute.`,
|
|
|
82
128
|
meeting_type: z.enum(['all', 'internal', 'external']).optional().describe('Filter by meeting type'),
|
|
83
129
|
created_after: z.string().optional().describe('ISO date string — only return meetings created after this date'),
|
|
84
130
|
created_before: z.string().optional().describe('ISO date string — only return meetings created before this date'),
|
|
131
|
+
include_action_items: z.boolean().default(false).describe('Include each meeting\'s action items in the response'),
|
|
85
132
|
limit: z.number().min(1).max(100).default(25).describe('Maximum number of results per page'),
|
|
86
133
|
}),
|
|
87
134
|
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
|
|
@@ -106,6 +153,8 @@ Rate limit: Fathom allows ~60 API calls/minute.`,
|
|
|
106
153
|
params.set('created_after', args.created_after);
|
|
107
154
|
if (args.created_before)
|
|
108
155
|
params.set('created_before', args.created_before);
|
|
156
|
+
if (args.include_action_items)
|
|
157
|
+
params.set('include_action_items', 'true');
|
|
109
158
|
let cursor;
|
|
110
159
|
do {
|
|
111
160
|
if (cursor)
|
|
@@ -120,7 +169,7 @@ Rate limit: Fathom allows ~60 API calls/minute.`,
|
|
|
120
169
|
break;
|
|
121
170
|
}
|
|
122
171
|
} while (cursor);
|
|
123
|
-
const trimmedMeetings = meetings.slice(0, limit);
|
|
172
|
+
const trimmedMeetings = meetings.slice(0, limit).map(sanitizeMeeting);
|
|
124
173
|
const hasMore = stoppedEarly || meetings.length > limit;
|
|
125
174
|
return JSON.stringify({
|
|
126
175
|
ok: true,
|
|
@@ -140,6 +189,7 @@ Returns:
|
|
|
140
189
|
- Recording URL and shareable link
|
|
141
190
|
- Calendar invitees with names/emails
|
|
142
191
|
- AI-generated summary (if available)
|
|
192
|
+
- Action items with assignees and completion status (if available)
|
|
143
193
|
|
|
144
194
|
Note: Searches through up to 10 pages of recent meetings. For older meetings,
|
|
145
195
|
use list_fathom_meetings with created_after/created_before date filters first.
|
|
@@ -154,7 +204,7 @@ Rate limit: May use 1-11 API calls depending on meeting position in history.`,
|
|
|
154
204
|
if (!isConfigured())
|
|
155
205
|
return noApiKeyError();
|
|
156
206
|
const recordingId = args.recording_id;
|
|
157
|
-
const meeting = await findMeetingByRecordingId(recordingId);
|
|
207
|
+
const meeting = await findMeetingByRecordingId(recordingId, { includeActionItems: true });
|
|
158
208
|
if (!meeting) {
|
|
159
209
|
return JSON.stringify({
|
|
160
210
|
ok: false,
|
|
@@ -183,11 +233,12 @@ Rate limit: May use 1-11 API calls depending on meeting position in history.`,
|
|
|
183
233
|
summary = null;
|
|
184
234
|
}
|
|
185
235
|
}
|
|
236
|
+
const sanitized = sanitizeMeeting(meeting);
|
|
186
237
|
return JSON.stringify({
|
|
187
238
|
ok: true,
|
|
188
239
|
meeting: {
|
|
189
|
-
title:
|
|
190
|
-
meeting_title:
|
|
240
|
+
title: sanitized.title,
|
|
241
|
+
meeting_title: sanitized.meeting_title,
|
|
191
242
|
recording_id: meeting.recording_id,
|
|
192
243
|
url: meeting.url,
|
|
193
244
|
share_url: meeting.share_url,
|
|
@@ -196,9 +247,15 @@ Rate limit: May use 1-11 API calls depending on meeting position in history.`,
|
|
|
196
247
|
scheduled_end_time: meeting.scheduled_end_time,
|
|
197
248
|
recording_start_time: meeting.recording_start_time,
|
|
198
249
|
recording_end_time: meeting.recording_end_time,
|
|
199
|
-
calendar_invitees:
|
|
200
|
-
recorded_by:
|
|
201
|
-
|
|
250
|
+
calendar_invitees: sanitized.calendar_invitees,
|
|
251
|
+
recorded_by: sanitized.recorded_by,
|
|
252
|
+
action_items: sanitized.action_items ?? null,
|
|
253
|
+
summary: summary
|
|
254
|
+
? {
|
|
255
|
+
template_name: wrapUntrusted(summary.template_name, 'fathom:meeting:summary_template'),
|
|
256
|
+
markdown_formatted: wrapUntrusted(summary.markdown_formatted, 'fathom:meeting:summary'),
|
|
257
|
+
}
|
|
258
|
+
: null,
|
|
202
259
|
},
|
|
203
260
|
});
|
|
204
261
|
}));
|
|
@@ -256,9 +313,20 @@ Use list_fathom_meetings first to find the recording_id.`,
|
|
|
256
313
|
}
|
|
257
314
|
const hasMore = args.start_entry + entries.length < (matchedIndices ? matchedIndices.size : totalCount);
|
|
258
315
|
if (args.format === 'json') {
|
|
316
|
+
const wrappedEntries = entries.map((entry) => ({
|
|
317
|
+
...entry,
|
|
318
|
+
text: wrapUntrusted(entry.text, 'fathom:transcript:text') ?? entry.text,
|
|
319
|
+
speaker: entry.speaker
|
|
320
|
+
? {
|
|
321
|
+
...entry.speaker,
|
|
322
|
+
name: wrapUntrusted(entry.speaker.name, 'fathom:transcript:speaker'),
|
|
323
|
+
display_name: wrapUntrusted(entry.speaker.display_name, 'fathom:transcript:speaker'),
|
|
324
|
+
}
|
|
325
|
+
: entry.speaker,
|
|
326
|
+
}));
|
|
259
327
|
return JSON.stringify({
|
|
260
328
|
ok: true,
|
|
261
|
-
transcript:
|
|
329
|
+
transcript: wrappedEntries,
|
|
262
330
|
count: entries.length,
|
|
263
331
|
totalCount,
|
|
264
332
|
hasMore,
|
|
@@ -267,7 +335,8 @@ Use list_fathom_meetings first to find the recording_id.`,
|
|
|
267
335
|
: {}),
|
|
268
336
|
});
|
|
269
337
|
}
|
|
270
|
-
// Text format (default)
|
|
338
|
+
// Text format (default). Transcript lines are caller-controllable speech,
|
|
339
|
+
// so the whole body goes out inside one untrusted-content envelope.
|
|
271
340
|
const lines = entries.map((entry) => {
|
|
272
341
|
const timestamp = formatTimestamp(entry);
|
|
273
342
|
const speaker = getSpeakerName(entry);
|
|
@@ -277,7 +346,8 @@ Use list_fathom_meetings first to find the recording_id.`,
|
|
|
277
346
|
const header = args.search_query
|
|
278
347
|
? `Transcript: ${directMatchCount} matches for "${args.search_query}" (showing ${entries.length} entries with context, ${totalCount} total in transcript)`
|
|
279
348
|
: `Transcript (${entries.length} of ${totalCount} entries)`;
|
|
280
|
-
|
|
349
|
+
const body = wrapUntrusted(lines.join('\n'), 'fathom:transcript') ?? '';
|
|
350
|
+
return `${header}${hasMore ? ' - more available with start_entry parameter' : ''}\n\n${body}`;
|
|
281
351
|
}));
|
|
282
352
|
server.registerTool('get_fathom_meeting_participants', {
|
|
283
353
|
description: `Get the list of participants for a Fathom meeting by its recording_id.
|
|
@@ -308,7 +378,7 @@ Rate limit: May use 1-11 API calls depending on meeting position in history.`,
|
|
|
308
378
|
});
|
|
309
379
|
}
|
|
310
380
|
const participants = (meeting.calendar_invitees || []).map((invitee) => ({
|
|
311
|
-
name: invitee.name
|
|
381
|
+
name: wrapUntrusted(invitee.name, 'fathom:meeting:invitee_name') ?? null,
|
|
312
382
|
email: invitee.email,
|
|
313
383
|
email_domain: invitee.email_domain || null,
|
|
314
384
|
is_external: invitee.is_external ?? false,
|
|
@@ -316,10 +386,112 @@ Rate limit: May use 1-11 API calls depending on meeting position in history.`,
|
|
|
316
386
|
return JSON.stringify({
|
|
317
387
|
ok: true,
|
|
318
388
|
recording_id: recordingId,
|
|
319
|
-
title: meeting.title,
|
|
389
|
+
title: wrapUntrusted(meeting.title, 'fathom:meeting:title') ?? meeting.title,
|
|
320
390
|
participants,
|
|
321
391
|
count: participants.length,
|
|
322
392
|
});
|
|
323
393
|
}));
|
|
394
|
+
server.registerTool('get_fathom_action_items', {
|
|
395
|
+
description: `List action items across your Fathom meetings — answers "what are my open action items from this week's calls?".
|
|
396
|
+
|
|
397
|
+
Returns a flat list of action items, each with:
|
|
398
|
+
- description, completed status, recording timestamp + playback URL
|
|
399
|
+
- assignee name/email
|
|
400
|
+
- the meeting it came from (recording_id, title, scheduled time)
|
|
401
|
+
|
|
402
|
+
By default only open (incomplete) items are returned; set include_completed=true for all.
|
|
403
|
+
|
|
404
|
+
Server-side filters (same as list_fathom_meetings):
|
|
405
|
+
- teams, recorded_by, calendar_invitees_domains, meeting_type
|
|
406
|
+
- created_after/created_before: Date range filters (ISO format)
|
|
407
|
+
|
|
408
|
+
Note: Fathom has no single-meeting action-item endpoint, so this scans up to
|
|
409
|
+
10 pages of meetings. Narrow with date filters for speed.
|
|
410
|
+
Rate limit: May use 1-10 API calls depending on filters and result volume.`,
|
|
411
|
+
inputSchema: z.object({
|
|
412
|
+
teams: z.array(z.string()).optional().describe('Filter by team names (e.g., ["Sales", "Engineering"])'),
|
|
413
|
+
recorded_by: z.array(z.string()).optional().describe('Filter by email addresses of recorders'),
|
|
414
|
+
calendar_invitees_domains: z.array(z.string()).optional().describe('Filter by attendee email domains'),
|
|
415
|
+
meeting_type: z.enum(['all', 'internal', 'external']).optional().describe('Filter by meeting type'),
|
|
416
|
+
created_after: z.string().optional().describe('ISO date string — only include meetings created after this date'),
|
|
417
|
+
created_before: z.string().optional().describe('ISO date string — only include meetings created before this date'),
|
|
418
|
+
include_completed: z.boolean().default(false).describe('Include completed action items (default: only open items)'),
|
|
419
|
+
limit: z.number().int().min(1).max(200).default(50).describe('Maximum number of action items to return'),
|
|
420
|
+
}),
|
|
421
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
|
|
422
|
+
}, withErrorHandling(async (args) => {
|
|
423
|
+
if (!isConfigured())
|
|
424
|
+
return noApiKeyError();
|
|
425
|
+
const params = new URLSearchParams();
|
|
426
|
+
params.set('include_action_items', 'true');
|
|
427
|
+
if (args.teams)
|
|
428
|
+
args.teams.forEach((t) => params.append('teams[]', t));
|
|
429
|
+
if (args.recorded_by)
|
|
430
|
+
args.recorded_by.forEach((r) => params.append('recorded_by[]', r));
|
|
431
|
+
if (args.calendar_invitees_domains) {
|
|
432
|
+
args.calendar_invitees_domains.forEach((d) => params.append('calendar_invitees_domains[]', d));
|
|
433
|
+
}
|
|
434
|
+
if (args.meeting_type)
|
|
435
|
+
params.set('meeting_type', args.meeting_type);
|
|
436
|
+
if (args.created_after)
|
|
437
|
+
params.set('created_after', args.created_after);
|
|
438
|
+
if (args.created_before)
|
|
439
|
+
params.set('created_before', args.created_before);
|
|
440
|
+
const maxPages = 10;
|
|
441
|
+
let cursor;
|
|
442
|
+
let pageCount = 0;
|
|
443
|
+
let meetingsScanned = 0;
|
|
444
|
+
let limitReached = false;
|
|
445
|
+
const items = [];
|
|
446
|
+
do {
|
|
447
|
+
if (cursor)
|
|
448
|
+
params.set('cursor', cursor);
|
|
449
|
+
const response = await fathomFetch(`/meetings?${params.toString()}`);
|
|
450
|
+
pageCount++;
|
|
451
|
+
for (const meeting of response.items || []) {
|
|
452
|
+
meetingsScanned++;
|
|
453
|
+
for (const item of meeting.action_items || []) {
|
|
454
|
+
if (!args.include_completed && item.completed)
|
|
455
|
+
continue;
|
|
456
|
+
if (items.length >= args.limit) {
|
|
457
|
+
limitReached = true;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
items.push({
|
|
461
|
+
description: wrapUntrusted(item.description, 'fathom:action_item:description') ?? item.description,
|
|
462
|
+
completed: item.completed ?? false,
|
|
463
|
+
user_generated: item.user_generated ?? false,
|
|
464
|
+
recording_timestamp: item.recording_timestamp ?? null,
|
|
465
|
+
recording_playback_url: item.recording_playback_url ?? null,
|
|
466
|
+
assignee: item.assignee
|
|
467
|
+
? {
|
|
468
|
+
name: wrapUntrusted(item.assignee.name, 'fathom:action_item:assignee_name') ?? null,
|
|
469
|
+
email: item.assignee.email ?? null,
|
|
470
|
+
}
|
|
471
|
+
: null,
|
|
472
|
+
meeting: {
|
|
473
|
+
recording_id: meeting.recording_id,
|
|
474
|
+
title: wrapUntrusted(meeting.title, 'fathom:meeting:title') ?? meeting.title,
|
|
475
|
+
scheduled_start_time: meeting.scheduled_start_time,
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
if (limitReached)
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
cursor = response.next_cursor || undefined;
|
|
483
|
+
} while (!limitReached && cursor && pageCount < maxPages);
|
|
484
|
+
const hasMore = limitReached || (cursor !== undefined && cursor !== '' && pageCount >= maxPages);
|
|
485
|
+
return JSON.stringify({
|
|
486
|
+
ok: true,
|
|
487
|
+
action_items: items,
|
|
488
|
+
count: items.length,
|
|
489
|
+
meetingsScanned,
|
|
490
|
+
hasMore,
|
|
491
|
+
...(hasMore
|
|
492
|
+
? { hint: 'More results may exist. Narrow with created_after/created_before or raise limit.' }
|
|
493
|
+
: {}),
|
|
494
|
+
});
|
|
495
|
+
}));
|
|
324
496
|
}
|
|
325
497
|
//# sourceMappingURL=meetings.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { fathomFetch } from '../client.js';
|
|
3
|
+
import { withErrorHandling } from '../utils.js';
|
|
4
|
+
import { isConfigured } from '../auth.js';
|
|
5
|
+
function noApiKeyError() {
|
|
6
|
+
return JSON.stringify({
|
|
7
|
+
ok: false,
|
|
8
|
+
error: 'Fathom API key not configured',
|
|
9
|
+
resolution: 'Use configure_fathom_api_key to set your API key first.',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function formatDownload(download) {
|
|
13
|
+
const file = download.video ?? download.audio ?? null;
|
|
14
|
+
return {
|
|
15
|
+
download_id: download.download_id,
|
|
16
|
+
recording_id: download.recording_id,
|
|
17
|
+
status: download.status,
|
|
18
|
+
...(file
|
|
19
|
+
? {
|
|
20
|
+
url: file.url,
|
|
21
|
+
content_type: file.content_type ?? null,
|
|
22
|
+
file_size_bytes: file.file_size_bytes ?? null,
|
|
23
|
+
expires_at: file.expires_at ?? null,
|
|
24
|
+
}
|
|
25
|
+
: {}),
|
|
26
|
+
...(download.failure_reason ? { failure_reason: download.failure_reason } : {}),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function registerRecordingTools(server) {
|
|
30
|
+
server.registerTool('request_fathom_recording_download', {
|
|
31
|
+
description: `Start generating a downloadable file (video or audio) for a Fathom recording.
|
|
32
|
+
|
|
33
|
+
Fathom generates the file asynchronously: this returns a download_id and an
|
|
34
|
+
initial status. Audio-only recordings often complete immediately; video takes
|
|
35
|
+
longer. Poll with get_fathom_recording_download_status until status is
|
|
36
|
+
'completed', which carries a short-lived signed download URL.
|
|
37
|
+
|
|
38
|
+
Downloads are private to this API key and URLs expire ~24 hours after
|
|
39
|
+
generation — request a fresh download when one expires.
|
|
40
|
+
Rate limit: download requests have their own budget (30 per minute).`,
|
|
41
|
+
inputSchema: z.object({
|
|
42
|
+
recording_id: z.number().int().positive().describe('The recording ID of the meeting (from list_fathom_meetings)'),
|
|
43
|
+
}),
|
|
44
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
45
|
+
}, withErrorHandling(async (args) => {
|
|
46
|
+
if (!isConfigured())
|
|
47
|
+
return noApiKeyError();
|
|
48
|
+
const download = await fathomFetch(`/recordings/${args.recording_id}/download`, { method: 'POST', body: JSON.stringify({}) });
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
ok: true,
|
|
51
|
+
...formatDownload(download),
|
|
52
|
+
...(download.status === 'completed'
|
|
53
|
+
? {}
|
|
54
|
+
: { hint: 'Poll get_fathom_recording_download_status with this download_id until status is completed.' }),
|
|
55
|
+
});
|
|
56
|
+
}));
|
|
57
|
+
server.registerTool('get_fathom_recording_download_status', {
|
|
58
|
+
description: `Check the status of a recording download started with request_fathom_recording_download.
|
|
59
|
+
|
|
60
|
+
Returns status ('processing', 'completed', 'failed', 'expired'). When completed,
|
|
61
|
+
the response includes a short-lived signed url plus content_type,
|
|
62
|
+
file_size_bytes, and expires_at. When failed, failure_reason explains why.
|
|
63
|
+
Rate limit: polling counts against the global 60 calls/minute budget.`,
|
|
64
|
+
inputSchema: z.object({
|
|
65
|
+
recording_id: z.number().int().positive().describe('The recording ID of the meeting'),
|
|
66
|
+
download_id: z.string().min(1).describe('The download ID from request_fathom_recording_download'),
|
|
67
|
+
}),
|
|
68
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: true },
|
|
69
|
+
}, withErrorHandling(async (args) => {
|
|
70
|
+
if (!isConfigured())
|
|
71
|
+
return noApiKeyError();
|
|
72
|
+
const download = await fathomFetch(`/recordings/${args.recording_id}/downloads/${encodeURIComponent(args.download_id)}`);
|
|
73
|
+
return JSON.stringify({ ok: true, ...formatDownload(download) });
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=recordings.js.map
|
package/dist/tools/teams.js
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { fathomFetch } from '../client.js';
|
|
3
3
|
import { withErrorHandling } from '../utils.js';
|
|
4
4
|
import { isConfigured } from '../auth.js';
|
|
5
|
+
import { wrapUntrusted } from '../untrusted-content.js';
|
|
5
6
|
function noApiKeyError() {
|
|
6
7
|
return JSON.stringify({
|
|
7
8
|
ok: false,
|
|
@@ -30,11 +31,15 @@ Use this to find team names for filtering meetings with list_fathom_meetings or
|
|
|
30
31
|
const response = await fathomFetch(path);
|
|
31
32
|
const items = response.items || [];
|
|
32
33
|
for (const item of items) {
|
|
34
|
+
// Team names are org-authored text — envelope before returning.
|
|
33
35
|
if (typeof item === 'string') {
|
|
34
|
-
allTeams.push({ name: item });
|
|
36
|
+
allTeams.push({ name: wrapUntrusted(item, 'fathom:team:name') ?? item });
|
|
35
37
|
}
|
|
36
38
|
else {
|
|
37
|
-
allTeams.push(
|
|
39
|
+
allTeams.push({
|
|
40
|
+
...item,
|
|
41
|
+
name: wrapUntrusted(item.name, 'fathom:team:name') ?? item.name,
|
|
42
|
+
});
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
cursor = response.next_cursor || undefined;
|
|
@@ -64,7 +69,12 @@ Use list_fathom_teams first to get available team names.`,
|
|
|
64
69
|
const cursorParam = cursor ? `&cursor=${encodeURIComponent(cursor)}` : '';
|
|
65
70
|
const path = `/team_members?team=${teamParam}${cursorParam}`;
|
|
66
71
|
const response = await fathomFetch(path);
|
|
67
|
-
|
|
72
|
+
for (const item of response.items || []) {
|
|
73
|
+
members.push({
|
|
74
|
+
...item,
|
|
75
|
+
name: wrapUntrusted(item.name, 'fathom:team:member_name'),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
68
78
|
cursor = response.next_cursor || undefined;
|
|
69
79
|
} while (cursor);
|
|
70
80
|
return JSON.stringify({ ok: true, teamMembers: members, count: members.length });
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { fathomFetch } from '../client.js';
|
|
3
|
+
import { withErrorHandling } from '../utils.js';
|
|
4
|
+
import { isConfigured } from '../auth.js';
|
|
5
|
+
function noApiKeyError() {
|
|
6
|
+
return JSON.stringify({
|
|
7
|
+
ok: false,
|
|
8
|
+
error: 'Fathom API key not configured',
|
|
9
|
+
resolution: 'Use configure_fathom_api_key to set your API key first.',
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function registerWebhookTools(server) {
|
|
13
|
+
server.registerTool('create_fathom_webhook', {
|
|
14
|
+
description: `Create a Fathom webhook that POSTs new-meeting data to a URL you control.
|
|
15
|
+
|
|
16
|
+
This enables post-meeting automations (e.g. push action items or summaries into
|
|
17
|
+
another system) without polling. Fathom signs deliveries; the returned secret
|
|
18
|
+
verifies the webhook-signature header on incoming requests.
|
|
19
|
+
|
|
20
|
+
Parameters:
|
|
21
|
+
- destination_url: Publicly reachable HTTPS endpoint that will receive POSTs
|
|
22
|
+
- triggered_for: Which recordings fire the webhook (at least one):
|
|
23
|
+
- my_recordings: your own recordings (and those you shared with individuals)
|
|
24
|
+
- shared_external_recordings: recordings other users shared with you
|
|
25
|
+
- my_shared_with_team_recordings: (Team plans) recordings you shared with teams
|
|
26
|
+
- shared_team_recordings: (Team plans) recordings from teammates you can access
|
|
27
|
+
- include_transcript / include_summary / include_action_items / include_crm_matches:
|
|
28
|
+
Payload content flags — at least one must be true
|
|
29
|
+
|
|
30
|
+
NOTE: There is no list-webhooks API. Save the returned id (needed for
|
|
31
|
+
delete_fathom_webhook) and secret (needed to verify signatures) — the secret
|
|
32
|
+
is only returned at creation time.`,
|
|
33
|
+
inputSchema: z.object({
|
|
34
|
+
destination_url: z
|
|
35
|
+
.string()
|
|
36
|
+
.url()
|
|
37
|
+
.refine((u) => u.startsWith('https://'), { message: 'destination_url must use https://' })
|
|
38
|
+
.describe('Publicly reachable HTTPS URL that receives webhook POSTs'),
|
|
39
|
+
triggered_for: z
|
|
40
|
+
.array(z.enum([
|
|
41
|
+
'my_recordings',
|
|
42
|
+
'shared_external_recordings',
|
|
43
|
+
'my_shared_with_team_recordings',
|
|
44
|
+
'shared_team_recordings',
|
|
45
|
+
]))
|
|
46
|
+
.min(1)
|
|
47
|
+
.describe('Which recordings trigger the webhook (at least one)'),
|
|
48
|
+
include_transcript: z.boolean().default(false).describe('Include the meeting transcript in the payload'),
|
|
49
|
+
include_summary: z.boolean().default(false).describe('Include the AI summary in the payload'),
|
|
50
|
+
include_action_items: z.boolean().default(false).describe('Include action items in the payload'),
|
|
51
|
+
include_crm_matches: z.boolean().default(false).describe('Include CRM matches in the payload (requires a linked CRM)'),
|
|
52
|
+
}),
|
|
53
|
+
// Creates a live subscription that pushes meeting data to an external URL.
|
|
54
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
|
|
55
|
+
}, withErrorHandling(async (args) => {
|
|
56
|
+
if (!isConfigured())
|
|
57
|
+
return noApiKeyError();
|
|
58
|
+
if (!args.include_transcript &&
|
|
59
|
+
!args.include_summary &&
|
|
60
|
+
!args.include_action_items &&
|
|
61
|
+
!args.include_crm_matches) {
|
|
62
|
+
return JSON.stringify({
|
|
63
|
+
ok: false,
|
|
64
|
+
error: 'At least one payload flag must be true',
|
|
65
|
+
resolution: 'Set include_transcript, include_summary, include_action_items, or include_crm_matches to true — Fathom rejects webhooks with an empty payload.',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const webhook = await fathomFetch('/webhooks', {
|
|
69
|
+
method: 'POST',
|
|
70
|
+
body: JSON.stringify({
|
|
71
|
+
destination_url: args.destination_url,
|
|
72
|
+
triggered_for: args.triggered_for,
|
|
73
|
+
include_transcript: args.include_transcript,
|
|
74
|
+
include_summary: args.include_summary,
|
|
75
|
+
include_action_items: args.include_action_items,
|
|
76
|
+
include_crm_matches: args.include_crm_matches,
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
return JSON.stringify({
|
|
80
|
+
ok: true,
|
|
81
|
+
webhook: {
|
|
82
|
+
id: webhook.id,
|
|
83
|
+
url: webhook.url,
|
|
84
|
+
created_at: webhook.created_at ?? null,
|
|
85
|
+
triggered_for: webhook.triggered_for ?? args.triggered_for,
|
|
86
|
+
},
|
|
87
|
+
secret: webhook.secret,
|
|
88
|
+
note: 'Store the secret securely — it verifies the webhook-signature header on deliveries and is only returned once. Keep the id for delete_fathom_webhook.',
|
|
89
|
+
});
|
|
90
|
+
}));
|
|
91
|
+
server.registerTool('delete_fathom_webhook', {
|
|
92
|
+
description: `Delete a Fathom webhook by its id, stopping meeting-data deliveries to its destination URL.
|
|
93
|
+
|
|
94
|
+
The id is returned by create_fathom_webhook (there is no list-webhooks API).
|
|
95
|
+
Rate limit: Counts as 1 API call (Fathom allows ~60/minute).`,
|
|
96
|
+
inputSchema: z.object({
|
|
97
|
+
webhook_id: z.string().min(1).describe('The webhook id returned by create_fathom_webhook'),
|
|
98
|
+
}),
|
|
99
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
|
|
100
|
+
}, withErrorHandling(async (args) => {
|
|
101
|
+
if (!isConfigured())
|
|
102
|
+
return noApiKeyError();
|
|
103
|
+
await fathomFetch(`/webhooks/${encodeURIComponent(args.webhook_id)}`, {
|
|
104
|
+
method: 'DELETE',
|
|
105
|
+
});
|
|
106
|
+
return JSON.stringify({ ok: true, message: `Webhook ${args.webhook_id} deleted.` });
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=webhooks.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -24,6 +24,18 @@ export interface TranscriptEntry {
|
|
|
24
24
|
export interface TranscriptResponse {
|
|
25
25
|
transcript: TranscriptEntry[];
|
|
26
26
|
}
|
|
27
|
+
export interface ActionItem {
|
|
28
|
+
description: string;
|
|
29
|
+
user_generated?: boolean;
|
|
30
|
+
completed?: boolean;
|
|
31
|
+
recording_timestamp?: string;
|
|
32
|
+
recording_playback_url?: string;
|
|
33
|
+
assignee?: {
|
|
34
|
+
name?: string;
|
|
35
|
+
email?: string;
|
|
36
|
+
team?: string | null;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
27
39
|
export interface MeetingItem {
|
|
28
40
|
title: string;
|
|
29
41
|
meeting_title: string | null;
|
|
@@ -53,16 +65,7 @@ export interface MeetingItem {
|
|
|
53
65
|
template_name?: string;
|
|
54
66
|
markdown_formatted?: string;
|
|
55
67
|
} | null;
|
|
56
|
-
action_items?:
|
|
57
|
-
description: string;
|
|
58
|
-
user_generated?: boolean;
|
|
59
|
-
completed?: boolean;
|
|
60
|
-
recording_timestamp?: string;
|
|
61
|
-
assignee?: {
|
|
62
|
-
name?: string;
|
|
63
|
-
email?: string;
|
|
64
|
-
};
|
|
65
|
-
}> | null;
|
|
68
|
+
action_items?: ActionItem[] | null;
|
|
66
69
|
}
|
|
67
70
|
export interface MeetingsListResponse {
|
|
68
71
|
limit: number;
|
|
@@ -95,4 +98,30 @@ export interface SummaryResponse {
|
|
|
95
98
|
markdown_formatted?: string;
|
|
96
99
|
};
|
|
97
100
|
}
|
|
101
|
+
export interface RecordingDownloadFile {
|
|
102
|
+
url: string;
|
|
103
|
+
content_type?: string;
|
|
104
|
+
file_size_bytes?: number;
|
|
105
|
+
expires_at?: string;
|
|
106
|
+
}
|
|
107
|
+
export interface RecordingDownload {
|
|
108
|
+
download_id: string;
|
|
109
|
+
recording_id: number;
|
|
110
|
+
status: 'processing' | 'completed' | 'failed' | 'expired';
|
|
111
|
+
video?: RecordingDownloadFile;
|
|
112
|
+
audio?: RecordingDownloadFile;
|
|
113
|
+
failure_reason?: 'generation_failed' | 'generation_timeout';
|
|
114
|
+
}
|
|
115
|
+
export type WebhookTrigger = 'my_recordings' | 'shared_external_recordings' | 'my_shared_with_team_recordings' | 'shared_team_recordings';
|
|
116
|
+
export interface Webhook {
|
|
117
|
+
id: string;
|
|
118
|
+
url: string;
|
|
119
|
+
secret: string;
|
|
120
|
+
created_at?: string;
|
|
121
|
+
include_transcript?: boolean;
|
|
122
|
+
include_crm_matches?: boolean;
|
|
123
|
+
include_summary?: boolean;
|
|
124
|
+
include_action_items?: boolean;
|
|
125
|
+
triggered_for?: WebhookTrigger[];
|
|
126
|
+
}
|
|
98
127
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md security invariant #6 — content fetched from an external system
|
|
3
|
+
* MUST be wrapped in an `<untrusted-content source="…">…</untrusted-content>`
|
|
4
|
+
* envelope (with close-tag breakout escaping) before it is returned to the
|
|
5
|
+
* LLM, so the model treats third-party / attacker-controllable text as DATA,
|
|
6
|
+
* not as instructions.
|
|
7
|
+
*
|
|
8
|
+
* This is the canonical implementation a new connector ships with. It is a
|
|
9
|
+
* VENDORED copy of the shared reference in `test-harness/src/untrusted-content.ts`
|
|
10
|
+
* — connectors cannot `import` the test-harness at runtime (it is a
|
|
11
|
+
* test/dev-only `file:` dependency that is never published into a connector's
|
|
12
|
+
* `dist/`), so the helper lives in the connector's own runtime source. Keep
|
|
13
|
+
* this byte-for-byte in sync with the shared reference; do NOT weaken the
|
|
14
|
+
* escaping back to a simple `replaceAll` (that family misses whitespace / case
|
|
15
|
+
* close-tag variants like `</untrusted-content >` / `</UNTRUSTED-CONTENT>`).
|
|
16
|
+
*
|
|
17
|
+
* `scripts/check-untrusted-coverage.mjs` greps for a reference to
|
|
18
|
+
* `untrusted-content` in any connector that talks to an external system; this
|
|
19
|
+
* file (and the call sites that import from it) is what satisfies that gate.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Wrap a single untrusted string in an `<untrusted-content source="…">`
|
|
23
|
+
* envelope, escaping any embedded close-tag variant so the envelope cannot be
|
|
24
|
+
* broken out of. `undefined` passes through untouched. Idempotent for the same
|
|
25
|
+
* `source`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function wrapUntrusted(text: string | null | undefined, source: string): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Recursively wrap every string value reachable inside `value`. Object keys are
|
|
30
|
+
* structural and NOT wrapped; non-string leaves pass through unchanged.
|
|
31
|
+
*/
|
|
32
|
+
export declare function wrapUntrustedJsonStrings<T>(value: T, source: string): T;
|
|
33
|
+
//# sourceMappingURL=untrusted-content.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md security invariant #6 — content fetched from an external system
|
|
3
|
+
* MUST be wrapped in an `<untrusted-content source="…">…</untrusted-content>`
|
|
4
|
+
* envelope (with close-tag breakout escaping) before it is returned to the
|
|
5
|
+
* LLM, so the model treats third-party / attacker-controllable text as DATA,
|
|
6
|
+
* not as instructions.
|
|
7
|
+
*
|
|
8
|
+
* This is the canonical implementation a new connector ships with. It is a
|
|
9
|
+
* VENDORED copy of the shared reference in `test-harness/src/untrusted-content.ts`
|
|
10
|
+
* — connectors cannot `import` the test-harness at runtime (it is a
|
|
11
|
+
* test/dev-only `file:` dependency that is never published into a connector's
|
|
12
|
+
* `dist/`), so the helper lives in the connector's own runtime source. Keep
|
|
13
|
+
* this byte-for-byte in sync with the shared reference; do NOT weaken the
|
|
14
|
+
* escaping back to a simple `replaceAll` (that family misses whitespace / case
|
|
15
|
+
* close-tag variants like `</untrusted-content >` / `</UNTRUSTED-CONTENT>`).
|
|
16
|
+
*
|
|
17
|
+
* `scripts/check-untrusted-coverage.mjs` greps for a reference to
|
|
18
|
+
* `untrusted-content` in any connector that talks to an external system; this
|
|
19
|
+
* file (and the call sites that import from it) is what satisfies that gate.
|
|
20
|
+
*/
|
|
21
|
+
const UNTRUSTED_CLOSE_TAG_VARIANT = /<\/untrusted-content\s*>/gi;
|
|
22
|
+
const ESCAPED_UNTRUSTED_CLOSE_TAG = '<\\/untrusted-content>';
|
|
23
|
+
function escapeAttr(s) {
|
|
24
|
+
return s.replaceAll('&', '&').replaceAll('"', '"').replaceAll('<', '<').replaceAll('>', '>');
|
|
25
|
+
}
|
|
26
|
+
function escapeCloseTagSentinels(s) {
|
|
27
|
+
return s.replace(UNTRUSTED_CLOSE_TAG_VARIANT, ESCAPED_UNTRUSTED_CLOSE_TAG);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Wrap a single untrusted string in an `<untrusted-content source="…">`
|
|
31
|
+
* envelope, escaping any embedded close-tag variant so the envelope cannot be
|
|
32
|
+
* broken out of. `undefined` passes through untouched. Idempotent for the same
|
|
33
|
+
* `source`.
|
|
34
|
+
*/
|
|
35
|
+
export function wrapUntrusted(text, source) {
|
|
36
|
+
if (text === undefined || text === null)
|
|
37
|
+
return undefined;
|
|
38
|
+
const open = `<untrusted-content source="${escapeAttr(source)}">`;
|
|
39
|
+
const close = '</untrusted-content>';
|
|
40
|
+
if (text.startsWith(open) && text.endsWith(close) && text.length >= open.length + close.length) {
|
|
41
|
+
const inner = text.slice(open.length, text.length - close.length);
|
|
42
|
+
if (!UNTRUSTED_CLOSE_TAG_VARIANT.test(inner)) {
|
|
43
|
+
UNTRUSTED_CLOSE_TAG_VARIANT.lastIndex = 0;
|
|
44
|
+
return text;
|
|
45
|
+
}
|
|
46
|
+
UNTRUSTED_CLOSE_TAG_VARIANT.lastIndex = 0;
|
|
47
|
+
}
|
|
48
|
+
return `${open}${escapeCloseTagSentinels(text)}${close}`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Recursively wrap every string value reachable inside `value`. Object keys are
|
|
52
|
+
* structural and NOT wrapped; non-string leaves pass through unchanged.
|
|
53
|
+
*/
|
|
54
|
+
export function wrapUntrustedJsonStrings(value, source) {
|
|
55
|
+
if (typeof value === 'string') {
|
|
56
|
+
return wrapUntrusted(value, source);
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(value)) {
|
|
59
|
+
return value.map((item) => wrapUntrustedJsonStrings(item, source));
|
|
60
|
+
}
|
|
61
|
+
if (value && typeof value === 'object') {
|
|
62
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, wrapUntrustedJsonStrings(item, source)]));
|
|
63
|
+
}
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=untrusted-content.js.map
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
type ToolHandler<T> = (args: T, extra: unknown) => Promise<CallToolResult>;
|
|
3
|
+
/**
|
|
4
|
+
* Make externally-influenced error text safe for model output: truncate it,
|
|
5
|
+
* then wrap it in an `<untrusted-content>` envelope (invariant #6). Vendor
|
|
6
|
+
* error bodies and JSON.parse diagnostics can embed response-body fragments —
|
|
7
|
+
* attacker-influenceable text that must be treated as data, not instructions.
|
|
8
|
+
*/
|
|
9
|
+
export declare function envelopeErrorText(text: string, source: string): string;
|
|
3
10
|
/**
|
|
4
11
|
* Wraps a tool handler with standard error handling.
|
|
5
12
|
*
|
package/dist/utils.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { FathomError } from './types.js';
|
|
2
|
+
import { wrapUntrusted } from './untrusted-content.js';
|
|
3
|
+
// Cap vendor-supplied error text so a pathological response body cannot flood
|
|
4
|
+
// the model's context.
|
|
5
|
+
const MAX_ERROR_TEXT_CHARS = 500;
|
|
6
|
+
/**
|
|
7
|
+
* Make externally-influenced error text safe for model output: truncate it,
|
|
8
|
+
* then wrap it in an `<untrusted-content>` envelope (invariant #6). Vendor
|
|
9
|
+
* error bodies and JSON.parse diagnostics can embed response-body fragments —
|
|
10
|
+
* attacker-influenceable text that must be treated as data, not instructions.
|
|
11
|
+
*/
|
|
12
|
+
export function envelopeErrorText(text, source) {
|
|
13
|
+
const truncated = text.length > MAX_ERROR_TEXT_CHARS ? `${text.slice(0, MAX_ERROR_TEXT_CHARS)} [truncated]` : text;
|
|
14
|
+
// `truncated` is always a string, so wrapUntrusted never returns undefined here.
|
|
15
|
+
return wrapUntrusted(truncated, source) ?? truncated;
|
|
16
|
+
}
|
|
2
17
|
/**
|
|
3
18
|
* Wraps a tool handler with standard error handling.
|
|
4
19
|
*
|
|
@@ -32,8 +47,19 @@ export function withErrorHandling(fn) {
|
|
|
32
47
|
};
|
|
33
48
|
}
|
|
34
49
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
50
|
+
// Unhandled-error messages can embed response-body fragments (e.g.
|
|
51
|
+
// JSON.parse diagnostics quote the malformed payload), so they are
|
|
52
|
+
// enveloped as untrusted content too.
|
|
35
53
|
return {
|
|
36
|
-
content: [
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: JSON.stringify({
|
|
58
|
+
ok: false,
|
|
59
|
+
error: envelopeErrorText(errorMessage, 'fathom:unhandled_error'),
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
37
63
|
isError: true,
|
|
38
64
|
};
|
|
39
65
|
}
|
package/package.json
CHANGED