File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,10 @@ export async function* processStreamWithTags(
101101 }
102102
103103 const toolName = parsedParams [ toolNameParam ] as keyof typeof processors
104- const processor = processors [ toolName ] ?? defaultProcessor ( toolName )
104+ const processor =
105+ typeof toolName === 'string'
106+ ? processors [ toolName ] ?? defaultProcessor ( toolName )
107+ : undefined
105108 if ( ! processor ) {
106109 trackEvent (
107110 AnalyticsEvent . UNKNOWN_TOOL_CALL ,
@@ -114,6 +117,11 @@ export async function* processStreamWithTags(
114117 autocompleted,
115118 } ,
116119 )
120+ onError (
121+ 'parse_error' ,
122+ `Unknown tool ${ JSON . stringify ( toolName ) } for tool call: ${ contents } ` ,
123+ )
124+ return
117125 }
118126
119127 trackEvent ( AnalyticsEvent . TOOL_USE , loggerOptions ?. userId ?? '' , {
You can’t perform that action at this time.
0 commit comments