File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { ReadFilesComponent } from './read-files'
88import { ReadSubtreeComponent } from './read-subtree'
99import { ReadURLComponent } from './read-url'
1010import { RenderUIComponent } from './render-ui'
11+ import { WebSearchComponent } from './web-search'
1112import { RunTerminalCommandComponent } from './run-terminal-command'
1213import { SkillComponent } from './skill'
1314import { StrReplaceComponent } from './str-replace'
@@ -41,6 +42,7 @@ const toolComponentRegistry = new Map<ToolName, ToolComponent>([
4142 [ ReadSubtreeComponent . toolName , ReadSubtreeComponent ] ,
4243 [ ReadURLComponent . toolName , ReadURLComponent ] ,
4344 [ RenderUIComponent . toolName , RenderUIComponent ] ,
45+ [ WebSearchComponent . toolName , WebSearchComponent ] ,
4446 [ WriteTodosComponent . toolName , WriteTodosComponent ] ,
4547 [ StrReplaceComponent . toolName , StrReplaceComponent ] ,
4648 [ SuggestFollowupsComponent . toolName , SuggestFollowupsComponent ] ,
Original file line number Diff line number Diff line change 1+ import { SimpleToolCallItem } from './tool-call-item'
2+ import { defineToolComponent } from './types'
3+
4+ import type { ChatTheme } from '../../types/theme-system'
5+ import type { ToolRenderConfig } from './types'
6+
7+ /**
8+ * UI component for web_search tool.
9+ * Displays the search query in a compact format.
10+ */
11+ export const WebSearchComponent = defineToolComponent ( {
12+ toolName : 'web_search' ,
13+
14+ render ( toolBlock , theme ) : ToolRenderConfig {
15+ const input = toolBlock . input as { query ?: string } | undefined
16+
17+ const query = typeof input ?. query === 'string' ? input . query . trim ( ) : ''
18+
19+ if ( ! query ) {
20+ return { content : null }
21+ }
22+
23+ return {
24+ content : (
25+ < SimpleToolCallItem
26+ name = "Web Search"
27+ description = { query }
28+ descriptionColor = { theme . muted }
29+ />
30+ ) ,
31+ }
32+ } ,
33+ } )
You can’t perform that action at this time.
0 commit comments