Phase 2: Refactor Tools cluster to use MCP SDK types
Replace ad hoc local types with MCP SDK schema types across the Tools group components and ToolsScreen, per the v2 UX interfaces plan. - ToolListItem: accept `tool: Tool` instead of flat `name`/`title` - ToolControls: accept `Tool[]` + `selectedName` instead of `ToolListItemProps[]` - ToolDetailPanel: accept `tool: Tool` instead of flat props; use SDK `ToolAnnotations` (readOnlyHint/destructiveHint/idempotentHint/openWorldHint); use `ProgressNotification['params']` for progress - ToolResultPanel: accept `CallToolResult` instead of `ResultContentItem[]` - ToolsScreen: accept `Tool[]` + `selectedToolName` + `ToolCallState`; derive selected tool via `tools.find()`; own `formValues` state locally - Delete local `ToolAnnotations`, `ResultContentItem` types - Update all stories with real SDK `Tool` fixtures - Update ConnectedView ToolsActive story Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9082e02e65
commit
92ecfcbd6c
1 changed files with 388 additions and 411 deletions
|
|
@ -1,11 +1,12 @@
|
|||
import { useState } from "react";
|
||||
import { Group, ScrollArea, Stack, TextInput, Title } from "@mantine/core";
|
||||
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { ListChangedIndicator } from "../../elements/ListChangedIndicator/ListChangedIndicator";
|
||||
import { ToolListItem } from "../ToolListItem/ToolListItem";
|
||||
import type { ToolListItemProps } from "../ToolListItem/ToolListItem";
|
||||
|
||||
export interface ToolControlsProps {
|
||||
tools: ToolListItemProps[];
|
||||
tools: Tool[];
|
||||
selectedName?: string;
|
||||
listChanged: boolean;
|
||||
onRefreshList: () => void;
|
||||
onSelectTool: (name: string) => void;
|
||||
|
|
@ -17,6 +18,7 @@ function listMaxHeight(): string {
|
|||
|
||||
export function ToolControls({
|
||||
tools,
|
||||
selectedName,
|
||||
listChanged,
|
||||
onRefreshList,
|
||||
onSelectTool,
|
||||
|
|
@ -47,8 +49,11 @@ export function ToolControls({
|
|||
{filteredTools.map((tool) => (
|
||||
<ToolListItem
|
||||
key={tool.name}
|
||||
{...tool}
|
||||
onClick={() => onSelectTool(tool.name)}
|
||||
tool={tool}
|
||||
selected={tool.name === selectedName}
|
||||
onClick={() => {
|
||||
if (tool.name !== selectedName) onSelectTool(tool.name);
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</Stack>
|
||||
|
|
|
|||
Loading…
Reference in a new issue