@devries-cameron20 / composio-1 / commits / 5ba2dcb8a
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: identify connected accounts and restrict Gmail by email domain (#4607)

## Summary Developers need to know which provider account a user connected, both to display its identity and to apply email-domain policies. The docs expose the underlying API fields but don't connect them into an onboarding flow. ## Changes - Add “Identify the connected account” to Manual auth management, covering display identity, current-user endpoint discovery, and authenticated profile retrieval for a specific account. - Add runnable Python and TypeScript Gmail examples that validate the mailbox domain after OAuth, disable rejected connections, and prepare an agent session pinned to the approved account with in-chat authentication disabled. - Add example navigation and links from the multiple-account and proxy guides. - Exercise the published TypeScript snippet with offline regression tests covering domain matching, malformed identity, request failures, timeouts, cleanup failures, and session isolation. - Remove an unnecessary global toolkit-schema mock from the existing OpenAPI tests, preventing order-dependent failures in other test suites. Add a regression check that the real schema helpers remain available. ## Type of change - [x] Documentation ## How Has This Been Tested? - `bun run build`, `bun run types:check`, `bun run lint`, and `bun run lint:links` from `docs/` passed. Lint reports existing warnings. - All 606 docs static tests pass with the CI-pinned Bun 1.4.1 runtime. The forced OpenAPI-before-schema test order also passes, covering the previous module-mock leak. - Executed the Python snippet against mocked SDK responses for 18 success and failure scenarios. Checked its signatures against published `composio==0.23.0`. - Repository agent-skill and skill-routing validators passed. Live Google OAuth was not exercised. Consent, granted scopes, and the authenticated Gmail profile request still need an end-to-end check with a real account. The example checks an email domain after authentication; it does not constrain Google's account picker or prove Workspace membership. ## Checklist - [x] Ran relevant linters and tests locally. - [x] Updated documentation and navigation. - [x] Added regression tests for the example's approval and rejection paths. - [x] No changeset needed: documentation and tests only. --------- Co-authored-by: jkomyno <alberto@composio.dev>

Brendan O'Leary committed Sep 24, 2026 at 09:36 UTC 5ba2dcb8a0ffac24549a5d87ea1c35e982db1bed
7 files changed +408
docs/content/docs/authentication/managing-multiple-connected-accounts.mdx
+2
@@ -105,6 +105,8 @@ Aliases are human-readable labels for connected accounts (e.g., `"work-gmail"`,
105
106 To identify an account by its provider-side identity (e.g. the Gmail address or GitHub username) rather than a label you set, read the read-only `displayName` that Composio auto-populates on the connected account at `state.val.displayName` once the connection is active.
107
108 +See [Identify the connected account](/docs/authentication/manually-authenticating#identify-the-connected-account) to display that identity or retrieve the provider's profile. To accept only certain email domains, follow [Restrict Gmail connections to an email domain](/examples/restrict-gmail-domain).
109 +
110 ### Setting an alias during connection
111
112 Pass `alias` to `session.authorize()`:
docs/content/docs/authentication/manually-authenticating.mdx
+79
@@ -99,6 +99,85 @@ After authentication, Composio redirects the user to your callback URL with the
99 https://your-app.com/callback?user_id=user_123&source=onboarding&status=success&connected_account_id=ca_abc123
100 ```
101
102 +## Identify the connected account
103 +
104 +After authentication, use the account returned by `wait_for_connection()` or `waitForConnection()` to identify which provider account connected. If you use a callback instead, verify its `connected_account_id` against the connection attempt stored on your server and the signed-in application user before retrieving it. Callback query parameters alone aren't proof of ownership.
105 +
106 +These identifiers serve different purposes:
107 +
108 +| Value | Meaning |
109 +| --- | --- |
110 +| Application user ID | Your application's user, such as `user_123`. This doesn't identify their Gmail or GitHub account. |
111 +| Connected account ID | One connection in Composio, such as `ca_abc123`. Use it to select the account for a profile request. |
112 +| Alias | A label you assign, such as `work-gmail`. It doesn't prove which account connected. |
113 +| Provider identity | The email address, username, or ID returned by the provider for the authenticated account. |
114 +
115 +For a "Connected as…" label, read `state.val.displayName` when available. For additional profile fields, get the toolkit's current-user endpoint and call it through Composio's [authenticated proxy](/reference/api-reference/tools/postToolsExecuteProxy) with the same connected account ID:
116 +
117 +<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
118 +<Tab value="Python">
119 +```python
120 +# Continue after connected_account = connection_request.wait_for_connection().
121 +account_id = connected_account.id
122 +state = connected_account.model_dump().get("state") or {}
123 +display_name = state.get("val", {}).get("displayName")
124 +print(f"Connected as {display_name}" if display_name else "Account connected")
125 +
126 +toolkit = composio.toolkits.get(connected_account.toolkit.slug)
127 +endpoint = toolkit.get_current_user_endpoint
128 +method = toolkit.get_current_user_endpoint_method
129 +if not endpoint or method not in ("GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"):
130 + raise ValueError("This toolkit doesn't publish a supported current-user endpoint")
131 +
132 +response = composio.tools.proxy(
133 + endpoint=endpoint,
134 + method=method,
135 + connected_account_id=account_id,
136 +)
137 +if response["status"] != 200:
138 + raise RuntimeError("Could not retrieve the connected account's profile")
139 +profile = response["data"] # Parse the fields documented by this provider.
140 +```
141 +</Tab>
142 +<Tab value="TypeScript">
143 +```typescript
144 +import { Composio } from '@composio/core';
145 +const composio = new Composio();
146 +declare const connectedAccount: Awaited<ReturnType<typeof composio.connectedAccounts.get>>;
147 +// ---cut---
148 +import { z } from 'zod';
149 +
150 +// Continue after connectedAccount = await connectionRequest.waitForConnection().
151 +const accountId = connectedAccount.id;
152 +const label = z.object({ displayName: z.string().optional() })
153 + .safeParse(connectedAccount.state?.val ?? {});
154 +const displayName = label.success ? label.data.displayName : undefined;
155 +console.log(displayName ? `Connected as ${displayName}` : 'Account connected');
156 +
157 +const toolkit = await composio.toolkits.get(connectedAccount.toolkit.slug);
158 +if (!toolkit.getCurrentUserEndpoint) {
159 + throw new Error("This toolkit doesn't publish a current-user endpoint");
160 +}
161 +const method = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE'])
162 + .parse(toolkit.getCurrentUserEndpointMethod);
163 +const response = await composio.tools.proxyExecute({
164 + endpoint: toolkit.getCurrentUserEndpoint,
165 + method,
166 + connectedAccountId: accountId,
167 +});
168 +if (response.status !== 200) {
169 + throw new Error("Could not retrieve the connected account's profile");
170 +}
171 +const profile = z.record(z.string(), z.unknown()).parse(response.data);
172 +// Validate the provider-specific fields before using them in your application.
173 +```
174 +</Tab>
175 +</Tabs>
176 +
177 +Toolkit metadata describes where to request a profile; it doesn't contain the account owner's details. Endpoint availability, required scopes, and response fields vary by provider. If the metadata is absent, use a documented profile endpoint or tool for that provider. A GitHub username or display label isn't a verified email address.
178 +
179 +For an application policy, validate the provider's response before giving an agent access to the account. Follow [Restrict Gmail connections to an email domain](/examples/restrict-gmail-domain) for a complete example that checks the mailbox address and disables rejected connections. Return only the fields your UI needs, not the account's authentication state.
180 +
181 ## Check connection status
182
183 Use `session.toolkits()` to see all toolkits in the session and their connection status:
docs/content/docs/extending-sessions/proxy-execute.mdx
+2
@@ -16,6 +16,8 @@ Authenticate with a [scoped project API key](/reference/authenticating-to-compos
16
17 ## When to use it
18
19 +For a profile lookup during onboarding, use the proxy with the exact connected account ID you just created. See [Identify the connected account](/docs/authentication/manually-authenticating#identify-the-connected-account) and the [Gmail domain restriction example](/examples/restrict-gmail-domain) for this account-specific flow.
20 +
21 - **Endpoints with no predefined tool.** You need a specific endpoint (an unusual GitHub, LinkedIn, or Notion route) that isn't exposed as a Composio tool. Send it through the proxy instead of extracting the raw token and calling the API yourself.
22 - **Request shapes a tool can't express.** Custom query parameters, partial field masks, or advanced filters on Gmail, Drive, Sheets, and similar. The proxy gives you the full HTTP surface of the upstream API while Composio keeps managing auth.
23
docs/content/examples/meta.json
+1
@@ -17,6 +17,7 @@
17 "[TypeSafe tool selection](/examples/typesafe-tool-selection)",
18 "[CrewAI and LangChain over MCP](/examples/python-mcp-agents)",
19 "[Multiple accounts](/examples/multiple-accounts)",
20 + "[Restrict Gmail by domain](/examples/restrict-gmail-domain)",
21 "[Custom tools with Composio](/examples/custom-tools)",
22 "---Deployment---",
23 "[Cloudflare Workers](/examples/cloudflare-workers)"
docs/content/examples/restrict-gmail-domain.mdx new
+192
@@ -0,0 +1,192 @@
1 +---
2 +title: Restrict Gmail connections to an email domain
3 +description: Check the connected Gmail address before giving an agent access, and disable connections outside your allowed domain.
4 +keywords: [gmail, email domain, allowlist, account identity, authentication, python, typescript]
5 +gallery:
6 + categories: [General agents]
7 + logos: [gmail]
8 +---
9 +
10 +Accept a Gmail connection only when its mailbox address belongs to your allowed domain. This example connects an account, checks its address on the server, and prepares agent tools only after approval.
11 +
12 +The check runs **after Google authentication**. It doesn't restrict Google's account picker or prove Google Workspace membership. For an organization-membership policy, follow [Google's guidance on the validated `hd` claim](https://developers.google.com/identity/gsi/web/guides/verify-google-id-token).
13 +
14 +## Set up the project
15 +
16 +Use Python 3.12 or Node.js 24.17 or newer. Install in a new project, using a virtual environment for Python:
17 +
18 +<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
19 +<Tab value="Python">
20 +<PackageInstall packages="composio" ecosystem="python" />
21 +</Tab>
22 +<Tab value="TypeScript">
23 +<PackageInstall packages="@composio/core zod" />
24 +</Tab>
25 +</Tabs>
26 +
27 +Set a [Composio project key](https://dashboard.composio.dev/~/project/settings/api-keys?utm_source=docs&utm_medium=content&utm_campaign=examples-restrict-gmail-domain) and a fresh application user ID for this demo:
28 +
29 +```bash
30 +export COMPOSIO_API_KEY="your-composio-api-key"
31 +export COMPOSIO_USER_ID="domain-check-demo"
32 +```
33 +
34 +In your application, derive the user ID from your authenticated session. Keep the API key and this code on the server. If you use a scoped project key, enable [Proxy execute](/reference/authenticating-to-composio/project-api-key-permissions).
35 +
36 +The script calls Gmail's [`users.getProfile`](https://developers.google.com/workspace/gmail/api/reference/rest/v1/users/getProfile) endpoint with `me`, which selects the authenticated mailbox. It reads the returned `emailAddress`. The endpoint requires a Gmail scope such as `https://www.googleapis.com/auth/gmail.readonly`; `openid` and `email` alone don't grant this access. Ensure your Gmail auth config requests `gmail.readonly` if the agent will also read messages. See [Controlling scopes](/docs/authentication/controlling-scopes) to configure scopes and reconnect after changing them.
37 +
38 +## Connect and check the account
39 +
40 +Replace `example.com` in the script with your allowed domain. Run the script, open the printed Connect Link, and complete authentication within five minutes. The script polls its own connection request, so it doesn't need an HTTP callback handler.
41 +
42 +<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
43 +<Tab value="Python">
44 +
45 +Save as `restrict_gmail.py`:
46 +
47 +```python title="restrict_gmail.py"
48 +import os
49 +from email.headerregistry import Address
50 +
51 +from composio import Composio
52 +
53 +ALLOWED_DOMAIN = "example.com"
54 +
55 +
56 +def approved_email(data):
57 + email = data["emailAddress"]
58 + address = Address(addr_spec=email)
59 + if (
60 + not address.username
61 + or address.addr_spec != email
62 + or address.domain.lower() != ALLOWED_DOMAIN.lower()
63 + ):
64 + raise ValueError("Mailbox address is not allowed")
65 + return email
66 +
67 +
68 +composio = Composio()
69 +user_id = os.environ["COMPOSIO_USER_ID"]
70 +onboarding = composio.create(
71 + user_id=user_id,
72 + toolkits=["gmail"],
73 + manage_connections=False,
74 + sandbox={"enable": False},
75 +)
76 +request = onboarding.authorize("gmail")
77 +print(f"Connect Gmail: {request.redirect_url}", flush=True)
78 +
79 +try:
80 + account = request.wait_for_connection(timeout=300) # Python uses seconds.
81 + response = composio.tools.proxy(
82 + endpoint="https://gmail.googleapis.com/gmail/v1/users/me/profile",
83 + method="GET",
84 + connected_account_id=account.id,
85 + )
86 + if response["status"] != 200:
87 + raise RuntimeError("Gmail profile request failed")
88 + email = approved_email(response["data"])
89 +except Exception:
90 + # Also reject missing identity, insufficient scopes, and timeouts.
91 + composio.connected_accounts.disable(request.id)
92 + raise SystemExit(
93 + f"Connection disabled. Rerun and connect a Gmail account at {ALLOWED_DOMAIN}. "
94 + "If you used that domain, check the Gmail scopes and try again."
95 + ) from None
96 +
97 +session = composio.create(
98 + user_id=user_id,
99 + toolkits=["gmail"],
100 + connected_accounts={"gmail": [account.id]},
101 + manage_connections=False,
102 + sandbox={"enable": False},
103 +)
104 +tools = session.tools()
105 +print(f"Connected as {email}. Agent tools are ready for this account.")
106 +```
107 +
108 +```bash
109 +python restrict_gmail.py
110 +```
111 +
112 +</Tab>
113 +<Tab value="TypeScript">
114 +
115 +Save as `restrict-gmail.ts`:
116 +
117 +```typescript title="restrict-gmail.ts"
118 +import { Composio } from '@composio/core';
119 +import { z } from 'zod';
120 +
121 +const ALLOWED_DOMAIN = 'example.com';
122 +const gmailProfile = z.object({ emailAddress: z.string().email() });
123 +
124 +function approvedEmail(data: unknown) {
125 + const { emailAddress } = gmailProfile.parse(data);
126 + const domain = emailAddress.split('@')[1].toLowerCase();
127 + if (domain !== ALLOWED_DOMAIN.toLowerCase()) {
128 + throw new Error('Mailbox address is not allowed');
129 + }
130 + return emailAddress;
131 +}
132 +
133 +const userId = process.env.COMPOSIO_USER_ID;
134 +if (!userId) throw new Error('Set COMPOSIO_USER_ID');
135 +const composio = new Composio();
136 +const onboarding = await composio.create(userId, {
137 + toolkits: ['gmail'],
138 + manageConnections: false,
139 + sandbox: { enable: false },
140 +});
141 +const request = await onboarding.authorize('gmail');
142 +console.log(`Connect Gmail: ${request.redirectUrl}`);
143 +
144 +let email: string;
145 +try {
146 + const account = await request.waitForConnection(300_000); // TypeScript uses milliseconds.
147 + const response = await composio.tools.proxyExecute({
148 + endpoint: 'https://gmail.googleapis.com/gmail/v1/users/me/profile',
149 + method: 'GET',
150 + connectedAccountId: account.id,
151 + });
152 + if (response.status !== 200) {
153 + throw new Error('Gmail profile request failed');
154 + }
155 + email = approvedEmail(response.data);
156 +} catch {
157 + // Also reject missing identity, insufficient scopes, and timeouts.
158 + await composio.connectedAccounts.disable(request.id);
159 + throw new Error(
160 + `Connection disabled. Rerun and connect a Gmail account at ${ALLOWED_DOMAIN}. ` +
161 + 'If you used that domain, check the Gmail scopes and try again.',
162 + );
163 +}
164 +
165 +const session = await composio.create(userId, {
166 + toolkits: ['gmail'],
167 + connectedAccounts: { gmail: [request.id] },
168 + manageConnections: false,
169 + sandbox: { enable: false },
170 +});
171 +const tools = await session.tools();
172 +console.log(`Connected as ${email}. Agent tools are ready for this account.`);
173 +```
174 +
175 +```bash
176 +node restrict-gmail.ts
177 +```
178 +
179 +</Tab>
180 +</Tabs>
181 +
182 +For an approved account, the script prints `Connected as alice@example.com. Agent tools are ready for this account.` Pass the returned `tools` to your [agent framework](/docs/providers) using this approved session. The default SDK provider returns OpenAI-compatible tools; configure your framework's provider when constructing `Composio` if needed.
183 +
184 +For a rejected account, the script disables the connection and exits before creating the agent session. If disabling fails, the script stops with that error and still doesn't create the agent session. Resolve the failure before retrying. Disabling a connection blocks Composio tool execution; it doesn't revoke Google's OAuth grant.
185 +
186 +## Keep the check in the execution path
187 +
188 +The onboarding session never supplies tools to an agent. The second session selects the approved account explicitly and disables in-chat connection management, so the agent can't connect another account through that session. Don't expose the onboarding session to clients or reuse other sessions that can select unchecked accounts. Apply the same validation whenever you accept a new or replacement connection.
189 +
190 +The domain comparison ignores case and requires an exact match. `alice@EXAMPLE.COM` passes; `alice@gmail.com`, `alice@sub.example.com`, and `alice@notexample.com` don't. Missing or malformed profile data and failed profile requests also prevent approval. An alias such as `work-gmail` or the account's `displayName` isn't the input to this decision.
191 +
192 +To display identity without a domain policy, see [Identify the connected account](/docs/authentication/manually-authenticating#identify-the-connected-account). For session account selection, see [Managing multiple connected accounts](/docs/authentication/managing-multiple-connected-accounts#selecting-a-specific-account-for-a-session).
docs/tests/static/gmail-domain-example.test.ts new
+121
@@ -0,0 +1,121 @@
1 +import { expect, test } from 'bun:test';
2 +import { readFileSync } from 'node:fs';
3 +import { z } from 'zod';
4 +
5 +// Exercise the published snippet itself without opening OAuth or making API calls.
6 +const page = readFileSync(
7 + new URL('../../content/examples/restrict-gmail-domain.mdx', import.meta.url),
8 + 'utf8',
9 +);
10 +const source = page.match(/```typescript title="restrict-gmail.ts"\n([\s\S]*?)\n```/)?.[1];
11 +if (!source) throw new Error('Missing runnable TypeScript example');
12 +const compiled = new Bun.Transpiler({ loader: 'ts' }).transformSync(
13 + source.replace(/^import .*;\n/gm, ''),
14 +);
15 +const runExample = new Function(
16 + 'Composio', 'z', 'process', 'console',
17 + `return (async () => { ${compiled} })();`,
18 +);
19 +
20 +const cases = [
21 + { name: 'allowed domain', data: { emailAddress: 'alice@example.com' }, approved: true },
22 + { name: 'mixed case', data: { emailAddress: 'alice@EXAMPLE.COM' }, approved: true },
23 + { name: 'personal Gmail', data: { emailAddress: 'alice@gmail.com' }, approved: false },
24 + { name: 'suffix match', data: { emailAddress: 'alice@notexample.com' }, approved: false },
25 + { name: 'subdomain', data: { emailAddress: 'alice@sub.example.com' }, approved: false },
26 + { name: 'extra suffix', data: { emailAddress: 'alice@example.com.evil.test' }, approved: false },
27 + { name: 'missing email', data: {}, approved: false },
28 + { name: 'null profile', data: null, approved: false },
29 + { name: 'non-string email', data: { emailAddress: 42 }, approved: false },
30 + { name: 'empty local part', data: { emailAddress: '@example.com' }, approved: false },
31 + { name: 'multiple at signs', data: { emailAddress: 'alice@other@example.com' }, approved: false },
32 + { name: 'display-name syntax', data: { emailAddress: 'Alice <alice@example.com>' }, approved: false },
33 + { name: 'whitespace', data: { emailAddress: 'alice @example.com' }, approved: false },
34 +];
35 +
36 +for (const scenario of cases) {
37 + test(`Gmail domain example: ${scenario.name}`, async () => {
38 + await checkExample(scenario.data, scenario.approved);
39 + });
40 +}
41 +
42 +test('Gmail domain example rejects upstream errors and cleanup failures', async () => {
43 + await checkExample({ emailAddress: 'alice@example.com' }, false, 'proxy');
44 + await checkExample({ emailAddress: 'alice@example.com' }, false, 'status');
45 + await checkExample({ emailAddress: 'alice@example.com' }, false, 'timeout');
46 + await checkExample({ emailAddress: 'alice@gmail.com' }, false, 'disable');
47 +});
48 +
49 +async function checkExample(
50 + data: unknown,
51 + approved: boolean,
52 + failure?: 'proxy' | 'status' | 'timeout' | 'disable',
53 +) {
54 + const events: string[] = [];
55 + const accountId = 'ca_new_connection';
56 + class Composio {
57 + connectedAccounts = {
58 + disable: async (id: string) => {
59 + expect(id).toBe(accountId);
60 + events.push('disable');
61 + if (failure === 'disable') throw new Error('disable failed');
62 + },
63 + };
64 + tools = {
65 + proxyExecute: async (params: Record<string, unknown>) => {
66 + expect(params).toEqual({
67 + endpoint: 'https://gmail.googleapis.com/gmail/v1/users/me/profile',
68 + method: 'GET',
69 + connectedAccountId: accountId,
70 + });
71 + events.push('profile');
72 + if (failure === 'proxy') throw new Error('network failure');
73 + return { status: failure === 'status' ? 403 : 200, data };
74 + },
75 + };
76 + async create(userId: string, config: Record<string, unknown>) {
77 + expect(userId).toBe('demo');
78 + expect(config.toolkits).toEqual(['gmail']);
79 + expect(config.manageConnections).toBe(false);
80 + expect(config.sandbox).toEqual({ enable: false });
81 + if (events.length === 0) {
82 + events.push('onboarding');
83 + } else {
84 + expect(approved).toBe(true);
85 + expect(events).toEqual(['onboarding', 'wait', 'profile']);
86 + expect(config.connectedAccounts).toEqual({ gmail: [accountId] });
87 + events.push('agent-session');
88 + }
89 + return {
90 + authorize: async (toolkit: string) => {
91 + expect(toolkit).toBe('gmail');
92 + return {
93 + id: accountId,
94 + redirectUrl: 'https://example.test/connect',
95 + waitForConnection: async (timeout: number) => {
96 + expect(timeout).toBe(300_000);
97 + events.push('wait');
98 + if (failure === 'timeout') throw new Error('timed out');
99 + return { id: accountId };
100 + },
101 + };
102 + },
103 + tools: async () => {
104 + expect(events.at(-1)).toBe('agent-session');
105 + events.push('tools');
106 + return [];
107 + },
108 + };
109 + }
110 + }
111 + const result = runExample(Composio, z, { env: { COMPOSIO_USER_ID: 'demo' } }, { log() {} });
112 + if (approved) {
113 + await result;
114 + expect(events).toEqual(['onboarding', 'wait', 'profile', 'agent-session', 'tools']);
115 + } else {
116 + await expect(result).rejects.toThrow(failure === 'disable' ? 'disable failed' : 'Connection disabled');
117 + expect(events.at(-1)).toBe('disable');
118 + expect(events).not.toContain('agent-session');
119 + expect(events).not.toContain('tools');
120 + }
121 +}
docs/tests/static/llms-openapi.test.ts
+11
@@ -24,6 +24,8 @@ mock.module("@/lib/meta-tools-data", () => ({
24 getAllMetaTools: async () => [],
25 getMetaToolBySlug: async () => null,
26 }));
27 +// Keep toolkit-schema real: module mocks persist across files in Bun and would
28 +// replace the transformations tested by toolkit-schema.test.ts when it runs later.
29
30 let openapiPageToMarkdown: typeof import("../../app/llms.mdx/[[...slug]]/route").openapiPageToMarkdown;
31 let degradedPageToMarkdown: typeof import("../../app/llms.mdx/[[...slug]]/route").degradedPageToMarkdown;
@@ -35,6 +37,15 @@ beforeAll(async () => {
37 });
38
39 describe("LLM OpenAPI markdown", () => {
40 + test("preserves real toolkit schema helpers for subsequent suites", async () => {
41 + const { processSchema, toolFromApi } = await import("../../lib/toolkit-schema");
42 + expect(processSchema({
43 + properties: { query: { type: "string" } },
44 + required: ["query"],
45 + })?.query.required).toBe(true);
46 + expect(toolFromApi({ slug: "TEST_TOOL" }).name).toBe("TEST_TOOL");
47 + });
48 +
49 test("continues to render API operations with endpoint and cURL details", async () => {
50 bundledSpec = {
51 paths: {