dhruvmaradiya
10/08/2025, 4:27 PMGMAIL_CREATE_EMAIL_DRAFT tool.
In the before_execute hook, I send data such as subject, to, and body to the frontend — essentially the input metadata for the draft.
In the after_execute hook, I want to send back the draft_id and message_id, which are returned by the Gmail API after the draft is created.
However, there’s a problem: if GMAIL_CREATE_EMAIL_DRAFT is called multiple times, there’s currently no reliable way to identify which draft_id and message_id belong to which specific draft request.
In other words, there’s no persistent identifier connecting the before_execute and after_execute hooks for the same tool execution.
So is there a way to handle this scenario?Akram Boussanni
10/08/2025, 5:00 PMGMAIL_FETCH_MESSAGE_BY_MESSAGE_ID or GMAIL_FETCH_MESSAGE_BY_THREAD_ID to fetch the information regarding the thread and process it accordingly.
— Alternatively, you can modify the afterExecute to replace the keys with custom for each draft (renaming threadId to be something like Draft1Id1 ) or append custom value to each Id to identify the threadId(ex: 1Dftavsadvy243r will be D1_1Dftavsadvy243r ).
— Let me know if this helps your query! I've attached an Image with both the suggested afterExecute options for your reference:
https://cdn.discordapp.com/attachments/1425520026768642243/1425528215459594300/Screenshot_2025-10-08_at_22.22.59.png?ex=68e7ea1b&is=68e6989b&hm=aaf5aadf0defb3a58413ee4f497e70ad9cb29c8116085ee4ca57ba4b9316872a&dhruvmaradiya
10/08/2025, 6:20 PMafter_execute. Thank youAkram Boussanni
10/09/2025, 5:04 AM