Skip to content

Commit c9a8919

Browse files
committed
feat(mcp): update reject
1 parent aeee99a commit c9a8919

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

doit-mcp-server/src/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ export const renderCustomerContextScreen = async (
313313
oauthReqInfo: AuthRequest | null,
314314
apiKey: string
315315
) => {
316+
if (action === "reject") {
317+
return renderAuthorizationRejectedContent(oauthReqInfo?.redirectUri || "/");
318+
}
316319
return html`
317320
<div class="max-w-md mx-auto bg-white p-8 rounded-lg shadow-md">
318321
<h1 class="text-2xl font-heading font-bold mb-6 text-gray-900">

src/tools/changeCustomer.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
formatZodError,
66
handleGeneralError,
77
} from "../utils/util.js";
8+
import { handleValidateUserRequest } from "./validateUser.js";
89

910
// Schema definition
1011
export const ChangeCustomerArgumentsSchema = z.object({
@@ -57,14 +58,20 @@ export async function handleChangeCustomerRequest(
5758
await updateCustomerContext(newContext);
5859
}
5960

61+
// Verify that the new context is valid
62+
const newCustomerDomain = await handleValidateUserRequest(
63+
{ customerContext: newContext }, // Validate doers
64+
token
65+
);
66+
67+
const domain = newCustomerDomain.content[0].text.split("Domain: ")[1];
68+
6069
// Create response
6170
const response: ChangeCustomerResponse = {
6271
success: true,
6372
previousContext,
6473
newContext,
65-
message: `Customer context successfully changed${
66-
previousContext ? ` from '${previousContext}'` : ""
67-
} to '${newContext}'`,
74+
message: `Customer context successfully changed to '${domain}'`,
6875
};
6976

7077
return createSuccessResponse(response.message);

0 commit comments

Comments
 (0)