From b39c96de7cd9284d7c7fd7ffb55704977a9e513f Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:36:56 +0000 Subject: [PATCH] refactor: revert tab files to main and restore tab disabling --- client/src/App.tsx | 10 +- client/src/components/PromptsTab.tsx | 164 +++++++-------- client/src/components/ResourcesTab.tsx | 273 ++++++++++++------------- client/src/components/ToolsTab.tsx | 218 +++++++++----------- 4 files changed, 312 insertions(+), 353 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 70f3175..b016626 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -509,15 +509,15 @@ const App = () => { className="w-full p-4" > - + Resources - + Prompts - + Tools @@ -525,7 +525,7 @@ const App = () => { Ping - + Sampling {pendingSampleRequests.length > 0 && ( @@ -534,7 +534,7 @@ const App = () => { )} - + Roots diff --git a/client/src/components/PromptsTab.tsx b/client/src/components/PromptsTab.tsx index 5882e7e..df8b8a5 100644 --- a/client/src/components/PromptsTab.tsx +++ b/client/src/components/PromptsTab.tsx @@ -6,9 +6,8 @@ import { TabsContent } from "@/components/ui/tabs"; import { Textarea } from "@/components/ui/textarea"; import { ListPromptsResult } from "@modelcontextprotocol/sdk/types.js"; import { AlertCircle } from "lucide-react"; -import { useState, useContext } from "react"; +import { useState } from "react"; import ListPane from "./ListPane"; -import { CapabilityContext } from "@/lib/contexts"; export type Prompt = { name: string; @@ -41,7 +40,6 @@ const PromptsTab = ({ nextCursor: ListPromptsResult["nextCursor"]; error: string | null; }) => { - const capabilities = useContext(CapabilityContext); const [promptArgs, setPromptArgs] = useState>({}); const handleInputChange = (argName: string, value: string) => { @@ -56,98 +54,86 @@ const PromptsTab = ({ return ( - {!capabilities?.prompts ? ( - - - Feature Not Available - - The connected server does not support prompts. - - - ) : ( - <> - { - setSelectedPrompt(prompt); - setPromptArgs({}); - }} - renderItem={(prompt) => ( - <> - {prompt.name} - {prompt.description} - - )} - title="Prompts" - buttonText={nextCursor ? "List More Prompts" : "List Prompts"} - isButtonDisabled={!nextCursor && prompts.length > 0} - /> + { + setSelectedPrompt(prompt); + setPromptArgs({}); + }} + renderItem={(prompt) => ( + <> + {prompt.name} + {prompt.description} + + )} + title="Prompts" + buttonText={nextCursor ? "List More Prompts" : "List Prompts"} + isButtonDisabled={!nextCursor && prompts.length > 0} + /> -
-
-

- {selectedPrompt ? selectedPrompt.name : "Select a prompt"} -

-
-
- {error ? ( - - - Error - {error} - - ) : selectedPrompt ? ( -
- {selectedPrompt.description && ( -

- {selectedPrompt.description} +

+
+

+ {selectedPrompt ? selectedPrompt.name : "Select a prompt"} +

+
+
+ {error ? ( + + + Error + {error} + + ) : selectedPrompt ? ( +
+ {selectedPrompt.description && ( +

+ {selectedPrompt.description} +

+ )} + {selectedPrompt.arguments?.map((arg) => ( +
+ + + handleInputChange(arg.name, e.target.value) + } + /> + {arg.description && ( +

+ {arg.description} + {arg.required && ( + (Required) + )}

)} - {selectedPrompt.arguments?.map((arg) => ( -
- - - handleInputChange(arg.name, e.target.value) - } - /> - {arg.description && ( -

- {arg.description} - {arg.required && ( - (Required) - )} -

- )} -
- ))} - - {promptContent && ( -