🔧 fix: Await MCP Instructions and Filter Malformed Tool Calls (#10485)

* fix: Await MCP instructions formatting in AgentClient

* fix: don't render or aggregate malformed tool calls

* fix: implement filter for malformed tool call content parts and add tests
This commit is contained in:
Danny Avila 2025-11-13 14:17:47 -05:00 committed by GitHub
parent aff3cd3667
commit cabc8afeac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 467 additions and 9 deletions

View file

@ -144,6 +144,7 @@ const Part = memo(
attachments={attachments}
auth={toolCall.auth}
expires_at={toolCall.expires_at}
isLast={isLast}
/>
);
} else if (toolCall.type === ToolCallTypes.CODE_INTERPRETER) {
@ -192,6 +193,7 @@ const Part = memo(
args={toolCall.function.arguments as string}
name={toolCall.function.name}
output={toolCall.function.output}
isLast={isLast}
/>
);
}

View file

@ -11,6 +11,7 @@ import { logger, cn } from '~/utils';
export default function ToolCall({
initialProgress = 0.1,
isLast = false,
isSubmitting,
name,
args: _args = '',
@ -19,6 +20,7 @@ export default function ToolCall({
auth,
}: {
initialProgress: number;
isLast?: boolean;
isSubmitting: boolean;
name: string;
args: string | Record<string, unknown>;
@ -155,6 +157,10 @@ export default function ToolCall({
};
}, [showInfo, isAnimating]);
if (!isLast && (!function_name || function_name.length === 0) && !output) {
return null;
}
return (
<>
<div className="relative my-2.5 flex h-5 shrink-0 items-center gap-2.5">