add pagination handling for lists

This commit is contained in:
Ashwin Bhat
2024-10-17 16:59:37 -07:00
parent 5f9d11b3a9
commit 24d005ac84
5 changed files with 41 additions and 10 deletions

View File

@@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Send, AlertCircle } from "lucide-react";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Tool } from "mcp-typescript/types.js";
import { ListToolsResult, Tool } from "mcp-typescript/types.js";
import { useState } from "react";
import { Label } from "@/components/ui/label";
import ListPane from "./ListPane";
@@ -15,6 +15,7 @@ const ToolsTab = ({
selectedTool,
setSelectedTool,
toolResult,
nextCursor,
error,
}: {
tools: Tool[];
@@ -23,6 +24,7 @@ const ToolsTab = ({
selectedTool: Tool | null;
setSelectedTool: (tool: Tool) => void;
toolResult: string;
nextCursor: ListToolsResult["nextCursor"];
error: string | null;
}) => {
const [params, setParams] = useState<Record<string, unknown>>({});
@@ -42,7 +44,8 @@ const ToolsTab = ({
</>
)}
title="Tools"
buttonText="List Tools"
buttonText={nextCursor ? "List More Tools" : "List Tools"}
isButtonDisabled={!nextCursor && tools.length > 0}
/>
<div className="bg-white rounded-lg shadow">