MCPcopy Create free account
hub / github.com/ShipSecAI/studio / handleDiscoverServerTools

Function handleDiscoverServerTools

frontend/src/pages/McpLibraryPage.tsx:938–961  ·  view source on GitHub ↗
(serverId: string, image?: string)

Source from the content-addressed store, hash-verified

936 };
937
938 const handleDiscoverServerTools = async (serverId: string, image?: string) => {
939 if (discoveringServerIds.has(serverId)) return;
940
941 setDiscoveringServerIds((prev) => new Set(prev).add(serverId));
942 try {
943 const tools = await discoverTools(serverId, image ? { image } : undefined);
944 toast({
945 title: 'Tool discovery complete',
946 description: `Discovered ${tools.length} tool(s) from this server.`,
947 });
948 } catch (err) {
949 toast({
950 title: 'Discovery failed',
951 description: err instanceof Error ? err.message : 'Failed to discover tools',
952 variant: 'destructive',
953 });
954 } finally {
955 setDiscoveringServerIds((prev) => {
956 const next = new Set(prev);
957 next.delete(serverId);
958 return next;
959 });
960 }
961 };
962
963 const refreshTemplates = async () => {
964 setIsLoadingTemplates(true);

Callers 1

McpLibraryPageFunction · 0.85

Calls 2

hasMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected