File tree Expand file tree Collapse file tree
packages/runtime/src/service-adapters/anthropic Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,6 +244,7 @@ export class AnthropicAdapter implements CopilotServiceAdapter {
244244 forwardedParameters,
245245 } = request ;
246246 const tools = actions . map ( convertActionInputToAnthropicTool ) ;
247+ const knownActionNames = new Set ( actions . map ( ( a ) => a . name ) ) ;
247248
248249 const messages = [ ...rawMessages ] ;
249250
@@ -381,6 +382,11 @@ export class AnthropicAdapter implements CopilotServiceAdapter {
381382 filterThinkingTextBuffer . reset ( ) ;
382383 mode = "message" ;
383384 } else if ( chunk . content_block . type === "tool_use" ) {
385+ if ( ! knownActionNames . has ( chunk . content_block . name ) ) {
386+ // Unknown tool - skip execution to prevent crashes
387+ mode = null ;
388+ continue ;
389+ }
384390 currentToolCallId = chunk . content_block . id ;
385391 eventStream$ . sendActionExecutionStart ( {
386392 actionExecutionId : currentToolCallId ,
You can’t perform that action at this time.
0 commit comments