tool-telemetry.mjs
38 lines 1.2 KB
Raw
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd feat(calendar): enforce agent context tiers in retrieval AP… Human minor ⚠ breaking 1 day ago
1 /**
2 * MCP Phase H — progress notifications (notifications/progress) and logging (notifications/message).
3 * @see docs/MCP-PHASE-H.md
4 */
5
6 /**
7 * @param {Record<string, unknown>} extra - McpServer tool handler extra (from SDK)
8 * @param {{ progress: number, total?: number, message?: string }} params
9 */
10 export async function sendMcpToolProgress(extra, params) {
11 const token = extra?._meta?.progressToken;
12 if (token === undefined || typeof extra?.sendNotification !== 'function') return;
13 try {
14 await extra.sendNotification({
15 method: 'notifications/progress',
16 params: {
17 progressToken: token,
18 progress: params.progress,
19 ...(params.total !== undefined ? { total: params.total } : {}),
20 ...(params.message ? { message: params.message } : {}),
21 },
22 });
23 } catch (_) {
24 /* client may not support progress */
25 }
26 }
27
28 /**
29 * @param {import('@modelcontextprotocol/sdk/server/mcp.js').McpServer} mcpServer
30 * @param {'debug'|'info'|'notice'|'warning'|'error'|'critical'|'alert'|'emergency'} level
31 * @param {unknown} data
32 */
33 export async function sendMcpLog(mcpServer, level, data) {
34 if (!mcpServer?.isConnected?.()) return;
35 try {
36 await mcpServer.sendLoggingMessage({ level, data });
37 } catch (_) {}
38 }
File History 2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd feat(calendar): enforce agent context tiers in retrieval AP… Human minor 1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6 docs: accept Calendar Events v0 spec with Phase 0 security … Human 2 days ago