Support multiline tool inputs

Resolves #39.
This commit is contained in:
Justin Spahr-Summers
2024-11-12 14:59:36 +00:00
parent ab9c130610
commit f7385dd961

View File

@@ -3,7 +3,12 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { TabsContent } from "@/components/ui/tabs"; import { TabsContent } from "@/components/ui/tabs";
import { CallToolResult, ListToolsResult, Tool } from "@modelcontextprotocol/sdk/types.js"; import { Textarea } from "@/components/ui/textarea";
import {
CallToolResult,
ListToolsResult,
Tool,
} from "@modelcontextprotocol/sdk/types.js";
import { AlertCircle, Send } from "lucide-react"; import { AlertCircle, Send } from "lucide-react";
import { useState } from "react"; import { useState } from "react";
import ListPane from "./ListPane"; import ListPane from "./ListPane";
@@ -123,6 +128,23 @@ const ToolsTab = ({
> >
{key} {key}
</Label> </Label>
{
/* @ts-expect-error value type is currently unknown */
value.type === "string" ? (
<Textarea
id={key}
name={key}
// @ts-expect-error value type is currently unknown
placeholder={value.description}
onChange={(e) =>
setParams({
...params,
[key]: e.target.value,
})
}
className="mt-1"
/>
) : (
<Input <Input
// @ts-expect-error value type is currently unknown // @ts-expect-error value type is currently unknown
type={value.type === "number" ? "number" : "text"} type={value.type === "number" ? "number" : "text"}
@@ -140,7 +162,10 @@ const ToolsTab = ({
: e.target.value, : e.target.value,
}) })
} }
className="mt-1"
/> />
)
}
</div> </div>
), ),
)} )}