Merge pull request #657 from modelcontextprotocol/ihrpr/decline-reject

rename decline to reject
This commit is contained in:
Inna Harper 2025-06-18 20:35:42 +01:00 • committed by GitHub
commit 00a631c2ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 15 deletions

View file

@ -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<string, any>;
}> {
// This should be implemented depending on the app

View file

@ -363,7 +363,7 @@ async function connect(url?: string): Promise<void> {
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<void> {
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<void> {
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(

View file

@ -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`);

View file

@ -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

View file

@ -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",

View file

@ -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").
*/