Skip to content

Commit f57d18f

Browse files
authored
Merge pull request #1882 from xKevIsDev/mcp-styling
refactor: update styling and structure in ToolInvocations and ToolCallsList components
2 parents 80e857f + 2ce58ef commit f57d18f

File tree

1 file changed

+16
-54
lines changed

1 file changed

+16
-54
lines changed

app/components/chat/ToolInvocations.tsx

Lines changed: 16 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ export const ToolInvocations = memo(({ toolInvocations, toolCallAnnotations, add
105105
<div className="tool-invocation border border-bolt-elements-borderColor flex flex-col overflow-hidden rounded-lg w-full transition-border duration-150">
106106
<div className="flex">
107107
<button
108-
className="flex items-stretch bg-bolt-elements-artifacts-background hover:bg-bolt-elements-artifacts-backgroundHover w-full overflow-hidden"
108+
className="flex items-stretch bg-bolt-elements-background-depth-2 hover:bg-bolt-elements-artifacts-backgroundHover w-full overflow-hidden"
109109
onClick={toggleDetails}
110110
aria-label={showDetails ? 'Collapse details' : 'Expand details'}
111111
>
112112
<div className="p-2.5">
113113
<div className="i-ph:wrench text-xl text-bolt-elements-textSecondary hover:text-bolt-elements-textPrimary transition-colors"></div>
114114
</div>
115-
<div className="border-l border-bolt-elements-borderColor p-2.5 w-full text-left">
115+
<div className="p-2.5 w-full text-left">
116116
<div className="w-full text-bolt-elements-textPrimary font-medium leading-5 text-sm">
117117
MCP Tool Invocations{' '}
118118
{hasToolResults && (
@@ -153,7 +153,7 @@ export const ToolInvocations = memo(({ toolInvocations, toolCallAnnotations, add
153153
>
154154
<div className="bg-bolt-elements-artifacts-borderColor h-[1px]" />
155155

156-
<div className="px-3 py-3 text-left bg-bolt-elements-actions-background">
156+
<div className="px-3 py-3 text-left bg-bolt-elements-background-depth-2">
157157
<ToolCallsList
158158
toolInvocations={toolCalls}
159159
toolCallAnnotations={toolCallAnnotations}
@@ -273,19 +273,12 @@ interface ToolCallsListProps {
273273
theme: Theme;
274274
}
275275

276-
const ToolCallsList = memo(({ toolInvocations, toolCallAnnotations, addToolResult, theme }: ToolCallsListProps) => {
276+
const ToolCallsList = memo(({ toolInvocations, toolCallAnnotations, addToolResult }: ToolCallsListProps) => {
277277
const [expanded, setExpanded] = useState<{ [id: string]: boolean }>({});
278278

279279
// OS detection for shortcut display
280280
const isMac = typeof navigator !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
281281

282-
const toggleExpand = (toolCallId: string) => {
283-
setExpanded((prev) => ({
284-
...prev,
285-
[toolCallId]: !prev[toolCallId],
286-
}));
287-
};
288-
289282
useEffect(() => {
290283
const expandedState: { [id: string]: boolean } = {};
291284
toolInvocations.forEach((inv) => {
@@ -360,51 +353,20 @@ const ToolCallsList = memo(({ toolInvocations, toolCallAnnotations, addToolResul
360353
animate="visible"
361354
transition={{ duration: 0.2, ease: cubicEasingFn }}
362355
>
363-
<div className="">
364-
<div key={toolCallId} className="flex flex-col gap-1">
365-
<div className="flex items-center text-bolt-elements-textSecondary font-semibold text-sm">
366-
<button
367-
onClick={() => toggleExpand(toolCallId)}
368-
className="mr-1 focus:outline-none bg-transparent"
369-
aria-label={expanded[toolCallId] ? 'Collapse' : 'Expand'}
370-
tabIndex={0}
371-
type="button"
372-
>
373-
<span
374-
className={`i-ph:caret-down-bold inline-block transition-transform duration-150 ${expanded[toolCallId] ? '' : '-rotate-90'}`}
375-
/>
376-
</button>
377-
Calling MCP tool{' '}
378-
<span className="ml-0.5 font-light font-mono text-bolt-elements-textPrimary bg-bolt-elements-background-depth-3 px-1.5 py-0.5 rounded-md">
356+
<div className="bg-bolt-elements-background-depth-3 rounded-lg p-2">
357+
<div key={toolCallId} className="flex gap-1">
358+
<div className="flex flex-col items-center ">
359+
<span className="mr-auto font-light font-normal text-md text-bolt-elements-textPrimary rounded-md">
379360
{toolName}
380361
</span>
362+
<span className="text-xs text-bolt-elements-textSecondary font-light break-words max-w-64">
363+
{annotation?.toolDescription}
364+
</span>
381365
</div>
382-
{expanded[toolCallId] && (
383-
<div className="flex gap-3">
384-
<div className="w-[0.1px] min-h-[40px] bg-bolt-elements-background-depth-3 ml-1.5" />
385-
<div className="flex flex-col gap-1 w-full">
386-
<div className="text-bolt-elements-textSecondary text-xs mb-1">
387-
Description:{' '}
388-
<span className="text-bolt-elements-textPrimary font-semibold">
389-
{annotation?.toolDescription}
390-
</span>
391-
</div>
392-
<div className="flex w-full items-stretch space-x-2">
393-
<div className="w-full rounded-md bg-bolt-elements-background-depth-3 p-3 ml-0 border-l-2 border-bolt-elements-borderColor">
394-
<JsonCodeBlock
395-
className="mb-0"
396-
code={JSON.stringify(tool.toolInvocation.args, null, 2)}
397-
theme={theme}
398-
/>
399-
</div>
400-
</div>
401-
</div>
402-
</div>
403-
)}
404-
<div className="flex justify-end gap-2 pt-2.5">
366+
<div className="flex items-center justify-end gap-2 ml-auto">
405367
<button
406368
className={classNames(
407-
'px-2.5 py-1.5 rounded-lg text-xs',
369+
'h-10 px-2.5 py-1.5 rounded-lg text-xs h-auto',
408370
'bg-transparent',
409371
'text-bolt-elements-textTertiary hover:text-bolt-elements-textPrimary',
410372
'transition-all duration-200',
@@ -421,9 +383,9 @@ const ToolCallsList = memo(({ toolInvocations, toolCallAnnotations, addToolResul
421383
</button>
422384
<button
423385
className={classNames(
424-
'inline-flex items-center gap-2 px-3.5 py-1.5 text-xs font-normal rounded-lg transition-colors',
425-
'bg-accent-500 hover:bg-accent-600',
426-
'text-black',
386+
'h-10 inline-flex items-center gap-2 px-3 py-1.5 text-xs font-normal rounded-lg transition-colors',
387+
'bg-bolt-elements-background-depth-2 border border-bolt-elements-borderColor',
388+
'text-accent-500 hover:text-bolt-elements-textPrimary',
427389
'disabled:opacity-50 disabled:cursor-not-allowed',
428390
)}
429391
onClick={() =>

0 commit comments

Comments
 (0)