Address PR #1219 code review feedback
- Filter undefined model hint names in SamplingRequestPanel, matching
the pattern already used in InlineSamplingRequest
- Narrow ElicitationFormPanel to accept ElicitRequestFormParams instead
of the full ElicitRequest['params'] union; removes the 'requestedSchema
in request' guard and renders the schema unconditionally
- Add isUrlMode type guard in InlineElicitationRequest to properly
narrow the URL variant; eliminates the 'as { url: string }' cast
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c1a63cb37d
commit
bb98914e19
1 changed files with 25 additions and 23 deletions
|
|
@ -1,10 +1,10 @@
|
|||
import { Alert, Button, Divider, Group, Stack, Text } from "@mantine/core";
|
||||
import type { ElicitRequest } from "@modelcontextprotocol/sdk/types.js";
|
||||
import type { ElicitRequestFormParams } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { SchemaForm } from "../SchemaForm/SchemaForm";
|
||||
import type { JsonSchema } from "../SchemaForm/SchemaForm";
|
||||
|
||||
export interface ElicitationFormPanelProps {
|
||||
request: ElicitRequest["params"];
|
||||
request: ElicitRequestFormParams;
|
||||
serverName: string;
|
||||
values: Record<string, unknown>;
|
||||
onChange: (values: Record<string, unknown>) => void;
|
||||
|
|
@ -33,20 +33,15 @@ export function ElicitationFormPanel({
|
|||
onSubmit,
|
||||
onCancel,
|
||||
}: ElicitationFormPanelProps) {
|
||||
const schema =
|
||||
"requestedSchema" in request ? request.requestedSchema : undefined;
|
||||
|
||||
return (
|
||||
<Stack gap="md">
|
||||
<QuotedMessage>{formatQuoted(request.message)}</QuotedMessage>
|
||||
<Divider />
|
||||
{schema && (
|
||||
<SchemaForm
|
||||
schema={schema as JsonSchema}
|
||||
values={values}
|
||||
onChange={onChange}
|
||||
/>
|
||||
)}
|
||||
<SchemaForm
|
||||
schema={request.requestedSchema as JsonSchema}
|
||||
values={values}
|
||||
onChange={onChange}
|
||||
/>
|
||||
<Alert color="yellow" title="Warning">
|
||||
{formatWarning(serverName)}
|
||||
</Alert>
|
||||
|
|
|
|||
Loading…
Reference in a new issue