Skip to content

Commit f77cb64

Browse files
committed
Inline managed auth telemetry schemas
1 parent e0a34b0 commit f77cb64

2 files changed

Lines changed: 35 additions & 12 deletions

File tree

‎src/lib/mcp/tools/auth-connections.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { afterEach, describe, expect, test } from "bun:test";
22
import { organizationWideAuthInfo } from "@/lib/mcp/auth-context.test-fixtures";
3+
import { connectTestMcp } from "@/lib/mcp/mcp-test-fixtures";
4+
import { registerAuthConnectionTools } from "./auth-connections";
35
import { toSafeAuthConnection } from "./managed-auth-state";
46
import {
57
assertNoSecrets,
@@ -46,6 +48,25 @@ describe("manage_auth_connections programmatic surface", () => {
4648
expect(schema?.sign_in_option_id).toBeUndefined();
4749
});
4850

51+
test("publishes browser telemetry categories without JSON Schema references", async () => {
52+
const { client, close } = await connectTestMcp(
53+
registerAuthConnectionTools,
54+
unusedKernelClient,
55+
);
56+
57+
try {
58+
const tool = (await client.listTools()).tools.find(
59+
({ name }) => name === "manage_auth_connections",
60+
);
61+
const browserTelemetry = tool?.inputSchema.properties?.browser_telemetry;
62+
63+
expect(browserTelemetry).toBeDefined();
64+
expect(JSON.stringify(browserTelemetry)).not.toContain('"$ref"');
65+
} finally {
66+
await close();
67+
}
68+
});
69+
4970
test("passes the optional project selector through to the client", async () => {
5071
const { handler, schema } = captureHandler();
5172
let selectedProject: string | undefined;

‎src/lib/mcp/tools/managed-auth-telemetry.ts‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import { z } from "zod";
22

3-
const telemetryCategorySchema = z.object({
4-
enabled: z.boolean().optional(),
5-
});
3+
function telemetryCategorySchema() {
4+
return z.object({
5+
enabled: z.boolean().optional(),
6+
});
7+
}
68

79
const telemetryCategoriesSchema = z.object({
8-
captcha: telemetryCategorySchema.optional(),
9-
connection: telemetryCategorySchema.optional(),
10-
console: telemetryCategorySchema.optional(),
11-
control: telemetryCategorySchema.optional(),
12-
interaction: telemetryCategorySchema.optional(),
13-
network: telemetryCategorySchema.optional(),
14-
page: telemetryCategorySchema.optional(),
15-
screenshot: telemetryCategorySchema.optional(),
16-
system: telemetryCategorySchema.optional(),
10+
captcha: telemetryCategorySchema().optional(),
11+
connection: telemetryCategorySchema().optional(),
12+
console: telemetryCategorySchema().optional(),
13+
control: telemetryCategorySchema().optional(),
14+
interaction: telemetryCategorySchema().optional(),
15+
network: telemetryCategorySchema().optional(),
16+
page: telemetryCategorySchema().optional(),
17+
screenshot: telemetryCategorySchema().optional(),
18+
system: telemetryCategorySchema().optional(),
1719
});
1820

1921
export const managedAuthBrowserTelemetrySchema = z

0 commit comments

Comments
 (0)