MCPcopy Create free account
hub / github.com/Noumena-Network/code / wrappedCanUseTool

Method wrappedCanUseTool

src/QueryEngine.ts:263–290  ·  view source on GitHub ↗
(
      tool,
      input,
      toolUseContext,
      assistantMessage,
      toolUseID,
      forceDecision,
    )

Source from the content-addressed store, hash-verified

261
262 // Wrap canUseTool to track permission denials
263 const wrappedCanUseTool: CanUseToolFn = async (
264 tool,
265 input,
266 toolUseContext,
267 assistantMessage,
268 toolUseID,
269 forceDecision,
270 ) => {
271 const result = await canUseTool(
272 tool,
273 input,
274 toolUseContext,
275 assistantMessage,
276 toolUseID,
277 forceDecision,
278 )
279
280 // Track denials for SDK reporting
281 if (result.behavior !== 'allow') {
282 this.permissionDenials.push({
283 tool_name: sdkCompatToolName(tool.name),
284 tool_use_id: toolUseID,
285 tool_input: input,
286 })
287 }
288
289 return result
290 }
291
292 const initialAppState = getAppState()
293 const initialMainLoopModel = userSpecifiedModel

Callers

nothing calls this directly

Calls 2

sdkCompatToolNameFunction · 0.85
canUseToolFunction · 0.50

Tested by

no test coverage detected