Skip to content

Commit 9f9c134

Browse files
Fix TypeScript errors for pending SEP-1036 tests
Define URL_ELICITATION_REQUIRED_CODE and UrlModeElicitParams locally since they don't exist in the released SDK yet.
1 parent 6a75bbb commit 9f9c134

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

src/scenarios/server/elicitation-url.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import { ClientScenario, ConformanceCheck } from '../../types.js';
66
import { connectToServerWithUrlElicitation } from './client-helper.js';
77
import {
88
ElicitRequestSchema,
9-
ErrorCode,
109
McpError,
1110
NotificationSchema
1211
} from '@modelcontextprotocol/sdk/types.js';
1312
import { z } from 'zod';
1413

15-
// Define locally until SDK releases this schema
14+
// Define locally until SDK releases these
15+
const URL_ELICITATION_REQUIRED_CODE = -32042;
16+
1617
const ElicitationCompleteNotificationSchema = NotificationSchema.extend({
1718
method: z.literal('notifications/elicitation/complete'),
1819
params: z.object({
@@ -21,6 +22,14 @@ const ElicitationCompleteNotificationSchema = NotificationSchema.extend({
2122
})
2223
});
2324

25+
// Extended params type for URL mode elicitation (not yet in SDK)
26+
interface UrlModeElicitParams {
27+
message: string;
28+
mode?: string;
29+
url?: string;
30+
elicitationId?: string;
31+
}
32+
2433
export class ElicitationUrlModeScenario implements ClientScenario {
2534
name = 'elicitation-sep1036-url-mode';
2635
description = `Test URL mode elicitation per SEP-1036.
@@ -304,9 +313,9 @@ Implement three tools:
304313
const errorCodeErrors: string[] = [];
305314
if (!errorReceived) {
306315
errorCodeErrors.push('Did not receive an MCP error');
307-
} else if (errorReceived.code !== ErrorCode.UrlElicitationRequired) {
316+
} else if (errorReceived.code !== URL_ELICITATION_REQUIRED_CODE) {
308317
errorCodeErrors.push(
309-
`Expected error code ${ErrorCode.UrlElicitationRequired} (-32042), got ${errorReceived.code}`
318+
`Expected error code ${URL_ELICITATION_REQUIRED_CODE} (-32042), got ${errorReceived.code}`
310319
);
311320
}
312321

@@ -433,7 +442,8 @@ Implement three tools:
433442
connection.client.setRequestHandler(
434443
ElicitRequestSchema,
435444
async (request) => {
436-
capturedElicitationIdFromRequest = request.params.elicitationId;
445+
const params = request.params as UrlModeElicitParams;
446+
capturedElicitationIdFromRequest = params.elicitationId ?? null;
437447
return { action: 'accept' };
438448
}
439449
);

0 commit comments

Comments
 (0)