diff --git a/README.md b/README.md index 9fa07de34..aa8f9304c 100644 --- a/README.md +++ b/README.md @@ -930,7 +930,7 @@ Client-side: Handle elicitation requests ```typescript // This is a placeholder - implement based on your UI framework async function getInputFromUser(message: string, schema: any): Promise<{ - action: "accept" | "decline" | "cancel"; + action: "accept" | "reject" | "cancel"; data?: Record; }> { // This should be implemented depending on the app diff --git a/src/examples/client/simpleStreamableHttp.ts b/src/examples/client/simpleStreamableHttp.ts index ddb274196..02db131ef 100644 --- a/src/examples/client/simpleStreamableHttp.ts +++ b/src/examples/client/simpleStreamableHttp.ts @@ -363,7 +363,7 @@ async function connect(url?: string): Promise { continue; } else { console.log('Maximum attempts reached. Declining request.'); - return { action: 'decline' }; + return { action: 'reject' }; } } @@ -381,7 +381,7 @@ async function connect(url?: string): Promise { continue; } else { console.log('Maximum attempts reached. Declining request.'); - return { action: 'decline' }; + return { action: 'reject' }; } } @@ -408,13 +408,13 @@ async function connect(url?: string): Promise { console.log('Please re-enter the information...'); continue; } else { - return { action: 'decline' }; + return { action: 'reject' }; } } } console.log('Maximum attempts reached. Declining request.'); - return { action: 'decline' }; + return { action: 'reject' }; }); transport = new StreamableHTTPClientTransport( diff --git a/src/examples/server/simpleStreamableHttp.ts b/src/examples/server/simpleStreamableHttp.ts index 98d85c948..37c5f0be7 100644 --- a/src/examples/server/simpleStreamableHttp.ts +++ b/src/examples/server/simpleStreamableHttp.ts @@ -205,12 +205,12 @@ const getServer = () => { }, ], }; - } else if (result.action === 'decline') { + } else if (result.action === 'reject') { return { content: [ { type: 'text', - text: `No information was collected. User declined to provide ${infoType} information.`, + text: `No information was collected. User rejected ${infoType} information request.`, }, ], }; @@ -458,7 +458,7 @@ if (useOAuth) { } const data = await response.json(); - + if (strictOAuth) { if (!data.aud) { throw new Error(`Resource Indicator (RFC8707) missing`); diff --git a/src/server/index.test.ts b/src/server/index.test.ts index ce54247a0..48b7f7340 100644 --- a/src/server/index.test.ts +++ b/src/server/index.test.ts @@ -505,7 +505,7 @@ test("should reject elicitation response with invalid data", async () => { ).rejects.toThrow(/does not match requested schema/); }); -test("should allow elicitation decline and cancel without validation", async () => { +test("should allow elicitation reject and cancel without validation", async () => { const server = new Server( { name: "test server", @@ -524,7 +524,7 @@ test("should allow elicitation decline and cancel without validation", async () const client = new Client( { - name: "test client", + name: "test client", version: "1.0", }, { @@ -538,7 +538,7 @@ test("should allow elicitation decline and cancel without validation", async () client.setRequestHandler(ElicitRequestSchema, (request) => { requestCount++; if (requestCount === 1) { - return { action: "decline" }; + return { action: "reject" }; } else { return { action: "cancel" }; } @@ -559,14 +559,14 @@ test("should allow elicitation decline and cancel without validation", async () required: ["name"], }; - // Test decline - should not validate + // Test reject - should not validate await expect( server.elicitInput({ message: "Please provide your name", requestedSchema: schema, }), ).resolves.toEqual({ - action: "decline", + action: "reject", }); // Test cancel - should not validate diff --git a/src/server/mcp.test.ts b/src/server/mcp.test.ts index 7fb6bd55c..50df25b53 100644 --- a/src/server/mcp.test.ts +++ b/src/server/mcp.test.ts @@ -4157,7 +4157,7 @@ describe("elicitInput()", () => { // Mock availability check to return false checkAvailability.mockResolvedValue(false); - // Set up client to decline alternative date checking + // Set up client to reject alternative date checking client.setRequestHandler(ElicitRequestSchema, async () => { return { action: "accept", diff --git a/src/types.ts b/src/types.ts index e16b313de..3606a6be7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1237,7 +1237,7 @@ export const ElicitResultSchema = ResultSchema.extend({ /** * The user's response action. */ - action: z.enum(["accept", "decline", "cancel"]), + action: z.enum(["accept", "reject", "cancel"]), /** * The collected user input content (only present if action is "accept"). */