From f7312ab33199e34c2e9d33ce3243ae8a3cd7ed70 Mon Sep 17 00:00:00 2001
From: Ola Hungerford
Date: Sat, 15 Feb 2025 04:33:08 -0700
Subject: [PATCH 1/4] Add checkbox for Boolean input params
---
client/package.json | 1 +
client/src/components/ToolsTab.tsx | 25 +++++++++++++++++++++-
client/src/components/ui/checkbox.tsx | 30 +++++++++++++++++++++++++++
client/src/index.css | 4 ++++
4 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 client/src/components/ui/checkbox.tsx
diff --git a/client/package.json b/client/package.json
index e3445da..7278a72 100644
--- a/client/package.json
+++ b/client/package.json
@@ -22,6 +22,7 @@
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.4.1",
+ "@radix-ui/react-checkbox": "^1.1.4",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-select": "^2.1.2",
diff --git a/client/src/components/ToolsTab.tsx b/client/src/components/ToolsTab.tsx
index a3a7ff2..2d7ae6e 100644
--- a/client/src/components/ToolsTab.tsx
+++ b/client/src/components/ToolsTab.tsx
@@ -1,5 +1,6 @@
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { TabsContent } from "@/components/ui/tabs";
@@ -169,6 +170,28 @@ const ToolsTab = ({
{
/* @ts-expect-error value type is currently unknown */
+ value.type === "boolean" ? (
+
+
+ setParams({
+ ...params,
+ [key]: checked
+ })
+ }
+ />
+
+
+ ) : /* @ts-expect-error value type is currently unknown */
value.type === "string" ? (
{Object.entries(selectedTool.inputSchema.properties ?? []).map(
- ([key, value]) => (
-
-
- {
- /* @ts-expect-error value type is currently unknown */
- value.type === "boolean" ? (
+ ([key, value]) => {
+ const prop = value as SchemaProperty;
+ return (
+
+
+ {prop.type === "boolean" ? (
- {/* @ts-expect-error value type is currently unknown */}
- {value.description || "Toggle this option"}
+ {prop.description || "Toggle this option"}
- ) : /* @ts-expect-error value type is currently unknown */
- value.type === "string" ? (
+ ) : prop.type === "string" ? (
- ),
+ )}
+
+ );
+ }
)}