Skip to content

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

fix(cli): fix syntax errors in 'composio py generate'

jkomyno2e22ba8dc7da
diff --git a/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts b/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
index b4be2057e..ac5c42e26 100644
--- a/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
+++ b/ts/packages/cli/src/commands/py/commands/py.generate.cmd.ts
@@ -46,7 +46,7 @@ export function generatePythonTypeStubs({ outputOpt }: GetCmdParams<typeof _pyCm
yield* fs.makeDirectory(outputDir, { recursive: true });
// Fetch data from Composio API
- yield* Console.log('Fetching latest data from Composio API...');
+ yield* Console.log('Fetching latest data from Composio API. This may take a while...');
const triggerTypesAsEnums = yield* Effect.logDebug('Fetching trigger types...').pipe(
Effect.flatMap(() => client.getTriggerTypesAsEnums())
diff --git a/ts/packages/cli/src/generation/python/generate-toolkit-sources.ts b/ts/packages/cli/src/generation/python/generate-toolkit-sources.ts
index 9c01ad2c8..d427e966f 100644
--- a/ts/packages/cli/src/generation/python/generate-toolkit-sources.ts
+++ b/ts/packages/cli/src/generation/python/generate-toolkit-sources.ts
@@ -15,7 +15,7 @@
*
* class triggers:
* NEW_GMAIL_MESSAGE = {
- * config: {
+ * 'config': {
* # ...
* },
* description: "Triggers when a new message is received in Gmail.",
@@ -79,7 +79,7 @@ function jsToPython(value: unknown, indent = 0): string {
}
const formattedEntries = entries.map(([key, val]) => {
- const formattedKey = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(key) ? key : JSON.stringify(key);
+ const formattedKey = JSON.stringify(key);
const formattedValue = jsToPython(val, indent + 2);
return `${spacePad} ${formattedKey}: ${formattedValue}`;
});
diff --git a/ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts b/ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts
index 65f2746f8..9aaba09bc 100644
--- a/ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/py/py.generate.cmd.test.ts
@@ -131,141 +131,141 @@ describe('CLI: composio py generate', () => {
class triggers:
NEW_GMAIL_MESSAGE = {
- config: {
- properties: {
- interval: {
- default: 1,
- description: "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
- title: "Interval",
- type: "number"
+ "config": {
+ "properties": {
+ "interval": {
+ "default": 1,
+ "description": "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
+ "title": "Interval",
+ "type": "number"
},
- labelIds: {
- default: "INBOX",
- description: "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
- examples: ["INBOX", "UNREAD", "STARRED"],
- title: "Labelids",
- type: "string"
+ "labelIds": {
+ "default": "INBOX",
+ "description": "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
+ "examples": ["INBOX", "UNREAD", "STARRED"],
+ "title": "Labelids",
+ "type": "string"
},
- query: {
- default: "",
- description: "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:[email protected]), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
- examples: ["label:inbox OR label:sent", "from:[email protected] is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
- title: "Query",
- type: "string"
+ "query": {
+ "default": "",
+ "description": "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:[email protected]), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
+ "examples": ["label:inbox OR label:sent", "from:[email protected] is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
+ "title": "Query",
+ "type": "string"
},
- userId: {
- default: "me",
- description: "The user's email address or 'me' for the authenticated user.",
- examples: ["me"],
- title: "Userid",
- type: "string"
+ "userId": {
+ "default": "me",
+ "description": "The user's email address or 'me' for the authenticated user.",
+ "examples": ["me"],
+ "title": "Userid",
+ "type": "string"
}
},
- title: "NewMessageConfig",
- type: "object"
+ "title": "NewMessageConfig",
+ "type": "object"
},
- description: "Triggers when a new message is received in Gmail.",
- instructions: "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
- name: "New Gmail Message Received Trigger",
- payload: {
- properties: {
- attachment_list: {
- anyOf: [{
- items: {},
- type: "array"
+ "description": "Triggers when a new message is received in Gmail.",
+ "instructions": "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
+ "name": "New Gmail Message Received Trigger",
+ "payload": {
+ "properties": {
+ "attachment_list": {
+ "anyOf": [{
+ "items": {},
+ "type": "array"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The list of attachments in the message",
- title: "Attachment List"
+ "default": None,
+ "description": "The list of attachments in the message",
+ "title": "Attachment List"
},
- message_id: {
- anyOf: [{
- type: "string"
+ "message_id": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The message ID of the message",
- title: "Message ID"
+ "default": None,
+ "description": "The message ID of the message",
+ "title": "Message ID"
},
- message_text: {
- anyOf: [{
- type: "string"
+ "message_text": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The text of the message",
- title: "Message Text"
+ "default": None,
+ "description": "The text of the message",
+ "title": "Message Text"
},
- message_timestamp: {
- anyOf: [{
- type: "string"
+ "message_timestamp": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The timestamp of the message",
- title: "Message Timestamp"
+ "default": None,
+ "description": "The timestamp of the message",
+ "title": "Message Timestamp"
},
- payload: {
- anyOf: [{
- type: "object"
+ "payload": {
+ "anyOf": [{
+ "type": "object"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The payload of the message",
- title: "Payload"
+ "default": None,
+ "description": "The payload of the message",
+ "title": "Payload"
},
- sender: {
- anyOf: [{
- type: "string"
+ "sender": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The sender of the message",
- title: "Sender"
+ "default": None,
+ "description": "The sender of the message",
+ "title": "Sender"
},
- subject: {
- anyOf: [{
- type: "string"
+ "subject": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The subject of the message",
- title: "Subject"
+ "default": None,
+ "description": "The subject of the message",
+ "title": "Subject"
},
- thread_id: {
- anyOf: [{
- type: "string"
+ "thread_id": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The thread ID of the message",
- title: "Thread ID"
+ "default": None,
+ "description": "The thread ID of the message",
+ "title": "Thread ID"
},
- to: {
- anyOf: [{
- type: "string"
+ "to": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The recipient of the message",
- title: "To"
+ "default": None,
+ "description": "The recipient of the message",
+ "title": "To"
}
},
- title: "NewMessagePayload",
- type: "object"
+ "title": "NewMessagePayload",
+ "type": "object"
},
- slug: "GMAIL_NEW_GMAIL_MESSAGE",
- type: "poll"
+ "slug": "GMAIL_NEW_GMAIL_MESSAGE",
+ "type": "poll"
}
"
`);
diff --git a/ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts b/ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
index 3cb055a60..a4159f175 100644
--- a/ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
+++ b/ts/packages/cli/test/src/generation/python/generate-toolkit-source.test.ts
@@ -95,141 +95,141 @@ describe('generatePythonToolkitSources', () => {
class triggers:
NEW_GMAIL_MESSAGE = {
- config: {
- properties: {
- interval: {
- default: 1,
- description: "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
- title: "Interval",
- type: "number"
+ "config": {
+ "properties": {
+ "interval": {
+ "default": 1,
+ "description": "Periodic Interval to Check for Updates & Send a Trigger in Minutes",
+ "title": "Interval",
+ "type": "number"
},
- labelIds: {
- default: "INBOX",
- description: "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
- examples: ["INBOX", "UNREAD", "STARRED"],
- title: "Labelids",
- type: "string"
+ "labelIds": {
+ "default": "INBOX",
+ "description": "Filter messages by a single label ID. Labels identify the status or category of messages. Supported labels include 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', and 'CATEGORY_FORUMS'. For complex label filtering, use the 'query' parameter instead.",
+ "examples": ["INBOX", "UNREAD", "STARRED"],
+ "title": "Labelids",
+ "type": "string"
},
- query: {
- default: "",
- description: "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:[email protected]), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
- examples: ["label:inbox OR label:sent", "from:[email protected] is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
- title: "Query",
- type: "string"
+ "query": {
+ "default": "",
+ "description": "Advanced Gmail search using the same syntax as Gmail's search box. Use 'AND' for messages that match all conditions, 'OR' for any condition. Search by sender (from:[email protected]), labels (label:inbox), status (is:unread), attachments (has:attachment), dates (after:2023/1/1), and more. If specified, this takes precedence over labelIds.",
+ "examples": ["label:inbox OR label:sent", "from:[email protected] is:unread", "has:attachment after:2023/1/1", "is:important is:unread"],
+ "title": "Query",
+ "type": "string"
},
- userId: {
- default: "me",
- description: "The user's email address or 'me' for the authenticated user.",
- examples: ["me"],
- title: "Userid",
- type: "string"
+ "userId": {
+ "default": "me",
+ "description": "The user's email address or 'me' for the authenticated user.",
+ "examples": ["me"],
+ "title": "Userid",
+ "type": "string"
}
},
- title: "NewMessageConfig",
- type: "object"
+ "title": "NewMessageConfig",
+ "type": "object"
},
- description: "Triggers when a new message is received in Gmail.",
- instructions: "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
- name: "New Gmail Message Received Trigger",
- payload: {
- properties: {
- attachment_list: {
- anyOf: [{
- items: {},
- type: "array"
+ "description": "Triggers when a new message is received in Gmail.",
+ "instructions": "\\n **Instructions for Setting Up the Trigger:**\\n\\n - Ensure that the Gmail API is enabled for your Google account.\\n - Provide the user ID (usually 'me' for the authenticated user).\\n - Optionally, provide label IDs to filter messages.\\n ",
+ "name": "New Gmail Message Received Trigger",
+ "payload": {
+ "properties": {
+ "attachment_list": {
+ "anyOf": [{
+ "items": {},
+ "type": "array"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The list of attachments in the message",
- title: "Attachment List"
+ "default": None,
+ "description": "The list of attachments in the message",
+ "title": "Attachment List"
},
- message_id: {
- anyOf: [{
- type: "string"
+ "message_id": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The message ID of the message",
- title: "Message ID"
+ "default": None,
+ "description": "The message ID of the message",
+ "title": "Message ID"
},
- message_text: {
- anyOf: [{
- type: "string"
+ "message_text": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The text of the message",
- title: "Message Text"
+ "default": None,
+ "description": "The text of the message",
+ "title": "Message Text"
},
- message_timestamp: {
- anyOf: [{
- type: "string"
+ "message_timestamp": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The timestamp of the message",
- title: "Message Timestamp"
+ "default": None,
+ "description": "The timestamp of the message",
+ "title": "Message Timestamp"
},
- payload: {
- anyOf: [{
- type: "object"
+ "payload": {
+ "anyOf": [{
+ "type": "object"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The payload of the message",
- title: "Payload"
+ "default": None,
+ "description": "The payload of the message",
+ "title": "Payload"
},
- sender: {
- anyOf: [{
- type: "string"
+ "sender": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The sender of the message",
- title: "Sender"
+ "default": None,
+ "description": "The sender of the message",
+ "title": "Sender"
},
- subject: {
- anyOf: [{
- type: "string"
+ "subject": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The subject of the message",
- title: "Subject"
+ "default": None,
+ "description": "The subject of the message",
+ "title": "Subject"
},
- thread_id: {
- anyOf: [{
- type: "string"
+ "thread_id": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The thread ID of the message",
- title: "Thread ID"
+ "default": None,
+ "description": "The thread ID of the message",
+ "title": "Thread ID"
},
- to: {
- anyOf: [{
- type: "string"
+ "to": {
+ "anyOf": [{
+ "type": "string"
}, {
- type: "null"
+ "type": "null"
}],
- default: None,
- description: "The recipient of the message",
- title: "To"
+ "default": None,
+ "description": "The recipient of the message",
+ "title": "To"
}
},
- title: "NewMessagePayload",
- type: "object"
+ "title": "NewMessagePayload",
+ "type": "object"
},
- slug: "GMAIL_NEW_GMAIL_MESSAGE",
- type: "poll"
+ "slug": "GMAIL_NEW_GMAIL_MESSAGE",
+ "type": "poll"
}
"
`);