Commit b6289d3
committed
feat(inventory): add ToolHandlerMiddleware for handler wrapping
Add middleware support to tool registration, allowing callers to wrap
handlers with cross-cutting concerns like observability, error tracking,
or request/response modification.
New APIs:
- ToolHandlerMiddleware type for wrapping handlers with tool name context
- RegisterFuncWithMiddleware on ServerTool for single tool registration
- RegisterToolsWithMiddleware on Inventory for bulk tool registration
- RegisterAllWithMiddleware on Inventory for full registration with middleware
This restores the ability for the remote server to wrap handlers that was
lost during the inventory refactor. The remote server needs this to check
result.IsError and context errors for Datadog significance tracking.
Existing RegisterFunc/RegisterTools/RegisterAll APIs unchanged (call
WithMiddleware variants with nil).1 parent e1bc004 commit b6289d3
2 files changed
+35
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
174 | 182 | | |
175 | | - | |
| 183 | + | |
176 | 184 | | |
177 | 185 | | |
178 | 186 | | |
| |||
195 | 203 | | |
196 | 204 | | |
197 | 205 | | |
198 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
199 | 215 | | |
200 | 216 | | |
201 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
86 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
87 | 104 | | |
88 | 105 | | |
89 | 106 | | |
| |||
0 commit comments