MCPcopy Index your code
hub / github.com/winfunc/opcode / renderToolWidget

Function renderToolWidget

src/components/StreamMessage.tsx:183–270  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

181
182 // Function to render the appropriate tool widget
183 const renderToolWidget = () => {
184 // Task tool - for sub-agent tasks
185 if (toolName === "task" && input) {
186 renderedSomething = true;
187 return <TaskWidget description={input.description} prompt={input.prompt} result={toolResult} />;
188 }
189
190 // Edit tool
191 if (toolName === "edit" && input?.file_path) {
192 renderedSomething = true;
193 return <EditWidget {...input} result={toolResult} />;
194 }
195
196 // MultiEdit tool
197 if (toolName === "multiedit" && input?.file_path && input?.edits) {
198 renderedSomething = true;
199 return <MultiEditWidget {...input} result={toolResult} />;
200 }
201
202 // MCP tools (starting with mcp__)
203 if (content.name?.startsWith("mcp__")) {
204 renderedSomething = true;
205 return <MCPWidget toolName={content.name} input={input} result={toolResult} />;
206 }
207
208 // TodoWrite tool
209 if (toolName === "todowrite" && input?.todos) {
210 renderedSomething = true;
211 return <TodoWidget todos={input.todos} result={toolResult} />;
212 }
213
214 // TodoRead tool
215 if (toolName === "todoread") {
216 renderedSomething = true;
217 return <TodoReadWidget todos={input?.todos} result={toolResult} />;
218 }
219
220 // LS tool
221 if (toolName === "ls" && input?.path) {
222 renderedSomething = true;
223 return <LSWidget path={input.path} result={toolResult} />;
224 }
225
226 // Read tool
227 if (toolName === "read" && input?.file_path) {
228 renderedSomething = true;
229 return <ReadWidget filePath={input.file_path} result={toolResult} />;
230 }
231
232 // Glob tool
233 if (toolName === "glob" && input?.pattern) {
234 renderedSomething = true;
235 return <GlobWidget pattern={input.pattern} result={toolResult} />;
236 }
237
238 // Bash tool
239 if (toolName === "bash" && input?.command) {
240 renderedSomething = true;

Callers 1

StreamMessageComponentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected