Phase 2: Refactor Sampling/Elicitation cluster to MCP SDK types
Replace ad hoc local types with SDK schema types across the Sampling and Elicitation group components. - SamplingRequestPanel: accept `request: CreateMessageRequestParams` + `draftResult: CreateMessageResult` instead of 16 flat props; derive messages, model preferences, and parameters from the request object; drop `tools`/`toolChoice` (not in MCP 2025-11-25 CreateMessageRequest) - InlineSamplingRequest: accept `request: CreateMessageRequestParams`; derive messagePreview and modelHints from the request - ElicitationFormPanel: accept `request: ElicitRequest['params']` + `serverName`; pass requestedSchema directly to SchemaForm - ElicitationUrlPanel: rename `elicitationId` to `requestId` - InlineElicitationRequest: accept `request: ElicitRequest['params']`; discriminate form vs URL mode on request shape instead of `mode` prop - PendingClientRequests: unchanged (children-based wrapper) - Delete local `SamplingTool` type - Update all stories with real SDK type fixtures Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7b74598f83
commit
c1a63cb37d
2 changed files with 326 additions and 299 deletions
|
|
@ -10,7 +10,7 @@ const meta: Meta<typeof ElicitationUrlPanel> = {
|
|||
onOpenInBrowser: fn(),
|
||||
onCancel: fn(),
|
||||
message: "Please authenticate with the external service.",
|
||||
elicitationId: "elicit-abc-123",
|
||||
requestId: "elicit-abc-123",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
export interface ElicitationUrlPanelProps {
|
||||
message: string;
|
||||
url: string;
|
||||
elicitationId: string;
|
||||
requestId: string;
|
||||
isWaiting: boolean;
|
||||
onCopyUrl: () => void;
|
||||
onOpenInBrowser: () => void;
|
||||
|
|
@ -39,14 +39,14 @@ const MetaText = Text.withProps({
|
|||
c: "dimmed",
|
||||
});
|
||||
|
||||
function formatElicitationId(id: string): string {
|
||||
return `Elicitation ID: ${id}`;
|
||||
function formatRequestId(id: string): string {
|
||||
return `Request ID: ${id}`;
|
||||
}
|
||||
|
||||
export function ElicitationUrlPanel({
|
||||
message,
|
||||
url,
|
||||
elicitationId,
|
||||
requestId,
|
||||
isWaiting,
|
||||
onCopyUrl,
|
||||
onOpenInBrowser,
|
||||
|
|
@ -73,7 +73,7 @@ export function ElicitationUrlPanel({
|
|||
<HintText>Waiting for completion...</HintText>
|
||||
</Group>
|
||||
)}
|
||||
<MetaText>{formatElicitationId(elicitationId)}</MetaText>
|
||||
<MetaText>{formatRequestId(requestId)}</MetaText>
|
||||
<Alert color="yellow" title="Warning">
|
||||
This will open an external URL. Verify the domain before proceeding.
|
||||
</Alert>
|
||||
|
|
|
|||
Loading…
Reference in a new issue