feat:toolsbar add array support

This commit is contained in:
kshern
2025-02-24 02:36:52 +08:00
parent e28a64c932
commit 07577fc94b
2 changed files with 45 additions and 24 deletions

View File

@@ -17,11 +17,6 @@ import ListPane from "./ListPane";
import { CompatibilityCallToolResult } from "@modelcontextprotocol/sdk/types.js";
type SchemaProperty = {
type: string;
description?: string;
properties?: Record<string, SchemaProperty>;
};
const ToolsTab = ({
tools,
@@ -168,7 +163,7 @@ const ToolsTab = ({
</p>
{Object.entries(selectedTool.inputSchema.properties ?? []).map(
([key, value]) => {
const prop = value as SchemaProperty;
const prop = value as JsonSchemaType;
return (
<div key={key}>
<Label
@@ -211,15 +206,16 @@ const ToolsTab = ({
}
className="mt-1"
/>
) : prop.type === "object" ? (
) : prop.type === "object"|| prop.type === "array" ? (
<div className="mt-1">
<DynamicJsonForm
schema={
{
type: "object",
type: prop.type,
properties: prop.properties,
description: prop.description,
} as JsonSchemaType
items:prop.items
}
}
value={(params[key] as JsonValue) ?? {}}
onChange={(newValue: JsonValue) => {