You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 322f7d1
Browse filesBrowse the repository at this point in the historyBrowse files
Registered and provider tool handlers receive an optional request-bound invocation context:
88
+
89
+
```ts
90
+
ctx.agent.registerTool({
91
+
id: 'my-plugin:build',
92
+
description: 'Build the current project.',
93
+
handler: async (_args, invocation) => {
94
+
awaitinvocation?.reportProgress({
95
+
progress: 1,
96
+
total: 2,
97
+
message: 'Compiling',
98
+
})
99
+
awaitcompileProject()
100
+
awaitinvocation?.reportProgress({
101
+
progress: 2,
102
+
total: 2,
103
+
message: 'Complete',
104
+
})
105
+
},
106
+
})
107
+
```
108
+
109
+
`progress` and `total` are finite numbers, and `progress` increases with every report in one invocation. Reports are delivered in order while the handler is running. MCP callers that provide a progress token receive `notifications/progress`; the reporter is a no-op for callers without one. Agent-enabled RPC functions retain their existing handler signatures, so request-bound progress belongs on registered and provider tools.
A registered or provider tool reported a non-finite `progress` or `total`, or reported `progress` that did not increase from its previous value in the same invocation.
-[`packages/devframe/src/node/host-agent.ts`](https://github.com/devframes/devframe/blob/main/packages/devframe/src/node/host-agent.ts) - `invokeToolHandler()` validates progress before delivering it.
0 commit comments