Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 07:15 UTC
fix(core): preserve custom toolkit connection fields
jkomyno committed
Nov 3, 2026 at 15:51 UTC
a4101e313c1dd61f3912486b13a5d3e81f8d6656
4 files changed
+51
-2
.changeset/custom-toolkit-create-update.md
+2
@@ -4,3 +4,5 @@
4
---
5
6
Requires `@composio/client` `2.0.1`. Adds `composio.experimental.customToolkits.create()` and `update()`, which call the v3.1 custom toolkit create and update endpoints. `create()` takes `userId` (`'all'` to share the toolkit, or the user it is private to), generates the slug, and returns a `connectLink` for a private toolkit. `upsert()` is deprecated and logs a warning once per process; it keeps working.
7
+
8
+API-key auth schemes accept `additionalFields.genericId` with a required `displayName` and optional `description` to collect the value used by `{{generic_id}}` headers.
ts/packages/core/src/types/customToolkits.types.ts
+9
@@ -22,6 +22,15 @@ export const CustomToolkitAuthSchemeSchema = z.discriminatedUnion('mode', [
22
headers: z.record(z.string(), z.string()),
23
/** End-user copy for the API key input on the connect page. */
24
apiKeyField: CustomToolkitApiKeyFieldSchema.optional(),
25
+ /** Additional connect-page input used by `{{generic_id}}` in headers. */
26
+ additionalFields: z
27
+ .object({
28
+ genericId: z.object({
29
+ displayName: z.string().min(1).max(100),
30
+ description: z.string().min(1).max(500).optional(),
31
+ }),
32
+ })
33
+ .optional(),
34
}),
35
z.object({
36
mode: z.literal('DCR_OAUTH'),
ts/packages/core/src/utils/transformers/customToolkits.ts
+8
@@ -55,6 +55,14 @@ const transformCustomToolkitAuthScheme = (
55
mode: 'API_KEY',
56
headers: scheme.headers,
57
api_key_field: transformCustomToolkitApiKeyField(scheme.apiKeyField),
58
+ ...(scheme.additionalFields && {
59
+ additional_fields: {
60
+ generic_id: {
61
+ display_name: scheme.additionalFields.genericId.displayName,
62
+ description: scheme.additionalFields.genericId.description,
63
+ },
64
+ },
65
+ }),
66
};
67
case 'DCR_OAUTH':
68
return { mode: 'DCR_OAUTH', discovery_url: scheme.discoveryUrl };
ts/packages/core/test/models/customToolkits.test.ts
+32
-2
@@ -56,8 +56,17 @@ describe('Experimental.customToolkits', () => {
56
authSchemes: [
57
{
58
mode: 'API_KEY',
59
- headers: { Authorization: 'Bearer {{generic_api_key}}' },
59
+ headers: {
60
+ Authorization: 'Bearer {{generic_api_key}}',
61
+ 'X-Org-Id': '{{generic_id}}',
62
+ },
63
apiKeyField: { displayName: 'API key' },
64
+ additionalFields: {
65
+ genericId: {
66
+ displayName: 'Organization ID',
67
+ description: 'From your settings page',
68
+ },
69
+ },
70
},
71
],
72
userId: 'user_123',
@@ -74,8 +83,17 @@ describe('Experimental.customToolkits', () => {
83
auth_schemes: [
84
{
85
mode: 'API_KEY',
77
- headers: { Authorization: 'Bearer {{generic_api_key}}' },
86
+ headers: {
87
+ Authorization: 'Bearer {{generic_api_key}}',
88
+ 'X-Org-Id': '{{generic_id}}',
89
+ },
90
api_key_field: { display_name: 'API key' },
91
+ additional_fields: {
92
+ generic_id: {
93
+ display_name: 'Organization ID',
94
+ description: 'From your settings page',
95
+ },
96
+ },
97
},
98
],
99
user_id: 'user_123',
@@ -112,6 +130,18 @@ describe('Experimental.customToolkits', () => {
130
['no user ID', { userId: undefined }],
131
['no auth schemes', { authSchemes: [] }],
132
['an app URL that is not a URL', { appUrl: 'not a url' }],
133
+ [
134
+ 'an additional API key field without a display name',
135
+ {
136
+ authSchemes: [
137
+ {
138
+ mode: 'API_KEY',
139
+ headers: { 'X-Org-Id': '{{generic_id}}' },
140
+ additionalFields: { genericId: { description: 'From your settings page' } },
141
+ },
142
+ ],
143
+ },
144
+ ],
145
])('rejects %s before calling the API', async (_label, override) => {
146
await expect(
147
customToolkits.create({