@invergent/agent-chat-react 1.7.7 → 1.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2060,6 +2060,29 @@ function WebToolBlock({ tc }) {
2060
2060
  displayText && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/70 truncate text-xs", children: displayText })
2061
2061
  ] });
2062
2062
  }
2063
+ function MCPToolBlock({ tc }) {
2064
+ const segments = tc.toolName.replace(/^mcp__/, "").split("__");
2065
+ const toolName = segments[segments.length - 1] ?? tc.toolName;
2066
+ const label = toolName.split("_").map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(" ");
2067
+ let summary = "";
2068
+ try {
2069
+ const args = JSON.parse(tc.args);
2070
+ if (args && typeof args === "object") {
2071
+ const entries = Object.entries(args).filter(([, v]) => v !== void 0 && v !== null && v !== "");
2072
+ if (entries.length > 0) {
2073
+ summary = entries.map(([k, v]) => {
2074
+ const val = typeof v === "string" ? v : JSON.stringify(v);
2075
+ return `${k}=${val}`;
2076
+ }).join(", ");
2077
+ }
2078
+ }
2079
+ } catch {
2080
+ }
2081
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm py-0.5", children: [
2082
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: label }),
2083
+ summary && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60 truncate text-xs", children: summary })
2084
+ ] });
2085
+ }
2063
2086
  function VisionAnalyzeBlock({ tc }) {
2064
2087
  let image = "";
2065
2088
  try {
@@ -4080,6 +4103,9 @@ function ToolCallBlock({
4080
4103
  resolvedArtifactName,
4081
4104
  onFileSelect
4082
4105
  }) {
4106
+ if (tc.toolName.startsWith("mcp__")) {
4107
+ return /* @__PURE__ */ jsx(MCPToolBlock, { tc });
4108
+ }
4083
4109
  switch (tc.toolName) {
4084
4110
  case "terminal":
4085
4111
  return /* @__PURE__ */ jsx(TerminalToolBlock, { tc });