rename reject to decline
This commit is contained in:
parent
1b14bd7fa4
commit
25048b9eaf
5 changed files with 12 additions and 12 deletions
|
|
@ -1041,7 +1041,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" | "reject" | "cancel";
|
||||
action: "accept" | "decline" | "cancel";
|
||||
data?: Record<string, any>;
|
||||
}> {
|
||||
// This should be implemented depending on the app
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ async function connect(url?: string): Promise<void> {
|
|||
continue;
|
||||
} else {
|
||||
console.log('Maximum attempts reached. Declining request.');
|
||||
return { action: 'reject' };
|
||||
return { action: 'decline' };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ async function connect(url?: string): Promise<void> {
|
|||
continue;
|
||||
} else {
|
||||
console.log('Maximum attempts reached. Declining request.');
|
||||
return { action: 'reject' };
|
||||
return { action: 'decline' };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -408,13 +408,13 @@ async function connect(url?: string): Promise<void> {
|
|||
console.log('Please re-enter the information...');
|
||||
continue;
|
||||
} else {
|
||||
return { action: 'reject' };
|
||||
return { action: 'decline' };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Maximum attempts reached. Declining request.');
|
||||
return { action: 'reject' };
|
||||
return { action: 'decline' };
|
||||
});
|
||||
|
||||
transport = new StreamableHTTPClientTransport(
|
||||
|
|
|
|||
|
|
@ -206,12 +206,12 @@ const getServer = () => {
|
|||
},
|
||||
],
|
||||
};
|
||||
} else if (result.action === 'reject') {
|
||||
} else if (result.action === 'decline') {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: `No information was collected. User rejected ${infoType} information request.`,
|
||||
text: `No information was collected. User declined ${infoType} information request.`,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
@ -433,7 +433,7 @@ if (useOAuth) {
|
|||
const mcpServerUrl = new URL(`http://localhost:${MCP_PORT}/mcp`);
|
||||
const authServerUrl = new URL(`http://localhost:${AUTH_PORT}`);
|
||||
|
||||
const oauthMetadata: OAuthMetadata = setupAuthServer({authServerUrl, mcpServerUrl, strictResource: strictOAuth});
|
||||
const oauthMetadata: OAuthMetadata = setupAuthServer({ authServerUrl, mcpServerUrl, strictResource: strictOAuth });
|
||||
|
||||
const tokenVerifier = {
|
||||
verifyAccessToken: async (token: string) => {
|
||||
|
|
@ -499,7 +499,7 @@ const transports: { [sessionId: string]: StreamableHTTPServerTransport } = {};
|
|||
// MCP POST endpoint with optional auth
|
||||
const mcpPostHandler = async (req: Request, res: Response) => {
|
||||
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
||||
console.log(sessionId? `Received MCP request for session: ${sessionId}`: 'Received MCP request:', req.body);
|
||||
console.log(sessionId ? `Received MCP request for session: ${sessionId}` : 'Received MCP request:', req.body);
|
||||
if (useOAuth && req.auth) {
|
||||
console.log('Authenticated user:', req.auth);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ test("should allow elicitation reject and cancel without validation", async () =
|
|||
client.setRequestHandler(ElicitRequestSchema, (request) => {
|
||||
requestCount++;
|
||||
if (requestCount === 1) {
|
||||
return { action: "reject" };
|
||||
return { action: "decline" };
|
||||
} else {
|
||||
return { action: "cancel" };
|
||||
}
|
||||
|
|
@ -566,7 +566,7 @@ test("should allow elicitation reject and cancel without validation", async () =
|
|||
requestedSchema: schema,
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
action: "reject",
|
||||
action: "decline",
|
||||
});
|
||||
|
||||
// Test cancel - should not validate
|
||||
|
|
|
|||
|
|
@ -1238,7 +1238,7 @@ export const ElicitResultSchema = ResultSchema.extend({
|
|||
/**
|
||||
* The user's response action.
|
||||
*/
|
||||
action: z.enum(["accept", "reject", "cancel"]),
|
||||
action: z.enum(["accept", "decline", "cancel"]),
|
||||
/**
|
||||
* The collected user input content (only present if action is "accept").
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue