Skip to content

Commit d94386c

Browse files
authored
Merge pull request modelcontextprotocol#727 from modelcontextprotocol/ihrpr/decline-reject
Rename reject to decline
2 parents 1b14bd7 + d868c4a commit d94386c

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ Client-side: Handle elicitation requests
10411041
```typescript
10421042
// This is a placeholder - implement based on your UI framework
10431043
async function getInputFromUser(message: string, schema: any): Promise<{
1044-
action: "accept" | "reject" | "cancel";
1044+
action: "accept" | "decline" | "cancel";
10451045
data?: Record<string, any>;
10461046
}> {
10471047
// This should be implemented depending on the app

src/examples/client/simpleStreamableHttp.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ async function connect(url?: string): Promise<void> {
363363
continue;
364364
} else {
365365
console.log('Maximum attempts reached. Declining request.');
366-
return { action: 'reject' };
366+
return { action: 'decline' };
367367
}
368368
}
369369

@@ -381,7 +381,7 @@ async function connect(url?: string): Promise<void> {
381381
continue;
382382
} else {
383383
console.log('Maximum attempts reached. Declining request.');
384-
return { action: 'reject' };
384+
return { action: 'decline' };
385385
}
386386
}
387387

@@ -408,13 +408,13 @@ async function connect(url?: string): Promise<void> {
408408
console.log('Please re-enter the information...');
409409
continue;
410410
} else {
411-
return { action: 'reject' };
411+
return { action: 'decline' };
412412
}
413413
}
414414
}
415415

416416
console.log('Maximum attempts reached. Declining request.');
417-
return { action: 'reject' };
417+
return { action: 'decline' };
418418
});
419419

420420
transport = new StreamableHTTPClientTransport(

src/examples/server/simpleStreamableHttp.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ const getServer = () => {
206206
},
207207
],
208208
};
209-
} else if (result.action === 'reject') {
209+
} else if (result.action === 'decline') {
210210
return {
211211
content: [
212212
{
213213
type: 'text',
214-
text: `No information was collected. User rejected ${infoType} information request.`,
214+
text: `No information was collected. User declined ${infoType} information request.`,
215215
},
216216
],
217217
};
@@ -433,7 +433,7 @@ if (useOAuth) {
433433
const mcpServerUrl = new URL(`http://localhost:${MCP_PORT}/mcp`);
434434
const authServerUrl = new URL(`http://localhost:${AUTH_PORT}`);
435435

436-
const oauthMetadata: OAuthMetadata = setupAuthServer({authServerUrl, mcpServerUrl, strictResource: strictOAuth});
436+
const oauthMetadata: OAuthMetadata = setupAuthServer({ authServerUrl, mcpServerUrl, strictResource: strictOAuth });
437437

438438
const tokenVerifier = {
439439
verifyAccessToken: async (token: string) => {
@@ -499,7 +499,12 @@ const transports: { [sessionId: string]: StreamableHTTPServerTransport } = {};
499499
// MCP POST endpoint with optional auth
500500
const mcpPostHandler = async (req: Request, res: Response) => {
501501
const sessionId = req.headers['mcp-session-id'] as string | undefined;
502-
console.log(sessionId? `Received MCP request for session: ${sessionId}`: 'Received MCP request:', req.body);
502+
if (sessionId) {
503+
console.log(`Received MCP request for session: ${sessionId}`);
504+
} else {
505+
console.log('Request body:', req.body);
506+
}
507+
503508
if (useOAuth && req.auth) {
504509
console.log('Authenticated user:', req.auth);
505510
}

src/server/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ test("should allow elicitation reject and cancel without validation", async () =
538538
client.setRequestHandler(ElicitRequestSchema, (request) => {
539539
requestCount++;
540540
if (requestCount === 1) {
541-
return { action: "reject" };
541+
return { action: "decline" };
542542
} else {
543543
return { action: "cancel" };
544544
}
@@ -566,7 +566,7 @@ test("should allow elicitation reject and cancel without validation", async () =
566566
requestedSchema: schema,
567567
}),
568568
).resolves.toEqual({
569-
action: "reject",
569+
action: "decline",
570570
});
571571

572572
// Test cancel - should not validate

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ export const ElicitResultSchema = ResultSchema.extend({
12381238
/**
12391239
* The user's response action.
12401240
*/
1241-
action: z.enum(["accept", "reject", "cancel"]),
1241+
action: z.enum(["accept", "decline", "cancel"]),
12421242
/**
12431243
* The collected user input content (only present if action is "accept").
12441244
*/

0 commit comments

Comments
 (0)