mcp-tool
agent-elements/mcp-toolFreeComponent
agent-elements publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by agent-elements on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://agent-elements.21st.dev/r/mcp-tool.jsonSource
1import { memo, useMemo } from "react";2import { Streamdown } from "streamdown";3import { createCodePlugin } from "@streamdown/code";4import { getToolStatus, areToolPropsEqual } from "../utils/format-tool";5import type { McpToolInfo } from "./tool-registry";6import { ToolRowBase } from "./tool-row-base";78export type McpToolProps = {9 part: any;10 mcpInfo: McpToolInfo;11 chatStatus?: string;12 defaultOpen?: boolean;13};1415const PRIORITY_ARGS = [16 "query",17 "question",18 "email",19 "name",20 "id",21 "customer",22 "url",23 "issue",24 "body",25 "summary",26 "title",27];2829const ACTIVE_VERBS: Record<string, string> = {30 List: "Listing",31 Get: "Getting",32 Create: "Creating",33 Update: "Updating",34 Delete: "Deleting",35 Search: "Searching",36 Fetch: "Fetching",37 Retrieve: "Retrieving",38 Send: "Sending",39 Generate: "Generating",40 Add: "Adding",41 Remove: "Removing",42 Modify: "Modifying",43 Draft: "Drafting",44 Manage: "Managing",45 Query: "Querying",46 Start: "Starting",47 Set: "Setting",48 Check: "Checking",49 Find: "Finding",50};5152const COMPLETED_VERBS: Record<string, string> = {53 List: "Listed",54 Get: "Got",55 Create: "Created",56 Update: "Updated",57 Delete: "Deleted",58 Search: "Searched",59 Fetch: "Fetched",60 Retrieve: "Retrieved",61 Send: "Sent",62 Generate: "Generated",63 Add: "Added",64 Remove: "Removed",65 Modify: "Modified",66 Draft: "Drafted",67 Manage: "Managed",68 Query: "Queried",69 Start: "Started",70 Set: "Set",71 Check: "Checked",72 Find: "Found",73};7475function getActiveTitle(info: McpToolInfo): string {76 const words = info.displayName.split(" ");77 const verb = words[0];78 const rest = words.slice(1).join(" ");79 const active = ACTIVE_VERBS[verb];80 if (active) return rest ? `${active} ${rest}` : active;81 return info.displayName;82}8384function getCompletedTitle(info: McpToolInfo): string {85 const words = info.displayName.split(" ");86 const verb = words[0];87 const rest = words.slice(1).join(" ");88 const completed = COMPLETED_VERBS[verb];89 return completed90 ? rest91 ? `${completed} ${rest}`92 : completed93 : info.displayName;94}9596function formatMcpArgs(input: any): string {97 if (!input || typeof input !== "object") return "";98 const entries = Object.entries(input).filter(99 ([, v]) => v !== undefined && v !== null && v !== "",100 );101 if (entries.length === 0) return "";102103 const sorted = [...entries].sort(([a], [b]) => {104 const ai = PRIORITY_ARGS.indexOf(a);105 const bi = PRIORITY_ARGS.indexOf(b);106// … truncated
More from agent-elements
All 25 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| agent-chatagent-chat | agent-elements | Components | Free | no deps | |
| attachment-buttonattachment-button | agent-elements | Components | Free | no deps | |
| bash-toolbash-tool | agent-elements | Components | Free | no deps | |
| edit-tooledit-tool | agent-elements | Components | Free | no deps | |
| error-messageerror-message | agent-elements | Components | Free | no deps | |
| file-attachmentfile-attachment | agent-elements | Components | Free | no deps | |
| generic-toolgeneric-tool | agent-elements | Components | Free | no deps | |
| input-barinput-bar | agent-elements | Components | Free | no deps |
