@mondaydotcomorg/agent-toolkit 2.4.2 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -312,7 +312,52 @@
312
312
  type
313
313
  }
314
314
  }
315
- `,Z_={query:e.z.string().describe("Custom GraphQL query/mutation. you need to provide the full query / mutation"),variables:e.z.string().describe("JSON string containing the variables for the GraphQL operation")};class eT extends fg{constructor(e,a,t){super(e,a,t),this.name="all_monday_api",this.type=Zi.ALL_API,this.annotations=hg({title:"Run Query or Mutation on any monday.com API",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Execute any Monday.com API operation by generating GraphQL queries and mutations dynamically. Make sure you ask only for the fields you need and nothing more. When providing the query/mutation - use get_graphql_schema and get_type_details tools first to understand the schema before crafting your query."}getInputSchema(){return Z_}async loadSchema(e){if(eT.schemaCache[e])return eT.schemaCache[e];try{const a=await this.mondayApi.rawRequest(J_),{data:t}=a,i=yx(t);return eT.schemaCache[e]=i,i}catch(e){throw new Error(`Failed to load GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`)}}async validateOperation(e,a){var t;return gx(await this.loadSchema(a),new cy(e,t).parseDocument()).map((e=>e.message))}async executeInternal(e){const{query:a,variables:t}=e;try{let e={};try{e=JSON.parse(t)}catch(e){return{content:`Error parsing variables: ${e instanceof Error?e.message:"Unknown error"}`}}const i=this.mondayApi.apiVersion,n=await this.validateOperation(a,i);if(n.length>0)return{content:n.join(", ")};const r=await this.mondayApi.request(a,e);return{content:JSON.stringify(r)}}catch(e){const a=e instanceof Error?e.message:"Unknown error";if(e instanceof Error&&"response"in e){const a=e;if(a.response?.errors)return{content:a.response.errors.map((e=>e.message)).join(", ")}}return{content:a}}}}eT.schemaCache={};const aT={itemId:e.z.number().describe("The ID of the item to be updated"),columnValues:e.z.string().describe('A string containing the new column values for the item following this structure: {\\"column_id\\": \\"value\\",... you can change multiple columns at once, note that for status column you must use nested value with \'label\' as a key and for date column use \'date\' as key} - example: "{\\"text_column_id\\":\\"New text\\", \\"status_column_id\\":{\\"label\\":\\"Done\\"}, \\"date_column_id\\":{\\"date\\":\\"2023-05-25\\"}, \\"phone_id\\":\\"123-456-7890\\", \\"email_id\\":\\"test@example.com\\"}"')},tT={boardId:e.z.number().describe("The ID of the board that contains the item to be updated"),...aT};const iT={boardName:e.z.string().describe("The name of the board to create"),boardKind:e.z.nativeEnum(Tx).default(Tx.Public).describe("The kind of board to create"),boardDescription:e.z.string().optional().describe("The description of the board to create"),workspaceId:e.z.string().optional().describe("The ID of the workspace to create the board in")};const nT={columnType:e.z.nativeEnum(Ox).describe("The type of the column to be created"),columnTitle:e.z.string().describe("The title of the column to be created"),columnDescription:e.z.string().optional().describe("The description of the column to be created"),columnSettings:e.z.array(e.z.string()).optional().describe("The default values for the new column (relevant only for column type 'status' or 'dropdown') when possible make the values relevant to the user's request")},rT={boardId:e.z.number().describe("The id of the board to which the new column will be added"),...nT};const oT={color:e.z.nativeEnum(Ax).describe("The color of the custom activity"),icon_id:e.z.nativeEnum(Rx).describe("The icon ID of the custom activity"),name:e.z.string().describe("The name of the custom activity")};const sT={name:e.z.string().describe("The name of the new item to be created, must be relevant to the user's request"),groupId:e.z.string().optional().describe("The id of the group id to which the new item will be added, if its not clearly specified, leave empty"),columnValues:e.z.string().describe('A string containing the new column values for the item following this structure: {\\"column_id\\": \\"value\\",... you can change multiple columns at once, note that for status column you must use nested value with \'label\' as a key and for date column use \'date\' as key} - example: "{\\"text_column_id\\":\\"New text\\", \\"status_column_id\\":{\\"label\\":\\"Done\\"}, \\"date_column_id\\":{\\"date\\":\\"2023-05-25\\"},\\"dropdown_id\\":\\"value\\", \\"phone_id\\":\\"123-456-7890\\", \\"email_id\\":\\"test@example.com\\"}"')},pT={boardId:e.z.number().describe("The id of the board to which the new item will be added"),...sT};const dT={item_id:e.z.number().describe("The ID of the item to create the new timeline item on"),custom_activity_id:e.z.string().describe("The ID of the custom activity for the timeline item"),title:e.z.string().describe("The title of the new timeline item"),summary:e.z.string().optional().describe("The summary of the new timeline item (max 255 characters)"),content:e.z.string().optional().describe("The content of the new timeline item"),timestamp:e.z.string().describe("The creation time of the new timeline item in ISO8601 format (e.g., 2024-06-06T18:00:30Z)"),start_timestamp:e.z.string().optional().describe("The start time of the timeline item in ISO8601 format"),end_timestamp:e.z.string().optional().describe("The end time of the timeline item in ISO8601 format"),location:e.z.string().optional().describe("The location to add to the new timeline item"),phone:e.z.string().optional().describe("The phone number to add to the new timeline item"),url:e.z.string().optional().describe("The URL to add to the new timeline item")};const lT={itemId:e.z.number().describe("The id of the item to which the update will be added"),body:e.z.string().describe("The update to be created, must be relevant to the user's request")};const cT={columnId:e.z.string().describe("The id of the column to be deleted")},mT={boardId:e.z.number().describe("The id of the board to which the new column will be added"),...cT};const uT={itemId:e.z.number()};const hT={};const fT={term:e.z.string()},vT={boardId:e.z.number(),...fT};const gT={boardId:e.z.number().describe("The id of the board to get the schema of")};const yT={random_string:e.z.string().describe("Dummy parameter for no-parameter tools").optional(),operationType:e.z.enum(["read","write"]).describe('Type of operation: "read" for queries, "write" for mutations').optional()};const bT={typeName:e.z.string().describe("The name of the GraphQL type to get details for")};function wT(e){return e?"NON_NULL"===e.kind?`${wT(e.ofType)}!`:"LIST"===e.kind?`[${wT(e.ofType)}]`:e.name||"unknown":"unknown"}const xT={name:e.z.string().optional().describe("The name or partial name of the user to get")};const ET={itemId:e.z.number().describe("The id of the item to which the update will be added"),groupId:e.z.string().describe("The id of the group to which the item will be moved")};const _T={action:e.z.enum(["enable","disable","status","list","detailed","reset"]).describe('Action to perform: "list" or "detailed" to discover available tools, "status" to check current states, "enable" to activate needed tools, "disable" to deactivate tools, "reset" to restore defaults'),toolName:e.z.string().optional().describe("Name of the tool to manage (required for enable/disable/status/reset)")};class TT{constructor(){this.name="manage_tools",this.type=Zi.READ,this.enabledByDefault=!0,this.annotations={title:"Discover & Manage Monday.com Tools",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}}setToolkitManager(e){this.toolkitManager=e}getDescription(){return"Discover and manage available monday.com tools. Use this tool first to see what tools are available, check which ones are active/inactive, and enable any tools you need for your tasks. When enabling a tool, you will be asked for confirmation first. Essential for understanding your monday.com toolkit capabilities."}getInputSchema(){return _T}async execute(e){if(!this.toolkitManager)throw new Error("Toolkit manager not initialized");if(!e)throw new Error("Input parameters are required");const{action:a,toolName:t}=e;switch(a){case"enable":if(!t)throw new Error("Tool name is required for enable action");if(this.toolkitManager.isToolEnabled(t))return{content:`Tool '${t}' is already enabled`};return{content:this.toolkitManager.enableTool(t)?`✅ Tool '${t}' has been enabled and is now available for use`:`❌ Failed to enable tool '${t}' (tool not found)`};case"disable":if(!t)throw new Error("Tool name is required for disable action");return{content:this.toolkitManager.disableTool(t)?`Tool '${t}' has been disabled`:`Failed to disable tool '${t}' (tool not found)`};case"status":if(t){return{content:`Tool '${t}' is ${this.toolkitManager.isToolEnabled(t)?"enabled":"disabled"}`}}{const e=this.toolkitManager.getToolsStatus();return{content:`All tools status:\n${Object.entries(e).map((([e,a])=>`${e}: ${a?"enabled":"disabled"}`)).join("\n")}`}}case"detailed":{const e=this.toolkitManager.getDetailedToolsStatus(),a=Object.entries(e).filter((([,e])=>e.enabled)),t=Object.entries(e).filter((([,e])=>!e.enabled));let i="Monday.com Tools Discovery:\n\n";return a.length>0&&(i+="✅ ACTIVE TOOLS (ready to use):\n",i+=a.map((([e,a])=>` • ${e} (default: ${a.enabledByDefault?"enabled":"disabled"})`)).join("\n")),t.length>0&&(i+="\n\n⚠️ INACTIVE TOOLS (need activation):\n",i+=t.map((([e,a])=>` • ${e} (default: ${a.enabledByDefault?"enabled":"disabled"}) - use {"action": "enable", "toolName": "${e}"} to activate`)).join("\n")),{content:i}}case"reset":{if(!t)throw new Error("Tool name is required for reset action");const e=this.toolkitManager.resetToolToDefault(t),a=this.toolkitManager.isToolEnabledByDefault(t);return{content:e?`Tool '${t}' has been reset to its default state (${a?"enabled":"disabled"})`:`Failed to reset tool '${t}' (tool not found)`}}case"list":{const e=this.toolkitManager.getToolsStatus();return{content:`Available tools: ${Object.entries(e).map((([e,a])=>`${e} (${a?"enabled":"disabled"})`)).join(", ")}`}}default:throw new Error("Invalid action. Use: enable, disable, status, list, detailed, or reset")}}}const ST=[class extends fg{constructor(){super(...arguments),this.name="delete_item",this.type=Zi.WRITE,this.annotations=hg({title:"Delete Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete an item"}getInputSchema(){return uT}async executeInternal(e){const a={id:e.itemId.toString()},t=await this.mondayApi.request(L_,a);return{content:`Item ${t.delete_item?.id} successfully deleted`}}},class extends fg{constructor(){super(...arguments),this.name="get_board_items_by_name",this.type=Zi.READ,this.annotations=hg({title:"Get Board Items",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get items by board id and term"}getInputSchema(){return this.context?.boardId?fT:vT}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),term:e.term},t=await this.mondayApi.request($_,a);return{content:`Items ${t.boards?.[0]?.items_page?.items?.map((e=>`name: ${e.name}, id: ${e.id}`)).join(", ")} successfully fetched`}}},class extends fg{constructor(){super(...arguments),this.name="create_item",this.type=Zi.WRITE,this.annotations=hg({title:"Create Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new item in a monday.com board"}getInputSchema(){return this.context?.boardId?sT:pT}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),itemName:e.name,groupId:e.groupId,columnValues:e.columnValues},t=await this.mondayApi.request(V_,a);return{content:`Item ${t.create_item?.id} successfully created`}}},class extends fg{constructor(){super(...arguments),this.name="create_update",this.type=Zi.WRITE,this.annotations=hg({title:"Create Update",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new update in a monday.com board"}getInputSchema(){return lT}async executeInternal(e){const a={itemId:e.itemId.toString(),body:e.body},t=await this.mondayApi.request(z_,a);return{content:`Update ${t.create_update?.id} successfully created on item ${e.itemId}`}}},class extends fg{constructor(){super(...arguments),this.name="get_board_schema",this.type=Zi.READ,this.annotations=hg({title:"Get Board Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get board schema (columns and groups) by board id"}getInputSchema(){if(!this.context?.boardId)return gT}async executeInternal(e){const a=this.context?.boardId??e.boardId,t={boardId:a.toString()},i=await this.mondayApi.request(U_,t);return{content:`The current schema of the board ${a} is: \n \n\nColumns:\n ${i.boards?.[0]?.columns?.map((e=>`Id - ${e?.id}\n Title - ${e?.title}\n Type - ${e?.type}`)).join("\n")}\n \n\nGroups:\n ${i.boards?.[0]?.groups?.map((e=>`Id - ${e?.id}\n Title - ${e?.title}`)).join("\n")}`}}},class extends fg{constructor(){super(...arguments),this.name="get_users_by_name",this.type=Zi.READ,this.annotations=hg({title:"Get Users",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get users, can be filtered by name or partial name"}getInputSchema(){return xT}async executeInternal(e){const a={name:e.name},t=await this.mondayApi.request(B_,a);return{content:`Relevant users:\n ${t.users?.map((e=>` id: ${e?.id}, name: ${e?.name}, title: ${e?.title}`)).join("\n")}`}}},class extends fg{constructor(){super(...arguments),this.name="change_item_column_values",this.type=Zi.WRITE,this.annotations=hg({title:"Change Item Column Values",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Change the column values of an item in a monday.com board"}getInputSchema(){return this.context?.boardId?aT:tT}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),itemId:e.itemId.toString(),columnValues:e.columnValues},t=await this.mondayApi.request(M_,a);return{content:`Item ${t.change_multiple_column_values?.id} successfully updated with the new column values`}}},class extends fg{constructor(){super(...arguments),this.name="move_item_to_group",this.type=Zi.WRITE,this.annotations=hg({title:"Move Item to Group",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Move an item to a group in a monday.com board"}getInputSchema(){return ET}async executeInternal(e){const a={itemId:e.itemId.toString(),groupId:e.groupId},t=await this.mondayApi.request(q_,a);return{content:`Item ${t.move_item_to_group?.id} successfully moved to group ${e.groupId}`}}},class extends fg{constructor(){super(...arguments),this.name="create_board",this.type=Zi.WRITE,this.annotations=hg({title:"Create Board",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com board"}getInputSchema(){return iT}async executeInternal(e){const a={boardName:e.boardName,boardKind:e.boardKind,boardDescription:e.boardDescription,workspaceId:e.workspaceId},t=await this.mondayApi.request(H_,a);return{content:`Board ${t.create_board?.id} successfully created`}}},class extends fg{constructor(){super(...arguments),this.name="create_column",this.type=Zi.WRITE,this.annotations=hg({title:"Create Column",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new column in a monday.com board"}getInputSchema(){return this.context?.boardId?nT:rT}async executeInternal(e){const a=this.context?.boardId??e.boardId;let t;e.columnSettings&&e.columnType===Ox.Status?t=JSON.stringify({labels:Object.fromEntries(e.columnSettings.map(((e,a)=>[String(a+1),e])))}):e.columnSettings&&e.columnType===Ox.Dropdown&&(t=JSON.stringify({settings:{labels:e.columnSettings.map(((e,a)=>({id:a+1,name:e})))}}));const i={boardId:a.toString(),columnType:e.columnType,columnTitle:e.columnTitle,columnDescription:e.columnDescription,columnSettings:t},n=await this.mondayApi.request(G_,i);return{content:`Column ${n.create_column?.id} successfully created`}}},class extends fg{constructor(){super(...arguments),this.name="delete_column",this.type=Zi.WRITE,this.annotations=hg({title:"Delete Column",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete a column from a monday.com board"}getInputSchema(){return this.context?.boardId?cT:mT}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),columnId:e.columnId},t=await this.mondayApi.request(K_,a);return{content:`Column ${t.delete_column?.id} successfully deleted`}}},eT,class extends fg{constructor(){super(...arguments),this.name="get_graphql_schema",this.type=Zi.ALL_API,this.annotations=hg({title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch the Monday.com GraphQL schema structure including query and mutation definitions. This tool returns available query fields, mutation fields, and a list of GraphQL types in the schema. You can filter results by operation type (read/write) to focus on either queries or mutations."}getInputSchema(){return yT}async executeInternal(e){try{const a=await this.mondayApi.request(Q_),t=e?.operationType,i=a.queryType?.fields?.map((e=>`- ${e.name}${e.description?`: ${e.description}`:""}`)).join("\n")||"No query fields found",n=a.mutationType?.fields?.map((e=>`- ${e.name}${e.description?`: ${e.description}`:""}`)).join("\n")||"No mutation fields found",r=a.__schema,o=r?.types?.filter((e=>e.name&&!e.name.startsWith("__"))).map((e=>`- ${e.name} (${e.kind||"unknown"})`)).join("\n")||"No types found";let s="## GraphQL Schema\n";return t&&"read"!==t||(s+=`- Query Type: ${a.__schema?.queryType?.name}\n\n`,s+=`## Query Fields\n${i}\n\n`),t&&"write"!==t||(s+=`- Mutation Type: ${a.__schema?.mutationType?.name}\n\n`,s+=`## Mutation Fields\n${n}\n\n`),s+=`## Available Types\n${o}\n\n`,s+='To get detailed information about a specific type, use the get_type_details tool with the type name.\nFor example: get_type_details(typeName: "Board") to see Board type details.',{content:s}}catch(e){return{content:`Error fetching GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends fg{constructor(){super(...arguments),this.name="get_type_details",this.type=Zi.ALL_API,this.annotations=hg({title:"Get Type Details",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get detailed information about a specific GraphQL type from the Monday.com API schema"}getInputSchema(){return bT}async executeInternal(e){try{if(!e.typeName)return{content:"Error: typeName is required. Please provide a valid GraphQL type name."};const t=(a=e.typeName,F_`
315
+ `,Z_=F_`
316
+ query readDocs(
317
+ $ids: [ID!]
318
+ $object_ids: [ID!]
319
+ $limit: Int
320
+ $order_by: DocsOrderBy
321
+ $page: Int
322
+ $workspace_ids: [ID]
323
+ ) {
324
+ docs(
325
+ ids: $ids
326
+ object_ids: $object_ids
327
+ limit: $limit
328
+ order_by: $order_by
329
+ page: $page
330
+ workspace_ids: $workspace_ids
331
+ ) {
332
+ id
333
+ object_id
334
+ name
335
+ doc_kind
336
+ created_at
337
+ created_by {
338
+ id
339
+ name
340
+ }
341
+ settings
342
+ url
343
+ relative_url
344
+ workspace {
345
+ id
346
+ name
347
+ }
348
+ workspace_id
349
+ doc_folder_id
350
+ }
351
+ }
352
+ `,eT=F_`
353
+ mutation exportMarkdownFromDoc($docId: ID!, $blockIds: [String!]) {
354
+ export_markdown_from_doc(docId: $docId, blockIds: $blockIds) {
355
+ success
356
+ markdown
357
+ error
358
+ }
359
+ }
360
+ `,aT={query:e.z.string().describe("Custom GraphQL query/mutation. you need to provide the full query / mutation"),variables:e.z.string().describe("JSON string containing the variables for the GraphQL operation")};class tT extends fg{constructor(e,a,t){super(e,a,t),this.name="all_monday_api",this.type=Zi.ALL_API,this.annotations=hg({title:"Run Query or Mutation on any monday.com API",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Execute any Monday.com API operation by generating GraphQL queries and mutations dynamically. Make sure you ask only for the fields you need and nothing more. When providing the query/mutation - use get_graphql_schema and get_type_details tools first to understand the schema before crafting your query."}getInputSchema(){return aT}async loadSchema(e){if(tT.schemaCache[e])return tT.schemaCache[e];try{const a=await this.mondayApi.rawRequest(J_),{data:t}=a,i=yx(t);return tT.schemaCache[e]=i,i}catch(e){throw new Error(`Failed to load GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`)}}async validateOperation(e,a){var t;return gx(await this.loadSchema(a),new cy(e,t).parseDocument()).map((e=>e.message))}async executeInternal(e){const{query:a,variables:t}=e;try{let e={};try{e=JSON.parse(t)}catch(e){return{content:`Error parsing variables: ${e instanceof Error?e.message:"Unknown error"}`}}const i=this.mondayApi.apiVersion,n=await this.validateOperation(a,i);if(n.length>0)return{content:n.join(", ")};const r=await this.mondayApi.request(a,e);return{content:JSON.stringify(r)}}catch(e){const a=e instanceof Error?e.message:"Unknown error";if(e instanceof Error&&"response"in e){const a=e;if(a.response?.errors)return{content:a.response.errors.map((e=>e.message)).join(", ")}}return{content:a}}}}tT.schemaCache={};const iT={itemId:e.z.number().describe("The ID of the item to be updated"),columnValues:e.z.string().describe('A string containing the new column values for the item following this structure: {\\"column_id\\": \\"value\\",... you can change multiple columns at once, note that for status column you must use nested value with \'label\' as a key and for date column use \'date\' as key} - example: "{\\"text_column_id\\":\\"New text\\", \\"status_column_id\\":{\\"label\\":\\"Done\\"}, \\"date_column_id\\":{\\"date\\":\\"2023-05-25\\"}, \\"phone_id\\":\\"123-456-7890\\", \\"email_id\\":\\"test@example.com\\"}"')},nT={boardId:e.z.number().describe("The ID of the board that contains the item to be updated"),...iT};const rT={boardName:e.z.string().describe("The name of the board to create"),boardKind:e.z.nativeEnum(Tx).default(Tx.Public).describe("The kind of board to create"),boardDescription:e.z.string().optional().describe("The description of the board to create"),workspaceId:e.z.string().optional().describe("The ID of the workspace to create the board in")};const oT={columnType:e.z.nativeEnum(Ox).describe("The type of the column to be created"),columnTitle:e.z.string().describe("The title of the column to be created"),columnDescription:e.z.string().optional().describe("The description of the column to be created"),columnSettings:e.z.array(e.z.string()).optional().describe("The default values for the new column (relevant only for column type 'status' or 'dropdown') when possible make the values relevant to the user's request")},sT={boardId:e.z.number().describe("The id of the board to which the new column will be added"),...oT};const pT={color:e.z.nativeEnum(Ax).describe("The color of the custom activity"),icon_id:e.z.nativeEnum(Rx).describe("The icon ID of the custom activity"),name:e.z.string().describe("The name of the custom activity")};const dT={name:e.z.string().describe("The name of the new item to be created, must be relevant to the user's request"),groupId:e.z.string().optional().describe("The id of the group id to which the new item will be added, if its not clearly specified, leave empty"),columnValues:e.z.string().describe('A string containing the new column values for the item following this structure: {\\"column_id\\": \\"value\\",... you can change multiple columns at once, note that for status column you must use nested value with \'label\' as a key and for date column use \'date\' as key} - example: "{\\"text_column_id\\":\\"New text\\", \\"status_column_id\\":{\\"label\\":\\"Done\\"}, \\"date_column_id\\":{\\"date\\":\\"2023-05-25\\"},\\"dropdown_id\\":\\"value\\", \\"phone_id\\":\\"123-456-7890\\", \\"email_id\\":\\"test@example.com\\"}"')},lT={boardId:e.z.number().describe("The id of the board to which the new item will be added"),...dT};const cT={item_id:e.z.number().describe("The ID of the item to create the new timeline item on"),custom_activity_id:e.z.string().describe("The ID of the custom activity for the timeline item"),title:e.z.string().describe("The title of the new timeline item"),summary:e.z.string().optional().describe("The summary of the new timeline item (max 255 characters)"),content:e.z.string().optional().describe("The content of the new timeline item"),timestamp:e.z.string().describe("The creation time of the new timeline item in ISO8601 format (e.g., 2024-06-06T18:00:30Z)"),start_timestamp:e.z.string().optional().describe("The start time of the timeline item in ISO8601 format"),end_timestamp:e.z.string().optional().describe("The end time of the timeline item in ISO8601 format"),location:e.z.string().optional().describe("The location to add to the new timeline item"),phone:e.z.string().optional().describe("The phone number to add to the new timeline item"),url:e.z.string().optional().describe("The URL to add to the new timeline item")};const mT={itemId:e.z.number().describe("The id of the item to which the update will be added"),body:e.z.string().describe("The update to be created, must be relevant to the user's request")};const uT={columnId:e.z.string().describe("The id of the column to be deleted")},hT={boardId:e.z.number().describe("The id of the board to which the new column will be added"),...uT};const fT={itemId:e.z.number()};const vT={};const gT={term:e.z.string()},yT={boardId:e.z.number(),...gT};const bT={boardId:e.z.number().describe("The id of the board to get the schema of")};const wT={random_string:e.z.string().describe("Dummy parameter for no-parameter tools").optional(),operationType:e.z.enum(["read","write"]).describe('Type of operation: "read" for queries, "write" for mutations').optional()};const xT={typeName:e.z.string().describe("The name of the GraphQL type to get details for")};function ET(e){return e?"NON_NULL"===e.kind?`${ET(e.ofType)}!`:"LIST"===e.kind?`[${ET(e.ofType)}]`:e.name||"unknown":"unknown"}const _T={name:e.z.string().optional().describe("The name or partial name of the user to get")};const TT={itemId:e.z.number().describe("The id of the item to which the update will be added"),groupId:e.z.string().describe("The id of the group to which the item will be moved")};const ST=e.z.enum(["ids","object_ids","workspace_ids"]),NT={ids:e.z.object({type:ST.describe("Type of id to query by: ids, object_ids, or workspace_ids"),values:e.z.array(e.z.string()).min(1).describe("Array of ID values for this query type (at least 1 required)")}).describe("ID query object that specifies a type (ids/object_ids/workspace_ids) and an array of values."),limit:e.z.number().optional().describe("Number of docs per page (default: 25). Affects pagination - if you get exactly this many results, there may be more pages."),order_by:e.z.nativeEnum(jx).optional().describe("The order in which to retrieve your docs. The default shows created_at with the newest docs listed first. This argument will not be applied if you query docs by specific ids."),page:e.z.number().optional().describe("The page number to return (starts at 1). Use this to paginate through large result sets. Check response for has_more_pages indicator.")};const IT={action:e.z.enum(["enable","disable","status","list","detailed","reset"]).describe('Action to perform: "list" or "detailed" to discover available tools, "status" to check current states, "enable" to activate needed tools, "disable" to deactivate tools, "reset" to restore defaults'),toolName:e.z.string().optional().describe("Name of the tool to manage (required for enable/disable/status/reset)")};class DT{constructor(){this.name="manage_tools",this.type=Zi.READ,this.enabledByDefault=!0,this.annotations={title:"Discover & Manage Monday.com Tools",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}}setToolkitManager(e){this.toolkitManager=e}getDescription(){return"Discover and manage available monday.com tools. Use this tool first to see what tools are available, check which ones are active/inactive, and enable any tools you need for your tasks. When enabling a tool, you will be asked for confirmation first. Essential for understanding your monday.com toolkit capabilities."}getInputSchema(){return IT}async execute(e){if(!this.toolkitManager)throw new Error("Toolkit manager not initialized");if(!e)throw new Error("Input parameters are required");const{action:a,toolName:t}=e;switch(a){case"enable":if(!t)throw new Error("Tool name is required for enable action");if(this.toolkitManager.isToolEnabled(t))return{content:`Tool '${t}' is already enabled`};return{content:this.toolkitManager.enableTool(t)?`✅ Tool '${t}' has been enabled and is now available for use`:`❌ Failed to enable tool '${t}' (tool not found)`};case"disable":if(!t)throw new Error("Tool name is required for disable action");return{content:this.toolkitManager.disableTool(t)?`Tool '${t}' has been disabled`:`Failed to disable tool '${t}' (tool not found)`};case"status":if(t){return{content:`Tool '${t}' is ${this.toolkitManager.isToolEnabled(t)?"enabled":"disabled"}`}}{const e=this.toolkitManager.getToolsStatus();return{content:`All tools status:\n${Object.entries(e).map((([e,a])=>`${e}: ${a?"enabled":"disabled"}`)).join("\n")}`}}case"detailed":{const e=this.toolkitManager.getDetailedToolsStatus(),a=Object.entries(e).filter((([,e])=>e.enabled)),t=Object.entries(e).filter((([,e])=>!e.enabled));let i="Monday.com Tools Discovery:\n\n";return a.length>0&&(i+="✅ ACTIVE TOOLS (ready to use):\n",i+=a.map((([e,a])=>` • ${e} (default: ${a.enabledByDefault?"enabled":"disabled"})`)).join("\n")),t.length>0&&(i+="\n\n⚠️ INACTIVE TOOLS (need activation):\n",i+=t.map((([e,a])=>` • ${e} (default: ${a.enabledByDefault?"enabled":"disabled"}) - use {"action": "enable", "toolName": "${e}"} to activate`)).join("\n")),{content:i}}case"reset":{if(!t)throw new Error("Tool name is required for reset action");const e=this.toolkitManager.resetToolToDefault(t),a=this.toolkitManager.isToolEnabledByDefault(t);return{content:e?`Tool '${t}' has been reset to its default state (${a?"enabled":"disabled"})`:`Failed to reset tool '${t}' (tool not found)`}}case"list":{const e=this.toolkitManager.getToolsStatus();return{content:`Available tools: ${Object.entries(e).map((([e,a])=>`${e} (${a?"enabled":"disabled"})`)).join(", ")}`}}default:throw new Error("Invalid action. Use: enable, disable, status, list, detailed, or reset")}}}const OT=[class extends fg{constructor(){super(...arguments),this.name="delete_item",this.type=Zi.WRITE,this.annotations=hg({title:"Delete Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete an item"}getInputSchema(){return fT}async executeInternal(e){const a={id:e.itemId.toString()},t=await this.mondayApi.request(L_,a);return{content:`Item ${t.delete_item?.id} successfully deleted`}}},class extends fg{constructor(){super(...arguments),this.name="get_board_items_by_name",this.type=Zi.READ,this.annotations=hg({title:"Get Board Items",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get items by board id and term"}getInputSchema(){return this.context?.boardId?gT:yT}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),term:e.term},t=await this.mondayApi.request($_,a);return{content:`Items ${t.boards?.[0]?.items_page?.items?.map((e=>`name: ${e.name}, id: ${e.id}`)).join(", ")} successfully fetched`}}},class extends fg{constructor(){super(...arguments),this.name="create_item",this.type=Zi.WRITE,this.annotations=hg({title:"Create Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new item in a monday.com board"}getInputSchema(){return this.context?.boardId?dT:lT}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),itemName:e.name,groupId:e.groupId,columnValues:e.columnValues},t=await this.mondayApi.request(V_,a);return{content:`Item ${t.create_item?.id} successfully created`}}},class extends fg{constructor(){super(...arguments),this.name="create_update",this.type=Zi.WRITE,this.annotations=hg({title:"Create Update",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new update in a monday.com board"}getInputSchema(){return mT}async executeInternal(e){const a={itemId:e.itemId.toString(),body:e.body},t=await this.mondayApi.request(z_,a);return{content:`Update ${t.create_update?.id} successfully created on item ${e.itemId}`}}},class extends fg{constructor(){super(...arguments),this.name="get_board_schema",this.type=Zi.READ,this.annotations=hg({title:"Get Board Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get board schema (columns and groups) by board id"}getInputSchema(){if(!this.context?.boardId)return bT}async executeInternal(e){const a=this.context?.boardId??e.boardId,t={boardId:a.toString()},i=await this.mondayApi.request(U_,t);return{content:`The current schema of the board ${a} is: \n \n\nColumns:\n ${i.boards?.[0]?.columns?.map((e=>`Id - ${e?.id}\n Title - ${e?.title}\n Type - ${e?.type}`)).join("\n")}\n \n\nGroups:\n ${i.boards?.[0]?.groups?.map((e=>`Id - ${e?.id}\n Title - ${e?.title}`)).join("\n")}`}}},class extends fg{constructor(){super(...arguments),this.name="get_users_by_name",this.type=Zi.READ,this.annotations=hg({title:"Get Users",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get users, can be filtered by name or partial name"}getInputSchema(){return _T}async executeInternal(e){const a={name:e.name},t=await this.mondayApi.request(B_,a);return{content:`Relevant users:\n ${t.users?.map((e=>` id: ${e?.id}, name: ${e?.name}, title: ${e?.title}`)).join("\n")}`}}},class extends fg{constructor(){super(...arguments),this.name="change_item_column_values",this.type=Zi.WRITE,this.annotations=hg({title:"Change Item Column Values",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Change the column values of an item in a monday.com board"}getInputSchema(){return this.context?.boardId?iT:nT}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),itemId:e.itemId.toString(),columnValues:e.columnValues},t=await this.mondayApi.request(M_,a);return{content:`Item ${t.change_multiple_column_values?.id} successfully updated with the new column values`}}},class extends fg{constructor(){super(...arguments),this.name="move_item_to_group",this.type=Zi.WRITE,this.annotations=hg({title:"Move Item to Group",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Move an item to a group in a monday.com board"}getInputSchema(){return TT}async executeInternal(e){const a={itemId:e.itemId.toString(),groupId:e.groupId},t=await this.mondayApi.request(q_,a);return{content:`Item ${t.move_item_to_group?.id} successfully moved to group ${e.groupId}`}}},class extends fg{constructor(){super(...arguments),this.name="create_board",this.type=Zi.WRITE,this.annotations=hg({title:"Create Board",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com board"}getInputSchema(){return rT}async executeInternal(e){const a={boardName:e.boardName,boardKind:e.boardKind,boardDescription:e.boardDescription,workspaceId:e.workspaceId},t=await this.mondayApi.request(H_,a);return{content:`Board ${t.create_board?.id} successfully created`}}},class extends fg{constructor(){super(...arguments),this.name="create_column",this.type=Zi.WRITE,this.annotations=hg({title:"Create Column",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new column in a monday.com board"}getInputSchema(){return this.context?.boardId?oT:sT}async executeInternal(e){const a=this.context?.boardId??e.boardId;let t;e.columnSettings&&e.columnType===Ox.Status?t=JSON.stringify({labels:Object.fromEntries(e.columnSettings.map(((e,a)=>[String(a+1),e])))}):e.columnSettings&&e.columnType===Ox.Dropdown&&(t=JSON.stringify({settings:{labels:e.columnSettings.map(((e,a)=>({id:a+1,name:e})))}}));const i={boardId:a.toString(),columnType:e.columnType,columnTitle:e.columnTitle,columnDescription:e.columnDescription,columnSettings:t},n=await this.mondayApi.request(G_,i);return{content:`Column ${n.create_column?.id} successfully created`}}},class extends fg{constructor(){super(...arguments),this.name="delete_column",this.type=Zi.WRITE,this.annotations=hg({title:"Delete Column",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete a column from a monday.com board"}getInputSchema(){return this.context?.boardId?uT:hT}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),columnId:e.columnId},t=await this.mondayApi.request(K_,a);return{content:`Column ${t.delete_column?.id} successfully deleted`}}},tT,class extends fg{constructor(){super(...arguments),this.name="get_graphql_schema",this.type=Zi.ALL_API,this.annotations=hg({title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch the Monday.com GraphQL schema structure including query and mutation definitions. This tool returns available query fields, mutation fields, and a list of GraphQL types in the schema. You can filter results by operation type (read/write) to focus on either queries or mutations."}getInputSchema(){return wT}async executeInternal(e){try{const a=await this.mondayApi.request(Q_),t=e?.operationType,i=a.queryType?.fields?.map((e=>`- ${e.name}${e.description?`: ${e.description}`:""}`)).join("\n")||"No query fields found",n=a.mutationType?.fields?.map((e=>`- ${e.name}${e.description?`: ${e.description}`:""}`)).join("\n")||"No mutation fields found",r=a.__schema,o=r?.types?.filter((e=>e.name&&!e.name.startsWith("__"))).map((e=>`- ${e.name} (${e.kind||"unknown"})`)).join("\n")||"No types found";let s="## GraphQL Schema\n";return t&&"read"!==t||(s+=`- Query Type: ${a.__schema?.queryType?.name}\n\n`,s+=`## Query Fields\n${i}\n\n`),t&&"write"!==t||(s+=`- Mutation Type: ${a.__schema?.mutationType?.name}\n\n`,s+=`## Mutation Fields\n${n}\n\n`),s+=`## Available Types\n${o}\n\n`,s+='To get detailed information about a specific type, use the get_type_details tool with the type name.\nFor example: get_type_details(typeName: "Board") to see Board type details.',{content:s}}catch(e){return{content:`Error fetching GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends fg{constructor(){super(...arguments),this.name="get_type_details",this.type=Zi.ALL_API,this.annotations=hg({title:"Get Type Details",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get detailed information about a specific GraphQL type from the Monday.com API schema"}getInputSchema(){return xT}async executeInternal(e){try{if(!e.typeName)return{content:"Error: typeName is required. Please provide a valid GraphQL type name."};const t=(a=e.typeName,F_`
316
361
  query getTypeDetails {
317
362
  __type(name: "${a}") {
318
363
  name
@@ -400,5 +445,5 @@
400
445
  }
401
446
  }
402
447
  }
403
- `),i=await this.mondayApi.request(t);if(!i.__type)return{content:`Type '${e.typeName}' not found in the GraphQL schema. Please check the type name and try again.`};let n=`## Type: ${i.__type.name||"Unnamed"} ${e.typeName===i.__type.name?"":`(queried: ${e.typeName})`}\nKind: ${i.__type.kind}\n${i.__type.description?`Description: ${i.__type.description}`:""}\n\n`;return i.__type.fields&&i.__type.fields.length>0&&(n+="## Fields\n",i.__type.fields.forEach((e=>{const a=wT(e.type);n+=`- ${e.name}: ${a}${e.description?` - ${e.description}`:""}\n`,e.args&&e.args.length>0&&(n+=" Arguments:\n",e.args.forEach((e=>{const a=wT(e.type);n+=` - ${e.name}: ${a}${e.description?` - ${e.description}`:""}${e.defaultValue?` (default: ${e.defaultValue})`:""}\n`})))})),n+="\n"),i.__type.inputFields&&i.__type.inputFields.length>0&&(n+="## Input Fields\n",i.__type.inputFields.forEach((e=>{const a=wT(e.type);n+=`- ${e.name}: ${a}${e.description?` - ${e.description}`:""}${e.defaultValue?` (default: ${e.defaultValue})`:""}\n`})),n+="\n"),i.__type.interfaces&&i.__type.interfaces.length>0&&(n+="## Implements\n",i.__type.interfaces.forEach((e=>{n+=`- ${e.name}\n`})),n+="\n"),i.__type.enumValues&&i.__type.enumValues.length>0&&(n+="## Enum Values\n",i.__type.enumValues.forEach((e=>{n+=`- ${e.name}${e.description?` - ${e.description}`:""}\n`})),n+="\n"),i.__type.possibleTypes&&i.__type.possibleTypes.length>0&&(n+="## Possible Types\n",i.__type.possibleTypes.forEach((e=>{n+=`- ${e.name}\n`}))),n+=`\n## Usage Examples\nIf this is a Query or Mutation field, you can use it in the all_monday_api tool.\n\nExample for query:\nall_monday_api(operation: "query", name: "getTypeData", variables: "{\\"typeName\\": \\"${i.__type.name}\\"}")\n\nExample for object field access:\nWhen querying objects that have this type, include these fields in your query.\n`,{content:n}}catch(e){const a=e instanceof Error?e.message:"Unknown error",t=a.includes("JSON");return{content:`Error fetching type details: ${a}${t?"\n\nThis could be because the type name is incorrect or the GraphQL query format is invalid. Please check the type name and try again.":""}`}}var a}},class extends fg{constructor(){super(...arguments),this.name="create_custom_activity",this.type=Zi.WRITE,this.annotations=hg({title:"Create Custom Activity",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new custom activity in the E&A app"}getInputSchema(){return oT}async executeInternal(e){const a={color:e.color,icon_id:e.icon_id,name:e.name};return await this.mondayApi.request(W_,a),{content:`Custom activity '${e.name}' with color ${e.color} and icon ${e.icon_id} successfully created`}}},class extends fg{constructor(){super(...arguments),this.name="create_timeline_item",this.type=Zi.WRITE,this.annotations=hg({title:"Create Timeline Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new timeline item in the E&A app"}getInputSchema(){return dT}async executeInternal(e){const a={item_id:e.item_id.toString(),custom_activity_id:e.custom_activity_id,title:e.title,timestamp:e.timestamp,summary:e.summary,content:e.content,location:e.location,phone:e.phone,url:e.url};e.start_timestamp&&e.end_timestamp&&(a.time_range={start_timestamp:e.start_timestamp,end_timestamp:e.end_timestamp});const t=await this.mondayApi.request(Y_,a);return{content:`Timeline item '${e.title}' with ID ${t.create_timeline_item?.id} successfully created on item ${e.item_id}`}}},class extends fg{constructor(){super(...arguments),this.name="fetch_custom_activity",this.type=Zi.READ,this.annotations=hg({title:"Fetch Custom Activities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get custom activities from the E&A app"}getInputSchema(){return hT}async executeInternal(e){const a=await this.mondayApi.request(X_);if(!a.custom_activity||0===a.custom_activity.length)return{content:"No custom activities found"};const t=a.custom_activity.map((e=>({id:e.id,name:e.name,color:e.color,icon_id:e.icon_id,type:e.type})));return{content:`Found ${t.length} custom activities: ${JSON.stringify(t,null,2)}`}}},class extends fg{constructor(){super(...arguments),this.name="create_workflow_instructions",this.type=Zi.READ,this.annotations=hg({title:"Create Workflow Instructions"})}getDescription(){return'When the user asks to create a workflow or automation, you must use this tool, which provides instructions on how to create a workflow.\n This tool is very important and should be used when the user explicitly requests:\n - Workflow creation (e.g., "create a monday workflow", "create a new workflow").\n - Automation (e.g., "automate this process", "when item is created, set status to done")\n '}getInputSchema(){return{}}async executeInternal(){return{content:'\n# Instructions to Create a Live Workflow\n\n## General Explanation:\n- A workflow is a structured sequence of actions and conditions and triggers (blocks) designed to automate processes (for example, trigger -> action -> action -> ...).\n- A block is a reusable logic unit; it can be a trigger, condition or action. It has input fields and output fields.\n- A workflow block wraps a block (the underlying logic unit), providing the configuration for its input fields and defining how it connects to other blocks in the workflow graph.\n- A workflow variable presents a value that is used in the workflow block. It has a unique key, a value, and dependencies.\nIt can be a result of a previous block, a user config, a reference, or a host metadata.\nIf it is a user config, you have to get the possible values for the value from remote options query.\n\nTo create a live workflow in monday.com, follow these steps:\n\n## Step 0: Determine and Ensure Host Exists (CRITICAL FIRST STEP)\n\n**Every workflow MUST be attached to an existing host entity.** Before creating any workflow, you must:\n\n### 0.1 Identify the Host Type Based on User Request\n\n**IMPORTANT: The host type depends on what the user is asking for:**\n\n- **If user wants "monday workflows"** (e.g., "create a monday workflow") ALWAYS USE THIS HOST TYPE:\n - Host type: **APP_FEATURE_OBJECT** \n - This is the standalone Workflows product\n - User explicitly mentions "monday workflow" or "workflow" without board context\n \n- **If user wants "automation"** (e.g., "automate when item is created", "set status automatically"):\n - Host type: **BOARD**\n - The automation will run on a specific board\n - User typically mentions board-related triggers/actions and the workflow is pretty simple\n\n### 0.2 Check if Host Exists\n**Always check first before creating:**\n\n**For BOARD hosts (automations):**\n```\nquery {\n boards(ids: [BOARD_ID]) {\n id\n name\n }\n}\n```\nIf user didn\'t specify a board, you may need to ask which board or list available boards.\n\n**For APP_FEATURE_OBJECT hosts (monday workflows):**\nCheck if a workflows object exists for the user/workspace. The exact query depends on the API structure for workflows objects.\n\n### 0.3 Create Host if Missing\n**Only if the host doesn\'t exist, create it first:**\n\n**For BOARD hosts:**\n```\nmutation {\n create_board(\n board_name: "Board Name",\n board_kind: public\n ) {\n id\n }\n}\n```\n\n**For APP_FEATURE_OBJECT hosts:**\n```\nmutation {\n create_workflows_object(\n name: "Workflow Name"\n ) {\n id\n }\n}\n```\n\n### 0.4 Prepare workflowHostData\nOnce you have confirmed the host exists (or created it), prepare the `workflowHostData` object:\n\n**For automations (board host):**\n```\nworkflowHostData: {\n id: "BOARD_ID_HERE",\n type: BOARD\n}\n```\n\n**For monday workflows (app feature host):**\n```\nworkflowHostData: {\n id: "WORKFLOWS_OBJECT_ID_HERE",\n type: APP_FEATURE_OBJECT\n}\n```\n\n**⚠️ IMPORTANT: Do not proceed to the next steps until the host is confirmed to exist and you have its ID.**\n\n## Step 1: Fetch Available Blocks\n\nFetch the blocks including the input fields config using monday api:\nEach block represents a trigger, condition or action. Blocks can have input fields and output fields.\nIn general, you can understand what a block does by its description or name.\nThe "kind" field in the block represents the type of the block (trigger, condition or action).\nThere are some types of input fields: In the case of CustomInputField, it refers to a field type feature. \nIt has special functionality — for example, remote options. These are all the possible values for this type. \nFor example, if the field type is \'board\', then the options will include a list of all boardIds \nTheir identifier is the \'fieldTypeReferenceId\' (or \'id\' in the fieldTypeData).\nThere are dependencies that tell us what values we need to know to fetch the options for the custom input field\'s value.\nFor example, if the custom input field is a status column, the dependency is the board ID.\n\n**Example query to fetch the blocks:**\n```\nquery {\n blocks {\n blocks {\n id\n description\n name\n kind\n inputFieldsConfig {\n fieldTitle\n fieldKey\n ... on CustomInputFieldConfig {\n fieldTypeReferenceId\n fieldTypeUniqueKey\n fieldTypeData {\n id\n dependencyConfig{\n optionalFields{\n sourceFieldTypeReferenceId\n sourceFieldTypeUniqueKey\n targetFieldKey\n }\n orderedMandatoryFields{\n sourceFieldTypeReferenceId\n sourceFieldTypeUniqueKey\n targetFieldKey\n }\n }\n }\n }\n ... on PrimitiveInputFieldConfig {\n primitiveType\n }\n }\n }\n }\n}\n```\n\n## Step 2: Choose Blocks\n\nChoose the trigger block and action blocks that you want to use based on the user\'s automation requirements.\n\n## Step 3: Build Workflow Schema\n\nGet the input schema of the \'create_live_workflow\' mutation.\nPay attention that sometimes you need to run queries to fetch some schemas. Read the description of each field in the schema and follow the instructions if there are any.\n\n## Step 4: Build Workflow Block Schemas\n\nFor each block you choose to use, build the workflow block schema (start from the trigger block):\n- **4.a.** For each input field, build the workflow variable schema and use it in the workflow block.\n- **4.b.** For each output field, build the workflow variable schema and use it in the workflow block.\n\n## Step 5: Retrieve allowed constant values for input fields (remote_options)\n\nSometimes you need to configure an input field with a fixed (constant) value.\n\n1. Examine the block\'s inputFieldsConfig.\n • If the field type is PrimitiveInputFieldConfig – you can pass any literal that matches its primitiveType.\n • If the field type is CustomInputFieldConfig – its allowed values are dynamic. You **MUST** fetch them using the remote_options query.\n\n2. Build the remote_options query for every CustomInputFieldConfig you want to set as a constant:\n • Provide the field_type_unique_key of the field.\n • Fill the dependencies_values object with **all mandatory dependencies** listed in fieldTypeData.dependencyConfig.orderedMandatoryFields. You can supply each dependency as a literal value (value) or as a reference to an existing workflow variable (workflowVariableKey).\n\n3. Select the desired option from the query response (options.value / options.title) and store it in a USER_CONFIG workflow variable that will be referenced by the input field.\n\n**Example:**\n```graphql\nquery remote_options {\n remote_options(\n input: {\n field_type_unique_key: \'monday:status_column\'\n dependencies_values: {\n boardId: { value: 118607562 }\n }\n }\n ) {\n options {\n value\n title\n }\n }\n}\n```\n\n## ⚠️ Common Pitfalls\n\n### Pitfall #1: Skipping remote_options for Custom Fields\n- **Problem:** Using hardcoded values for groups, status columns, people columns\n- **Impact:** Workflow fails silently or uses wrong entities\n- **Solution:** Always call `remote_options` for CustomInputField types\n\n### Pitfall #2: Missing Dependency Values \n- **Problem:** Not providing all required `dependencyConfigValues`\n- **Impact:** API returns empty options or errors\n- **Solution:** Check `dependencyConfig.orderedMandatoryFields` and supply all\n\n### Pitfall #3: Wrong Host Type\n- **Problem:** Using BOARD host for "monday workflows" or APP_FEATURE_OBJECT for "automations"\n- **Impact:** Workflow created in wrong context\n- **Solution:** Follow Step 0.1 decision tree strictly\n\n### Pitfall #4: Hardcoded Field Type IDs\n**Common field types that REQUIRE remote_options:**\n- `10380085` → Groups (depends on boardId)\n- `10380084` → Status columns (depends on boardId) \n- `10380073` → People columns (depends on boardId)\n- `10380094` → Status values (depends on boardId + statusColumnId)\n\n**Never hardcode values for these field types!**\n\n### Pitfall #5: Missing appFeatureReferenceId in Workflow Variables\n- **Problem:** When a workflow variable references an app feature (e.g. a custom inbound field), forgetting to include `appFeatureReferenceId`\n- **Impact:** Can cause issues serializing the workflow variable\n- **Solution:** Always populate `appFeatureReferenceId` when the variable references an app feature, even if it has a primitiveType\n\n## Step 6: Fetch Complete Workflow Variable Schemas\n\nFetch the complete workflow variables schemas with the query \'get_workflow_variable_schemas\'. In general, there are 4 types of workflow variables:\nEach workflow variable has a workflowVariableKey (unique) that is used to identify the variable in the workflow block and a sourceKind (NODE_RESULT, USER_CONFIG, REFERENCE, HOST_METADATA).\n\n**Critical:** When the variable is of **USER_CONFIG** kind and its value was selected via the **remote_options** query (see Step 5), the **exact same dependency key-value pairs** you passed to remote_options **must be placed in** `sourceMetadata.configurationMetadata.dependencyConfigValues`. This guarantees the workflow engine can resolve the value at runtime.\n\n- **6.a. Node result:** A variable that has a value fetched from output fields of the previous block.\n **Example:**\n```\n{\n workflowVariableKey: 2,\n sourceKind: "node_results",\n appFeatureReferenceId: <item_field_type_appFeatureReferenceId>,\n sourceMetadata: {\n workflowNodeId: 1,\n outboundFieldKey: "itemId"\n }\n}\n```\n\n- **6.b. User config:** A variable that has a value fetched from the user config (if the user config is a remote option, you need to use the remote options query).\n **Very important:** You need to make sure that all the dependencies of the field type (dependencyConfigValues) are filled in the sourceMetadata (see the schema).\n **Example:**\n```\n{\n workflowVariableKey: 4,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n statusColumnId:{workflowVariableKey: 3},\n itemId:{workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "number",\n config: {\n value: 1,\n title: "Done"\n }\n }\n```\n\n- **6.c. Reference:** A variable that has a value fetched from a reference (if the reference is a remote option, you need to use the remote options query).\n\n- **6.d. Host metadata:** A variable that has a value fetched from the host metadata. For example: board ID when the host is a board.\n **Example:**\n```\n{\n workflowVariableKey: 1,\n sourceKind: "host_metadata",\n sourceMetadata: {\n hostMetadataKey: "hostInstanceId"\n }\n}\n```\n\n### 6.5: Validation Checklist for Workflow Variables\n\n**MANDATORY: Before proceeding to Step 7, validate each workflow variable:**\n\nFor every **user_config** workflow variable:\n- [ ] Does `fieldTypeReferenceId` exist?\n- [ ] If yes → Is this a CustomInputField with `dependencyConfig`?\n- [ ] If yes → Did you call `remote_options` query with ALL required dependencies?\n- [ ] Did you use an actual `value` from the `remote_options` response (not a hardcoded string)?\n- [ ] Are all `dependencyConfigValues` properly referenced by `workflowVariableKey`?\n\n## Step 7: Create the Live Workflow\n\nCreate the live workflow with the query \'create_live_workflow\', using the workflow variables and workflow blocks in the input.\n\n**Example for board automation:**\n```\nmutation {\n create_live_workflow(\n \n workflow: {\n title: "Auto set Status to Done on item creation",\n description: "When an item is created, automatically set its Status to Done.",\n\n workflowBlocks: [\n {\n workflowNodeId: 1,\n blockReferenceId: 10380130,\n title: "When item created",\n inputFields: [\n {\n fieldKey: "boardId",\n workflowVariableKey: 1\n }\n ],\n nextWorkflowBlocksConfig: {\n type: "directMapping",\n mapping: {\n nextWorkflowNode: {\n workflowNodeId: 2\n }\n }\n }\n },\n {\n workflowNodeId: 2,\n blockReferenceId: 10380126,\n title: "Change status",\n inputFields: [\n {\n fieldKey: "boardId",\n workflowVariableKey: 1\n },\n {\n fieldKey: "itemId",\n workflowVariableKey: 2\n },\n {\n fieldKey: "statusColumnId",\n workflowVariableKey: 3\n },\n {\n fieldKey: "statusColumnValue",\n workflowVariableKey: 4\n }\n ]\n }\n ],\n\n workflowVariables: [\n {\n workflowVariableKey: 1,\n sourceKind: "host_metadata",\n sourceMetadata: {\n hostMetadataKey: "hostInstanceId"\n }\n },\n {\n workflowVariableKey: 2,\n sourceKind: "node_results",\n appFeatureReferenceId: <item_field_type_appFeatureReferenceId>,\n sourceMetadata: {\n workflowNodeId: 1,\n outboundFieldKey: "itemId"\n }\n },\n {\n workflowVariableKey: 3,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n itemId: {workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "string",\n config: {\n value: "status",\n title: "Status"\n }\n },\n {\n workflowVariableKey: 4,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n statusColumnId:{workflowVariableKey: 3},\n itemId:{workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "number",\n config: {\n value: 1,\n title: "Done"\n }\n }\n ],\n\n workflowHostData: {\n id: "118607562",\n type: BOARD\n }\n }\n\n ) {\n id\n }\n}\n```\n\n## Summary Checklist:\n1. ✅ Determine if user wants automation (BOARD host) or monday workflows (APP_FEATURE_OBJECT host)\n2. ✅ Check if the appropriate host exists \n3. ✅ Create host if missing\n4. ✅ Prepare workflowHostData with correct host type and ID\n5. ✅ Fetch available blocks\n6. ✅ Choose appropriate blocks\n7. ✅ Build workflow schema\n8. ✅ Configure workflow variables\n9. ✅ Create the live workflow\n\n## Quick Reference:\n- **"Automate X"** → BOARD host\n- **"Create monday workflow"** → APP_FEATURE_OBJECT host\n'.trim()}}}];var NT;!function(e){e.API="api",e.APPS="apps"}(NT||(NT={}));const IT=(e,a)=>{let t=[];a?.mode===NT.APPS?t=[...en]:a?.mode!==NT.API&&a?.mode||(t=[...ST]);const i=t.map((a=>((e,a)=>e.prototype instanceof fg?new e(a.apiClient,a.apiToken):new e)(a,e)));return i.filter((e=>{if(!a)return e.type!==Zi.ALL_API;if(a.mode===NT.API&&"only"===a.enableDynamicApiTools)return e.type===Zi.ALL_API;let t=!1;return a.mode===NT.API&&!1===a.enableDynamicApiTools&&(t=t||e.type===Zi.ALL_API),a.readOnlyMode&&(t=t||e.type!==Zi.READ),a.include?t=t||!a.include?.includes(e.name):a.exclude&&(t=t||a.exclude?.includes(e.name)),!t}))};class DT{constructor(){this.dynamicTools=new Map}registerTool(e,a){const t=e.enabledByDefault??!0,i=t;this.dynamicTools.set(e.name,{instance:e,mcpTool:a,enabled:i,enabledByDefault:t}),t||a.disable()}enableTool(e){const a=this.dynamicTools.get(e);return!!a&&(a.enabled||(a.mcpTool.enable(),a.enabled=!0),!0)}disableTool(e){const a=this.dynamicTools.get(e);return!!a&&(a.enabled&&(a.mcpTool.disable(),a.enabled=!1),!0)}isToolEnabled(e){const a=this.dynamicTools.get(e);return!!a&&a.enabled}isToolEnabledByDefault(e){const a=this.dynamicTools.get(e);return!a||a.enabledByDefault}getToolsStatus(){const e={};return this.dynamicTools.forEach(((a,t)=>{e[t]=a.enabled})),e}getDynamicToolNames(){return Array.from(this.dynamicTools.keys())}getDetailedToolsStatus(){const e={};return this.dynamicTools.forEach(((a,t)=>{e[t]={enabled:a.enabled,enabledByDefault:a.enabledByDefault}})),e}resetToolToDefault(e){const a=this.dynamicTools.get(e);return!!a&&(a.enabledByDefault&&!a.enabled?(a.mcpTool.enable(),a.enabled=!0,!0):!(!a.enabledByDefault&&a.enabled)||(a.mcpTool.disable(),a.enabled=!1,!0))}getAllDynamicTools(){return this.dynamicTools}clear(){this.dynamicTools.clear()}}exports.DynamicToolManager=DT,exports.MondayAgentToolkit=class extends Ki{constructor(e){super({name:"monday.com",version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),this.dynamicToolManager=new DT,this.mondayApiClient=this.createApiClient(e),this.mondayApiToken=e.mondayApiToken,this.registerTools(e)}createApiClient(e){return new t.ApiClient({token:e.mondayApiToken,apiVersion:e.mondayApiVersion,requestConfig:{...e.mondayApiRequestConfig,headers:{...e.mondayApiRequestConfig?.headers||{},"user-agent":"monday-api-mcp"}}})}registerTools(e){try{this.initializeTools(e).forEach((e=>this.registerSingleTool(e))),!0===e.toolsConfiguration?.enableToolManager&&this.registerManagementTool()}catch(e){throw new Error(`Failed to initialize Monday Agent Toolkit: ${e instanceof Error?e.message:String(e)}`)}}registerManagementTool(){const e=new TT;e.setToolkitManager(this.dynamicToolManager),this.registerSingleTool(e)}initializeTools(e){const a={apiClient:this.mondayApiClient,apiToken:this.mondayApiToken};return IT(a,e.toolsConfiguration)}registerSingleTool(a){const t=a.getInputSchema(),i=this.registerTool(a.name,{title:a.annotations?.title,description:a.getDescription(),inputSchema:t,annotations:a.annotations},(async(i,n)=>{try{let n;if(t){const r=e.z.object(t).safeParse(i);if(!r.success)throw new Error(`Invalid arguments: ${r.error.message}`);n=await a.execute(r.data)}else n=await a.execute();return this.formatToolResult(n.content)}catch(e){return this.handleToolError(e,a.name)}}));this.dynamicToolManager.registerTool(a,i)}enableTool(e){return this.dynamicToolManager.enableTool(e)}disableTool(e){return this.dynamicToolManager.disableTool(e)}isToolEnabled(e){return this.dynamicToolManager.isToolEnabled(e)}getToolsStatus(){return this.dynamicToolManager.getToolsStatus()}getDynamicToolNames(){return this.dynamicToolManager.getDynamicToolNames()}getServer(){return this}formatToolResult(e){return{content:[{type:"text",text:e}]}}handleToolError(e,a){return{content:[{type:"text",text:`Failed to execute tool ${a}: ${e instanceof Error?e.message:String(e)}`}]}}};
448
+ `),i=await this.mondayApi.request(t);if(!i.__type)return{content:`Type '${e.typeName}' not found in the GraphQL schema. Please check the type name and try again.`};let n=`## Type: ${i.__type.name||"Unnamed"} ${e.typeName===i.__type.name?"":`(queried: ${e.typeName})`}\nKind: ${i.__type.kind}\n${i.__type.description?`Description: ${i.__type.description}`:""}\n\n`;return i.__type.fields&&i.__type.fields.length>0&&(n+="## Fields\n",i.__type.fields.forEach((e=>{const a=ET(e.type);n+=`- ${e.name}: ${a}${e.description?` - ${e.description}`:""}\n`,e.args&&e.args.length>0&&(n+=" Arguments:\n",e.args.forEach((e=>{const a=ET(e.type);n+=` - ${e.name}: ${a}${e.description?` - ${e.description}`:""}${e.defaultValue?` (default: ${e.defaultValue})`:""}\n`})))})),n+="\n"),i.__type.inputFields&&i.__type.inputFields.length>0&&(n+="## Input Fields\n",i.__type.inputFields.forEach((e=>{const a=ET(e.type);n+=`- ${e.name}: ${a}${e.description?` - ${e.description}`:""}${e.defaultValue?` (default: ${e.defaultValue})`:""}\n`})),n+="\n"),i.__type.interfaces&&i.__type.interfaces.length>0&&(n+="## Implements\n",i.__type.interfaces.forEach((e=>{n+=`- ${e.name}\n`})),n+="\n"),i.__type.enumValues&&i.__type.enumValues.length>0&&(n+="## Enum Values\n",i.__type.enumValues.forEach((e=>{n+=`- ${e.name}${e.description?` - ${e.description}`:""}\n`})),n+="\n"),i.__type.possibleTypes&&i.__type.possibleTypes.length>0&&(n+="## Possible Types\n",i.__type.possibleTypes.forEach((e=>{n+=`- ${e.name}\n`}))),n+=`\n## Usage Examples\nIf this is a Query or Mutation field, you can use it in the all_monday_api tool.\n\nExample for query:\nall_monday_api(operation: "query", name: "getTypeData", variables: "{\\"typeName\\": \\"${i.__type.name}\\"}")\n\nExample for object field access:\nWhen querying objects that have this type, include these fields in your query.\n`,{content:n}}catch(e){const a=e instanceof Error?e.message:"Unknown error",t=a.includes("JSON");return{content:`Error fetching type details: ${a}${t?"\n\nThis could be because the type name is incorrect or the GraphQL query format is invalid. Please check the type name and try again.":""}`}}var a}},class extends fg{constructor(){super(...arguments),this.name="create_custom_activity",this.type=Zi.WRITE,this.annotations=hg({title:"Create Custom Activity",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new custom activity in the E&A app"}getInputSchema(){return pT}async executeInternal(e){const a={color:e.color,icon_id:e.icon_id,name:e.name};return await this.mondayApi.request(W_,a),{content:`Custom activity '${e.name}' with color ${e.color} and icon ${e.icon_id} successfully created`}}},class extends fg{constructor(){super(...arguments),this.name="create_timeline_item",this.type=Zi.WRITE,this.annotations=hg({title:"Create Timeline Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new timeline item in the E&A app"}getInputSchema(){return cT}async executeInternal(e){const a={item_id:e.item_id.toString(),custom_activity_id:e.custom_activity_id,title:e.title,timestamp:e.timestamp,summary:e.summary,content:e.content,location:e.location,phone:e.phone,url:e.url};e.start_timestamp&&e.end_timestamp&&(a.time_range={start_timestamp:e.start_timestamp,end_timestamp:e.end_timestamp});const t=await this.mondayApi.request(Y_,a);return{content:`Timeline item '${e.title}' with ID ${t.create_timeline_item?.id} successfully created on item ${e.item_id}`}}},class extends fg{constructor(){super(...arguments),this.name="fetch_custom_activity",this.type=Zi.READ,this.annotations=hg({title:"Fetch Custom Activities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get custom activities from the E&A app"}getInputSchema(){return vT}async executeInternal(e){const a=await this.mondayApi.request(X_);if(!a.custom_activity||0===a.custom_activity.length)return{content:"No custom activities found"};const t=a.custom_activity.map((e=>({id:e.id,name:e.name,color:e.color,icon_id:e.icon_id,type:e.type})));return{content:`Found ${t.length} custom activities: ${JSON.stringify(t,null,2)}`}}},class extends fg{constructor(){super(...arguments),this.name="create_workflow_instructions",this.type=Zi.READ,this.annotations=hg({title:"Create Workflow Instructions"})}getDescription(){return'When the user asks to create a workflow or automation, you must use this tool, which provides instructions on how to create a workflow.\n This tool is very important and should be used when the user explicitly requests:\n - Workflow creation (e.g., "create a monday workflow", "create a new workflow").\n - Automation (e.g., "automate this process", "when item is created, set status to done")\n '}getInputSchema(){return{}}async executeInternal(){return{content:'\n# Instructions to Create a Live Workflow\n\n## General Explanation:\n- A workflow is a structured sequence of actions and conditions and triggers (blocks) designed to automate processes (for example, trigger -> action -> action -> ...).\n- A block is a reusable logic unit; it can be a trigger, condition or action. It has input fields and output fields.\n- A workflow block wraps a block (the underlying logic unit), providing the configuration for its input fields and defining how it connects to other blocks in the workflow graph.\n- A workflow variable presents a value that is used in the workflow block. It has a unique key, a value, and dependencies.\nIt can be a result of a previous block, a user config, a reference, or a host metadata.\nIf it is a user config, you have to get the possible values for the value from remote options query.\n\nTo create a live workflow in monday.com, follow these steps:\n\n## Step 0: Determine and Ensure Host Exists (CRITICAL FIRST STEP)\n\n**Every workflow MUST be attached to an existing host entity.** Before creating any workflow, you must:\n\n### 0.1 Identify the Host Type Based on User Request\n\n**IMPORTANT: The host type depends on what the user is asking for:**\n\n- **If user wants "monday workflows"** (e.g., "create a monday workflow") ALWAYS USE THIS HOST TYPE:\n - Host type: **APP_FEATURE_OBJECT** \n - This is the standalone Workflows product\n - User explicitly mentions "monday workflow" or "workflow" without board context\n \n- **If user wants "automation"** (e.g., "automate when item is created", "set status automatically"):\n - Host type: **BOARD**\n - The automation will run on a specific board\n - User typically mentions board-related triggers/actions and the workflow is pretty simple\n\n### 0.2 Check if Host Exists\n**Always check first before creating:**\n\n**For BOARD hosts (automations):**\n```\nquery {\n boards(ids: [BOARD_ID]) {\n id\n name\n }\n}\n```\nIf user didn\'t specify a board, you may need to ask which board or list available boards.\n\n**For APP_FEATURE_OBJECT hosts (monday workflows):**\nCheck if a workflows object exists for the user/workspace. The exact query depends on the API structure for workflows objects.\n\n### 0.3 Create Host if Missing\n**Only if the host doesn\'t exist, create it first:**\n\n**For BOARD hosts:**\n```\nmutation {\n create_board(\n board_name: "Board Name",\n board_kind: public\n ) {\n id\n }\n}\n```\n\n**For APP_FEATURE_OBJECT hosts:**\n```\nmutation {\n create_workflows_object(\n name: "Workflow Name"\n ) {\n id\n }\n}\n```\n\n### 0.4 Prepare workflowHostData\nOnce you have confirmed the host exists (or created it), prepare the `workflowHostData` object:\n\n**For automations (board host):**\n```\nworkflowHostData: {\n id: "BOARD_ID_HERE",\n type: BOARD\n}\n```\n\n**For monday workflows (app feature host):**\n```\nworkflowHostData: {\n id: "WORKFLOWS_OBJECT_ID_HERE",\n type: APP_FEATURE_OBJECT\n}\n```\n\n**⚠️ IMPORTANT: Do not proceed to the next steps until the host is confirmed to exist and you have its ID.**\n\n## Step 1: Fetch Available Blocks\n\nFetch the blocks including the input fields config using monday api:\nEach block represents a trigger, condition or action. Blocks can have input fields and output fields.\nIn general, you can understand what a block does by its description or name.\nThe "kind" field in the block represents the type of the block (trigger, condition or action).\nThere are some types of input fields: In the case of CustomInputField, it refers to a field type feature. \nIt has special functionality — for example, remote options. These are all the possible values for this type. \nFor example, if the field type is \'board\', then the options will include a list of all boardIds \nTheir identifier is the \'fieldTypeReferenceId\' (or \'id\' in the fieldTypeData).\nThere are dependencies that tell us what values we need to know to fetch the options for the custom input field\'s value.\nFor example, if the custom input field is a status column, the dependency is the board ID.\n\n**Example query to fetch the blocks:**\n```\nquery {\n blocks {\n blocks {\n id\n description\n name\n kind\n inputFieldsConfig {\n fieldTitle\n fieldKey\n ... on CustomInputFieldConfig {\n fieldTypeReferenceId\n fieldTypeUniqueKey\n fieldTypeData {\n id\n dependencyConfig{\n optionalFields{\n sourceFieldTypeReferenceId\n sourceFieldTypeUniqueKey\n targetFieldKey\n }\n orderedMandatoryFields{\n sourceFieldTypeReferenceId\n sourceFieldTypeUniqueKey\n targetFieldKey\n }\n }\n }\n }\n ... on PrimitiveInputFieldConfig {\n primitiveType\n }\n }\n }\n }\n}\n```\n\n## Step 2: Choose Blocks\n\nChoose the trigger block and action blocks that you want to use based on the user\'s automation requirements.\n\n## Step 3: Build Workflow Schema\n\nGet the input schema of the \'create_live_workflow\' mutation.\nPay attention that sometimes you need to run queries to fetch some schemas. Read the description of each field in the schema and follow the instructions if there are any.\n\n## Step 4: Build Workflow Block Schemas\n\nFor each block you choose to use, build the workflow block schema (start from the trigger block):\n- **4.a.** For each input field, build the workflow variable schema and use it in the workflow block.\n- **4.b.** For each output field, build the workflow variable schema and use it in the workflow block.\n\n## Step 5: Retrieve allowed constant values for input fields (remote_options)\n\nSometimes you need to configure an input field with a fixed (constant) value.\n\n1. Examine the block\'s inputFieldsConfig.\n • If the field type is PrimitiveInputFieldConfig – you can pass any literal that matches its primitiveType.\n • If the field type is CustomInputFieldConfig – its allowed values are dynamic. You **MUST** fetch them using the remote_options query.\n\n2. Build the remote_options query for every CustomInputFieldConfig you want to set as a constant:\n • Provide the field_type_unique_key of the field.\n • Fill the dependencies_values object with **all mandatory dependencies** listed in fieldTypeData.dependencyConfig.orderedMandatoryFields. You can supply each dependency as a literal value (value) or as a reference to an existing workflow variable (workflowVariableKey).\n\n3. Select the desired option from the query response (options.value / options.title) and store it in a USER_CONFIG workflow variable that will be referenced by the input field.\n\n**Example:**\n```graphql\nquery remote_options {\n remote_options(\n input: {\n field_type_unique_key: \'monday:status_column\'\n dependencies_values: {\n boardId: { value: 118607562 }\n }\n }\n ) {\n options {\n value\n title\n }\n }\n}\n```\n\n## ⚠️ Common Pitfalls\n\n### Pitfall #1: Skipping remote_options for Custom Fields\n- **Problem:** Using hardcoded values for groups, status columns, people columns\n- **Impact:** Workflow fails silently or uses wrong entities\n- **Solution:** Always call `remote_options` for CustomInputField types\n\n### Pitfall #2: Missing Dependency Values \n- **Problem:** Not providing all required `dependencyConfigValues`\n- **Impact:** API returns empty options or errors\n- **Solution:** Check `dependencyConfig.orderedMandatoryFields` and supply all\n\n### Pitfall #3: Wrong Host Type\n- **Problem:** Using BOARD host for "monday workflows" or APP_FEATURE_OBJECT for "automations"\n- **Impact:** Workflow created in wrong context\n- **Solution:** Follow Step 0.1 decision tree strictly\n\n### Pitfall #4: Hardcoded Field Type IDs\n**Common field types that REQUIRE remote_options:**\n- `10380085` → Groups (depends on boardId)\n- `10380084` → Status columns (depends on boardId) \n- `10380073` → People columns (depends on boardId)\n- `10380094` → Status values (depends on boardId + statusColumnId)\n\n**Never hardcode values for these field types!**\n\n### Pitfall #5: Missing appFeatureReferenceId in Workflow Variables\n- **Problem:** When a workflow variable references an app feature (e.g. a custom inbound field), forgetting to include `appFeatureReferenceId`\n- **Impact:** Can cause issues serializing the workflow variable\n- **Solution:** Always populate `appFeatureReferenceId` when the variable references an app feature, even if it has a primitiveType\n\n## Step 6: Fetch Complete Workflow Variable Schemas\n\nFetch the complete workflow variables schemas with the query \'get_workflow_variable_schemas\'. In general, there are 4 types of workflow variables:\nEach workflow variable has a workflowVariableKey (unique) that is used to identify the variable in the workflow block and a sourceKind (NODE_RESULT, USER_CONFIG, REFERENCE, HOST_METADATA).\n\n**Critical:** When the variable is of **USER_CONFIG** kind and its value was selected via the **remote_options** query (see Step 5), the **exact same dependency key-value pairs** you passed to remote_options **must be placed in** `sourceMetadata.configurationMetadata.dependencyConfigValues`. This guarantees the workflow engine can resolve the value at runtime.\n\n- **6.a. Node result:** A variable that has a value fetched from output fields of the previous block.\n **Example:**\n```\n{\n workflowVariableKey: 2,\n sourceKind: "node_results",\n appFeatureReferenceId: <item_field_type_appFeatureReferenceId>,\n sourceMetadata: {\n workflowNodeId: 1,\n outboundFieldKey: "itemId"\n }\n}\n```\n\n- **6.b. User config:** A variable that has a value fetched from the user config (if the user config is a remote option, you need to use the remote options query).\n **Very important:** You need to make sure that all the dependencies of the field type (dependencyConfigValues) are filled in the sourceMetadata (see the schema).\n **Example:**\n```\n{\n workflowVariableKey: 4,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n statusColumnId:{workflowVariableKey: 3},\n itemId:{workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "number",\n config: {\n value: 1,\n title: "Done"\n }\n }\n```\n\n- **6.c. Reference:** A variable that has a value fetched from a reference (if the reference is a remote option, you need to use the remote options query).\n\n- **6.d. Host metadata:** A variable that has a value fetched from the host metadata. For example: board ID when the host is a board.\n **Example:**\n```\n{\n workflowVariableKey: 1,\n sourceKind: "host_metadata",\n sourceMetadata: {\n hostMetadataKey: "hostInstanceId"\n }\n}\n```\n\n### 6.5: Validation Checklist for Workflow Variables\n\n**MANDATORY: Before proceeding to Step 7, validate each workflow variable:**\n\nFor every **user_config** workflow variable:\n- [ ] Does `fieldTypeReferenceId` exist?\n- [ ] If yes → Is this a CustomInputField with `dependencyConfig`?\n- [ ] If yes → Did you call `remote_options` query with ALL required dependencies?\n- [ ] Did you use an actual `value` from the `remote_options` response (not a hardcoded string)?\n- [ ] Are all `dependencyConfigValues` properly referenced by `workflowVariableKey`?\n\n## Step 7: Create the Live Workflow\n\nCreate the live workflow with the query \'create_live_workflow\', using the workflow variables and workflow blocks in the input.\n\n**Example for board automation:**\n```\nmutation {\n create_live_workflow(\n \n workflow: {\n title: "Auto set Status to Done on item creation",\n description: "When an item is created, automatically set its Status to Done.",\n\n workflowBlocks: [\n {\n workflowNodeId: 1,\n blockReferenceId: 10380130,\n title: "When item created",\n inputFields: [\n {\n fieldKey: "boardId",\n workflowVariableKey: 1\n }\n ],\n nextWorkflowBlocksConfig: {\n type: "directMapping",\n mapping: {\n nextWorkflowNode: {\n workflowNodeId: 2\n }\n }\n }\n },\n {\n workflowNodeId: 2,\n blockReferenceId: 10380126,\n title: "Change status",\n inputFields: [\n {\n fieldKey: "boardId",\n workflowVariableKey: 1\n },\n {\n fieldKey: "itemId",\n workflowVariableKey: 2\n },\n {\n fieldKey: "statusColumnId",\n workflowVariableKey: 3\n },\n {\n fieldKey: "statusColumnValue",\n workflowVariableKey: 4\n }\n ]\n }\n ],\n\n workflowVariables: [\n {\n workflowVariableKey: 1,\n sourceKind: "host_metadata",\n sourceMetadata: {\n hostMetadataKey: "hostInstanceId"\n }\n },\n {\n workflowVariableKey: 2,\n sourceKind: "node_results",\n appFeatureReferenceId: <item_field_type_appFeatureReferenceId>,\n sourceMetadata: {\n workflowNodeId: 1,\n outboundFieldKey: "itemId"\n }\n },\n {\n workflowVariableKey: 3,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n itemId: {workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "string",\n config: {\n value: "status",\n title: "Status"\n }\n },\n {\n workflowVariableKey: 4,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n statusColumnId:{workflowVariableKey: 3},\n itemId:{workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "number",\n config: {\n value: 1,\n title: "Done"\n }\n }\n ],\n\n workflowHostData: {\n id: "118607562",\n type: BOARD\n }\n }\n\n ) {\n id\n }\n}\n```\n\n## Summary Checklist:\n1. ✅ Determine if user wants automation (BOARD host) or monday workflows (APP_FEATURE_OBJECT host)\n2. ✅ Check if the appropriate host exists \n3. ✅ Create host if missing\n4. ✅ Prepare workflowHostData with correct host type and ID\n5. ✅ Fetch available blocks\n6. ✅ Choose appropriate blocks\n7. ✅ Build workflow schema\n8. ✅ Configure workflow variables\n9. ✅ Create the live workflow\n\n## Quick Reference:\n- **"Automate X"** → BOARD host\n- **"Create monday workflow"** → APP_FEATURE_OBJECT host\n'.trim()}}},class extends fg{constructor(){super(...arguments),this.name="read_docs",this.type=Zi.READ,this.annotations=hg({title:"Read Documents",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get a collection of monday.com documents with their content as markdown. \n\nPAGINATION: \n- Default limit is 25 documents per page\n- Use 'page' parameter to get additional pages (starts at 1)\n- Check response for 'has_more_pages' to know if you should continue paginating\n- If user asks for \"all documents\" and you get exactly 25 results, continue with page 2, 3, etc.\n\nFILTERING: Provide an ID filter object with:\n- type: 'ids' for specific document IDs\n- type: 'object_ids' for specific document object IDs \n- type: 'workspace_ids' for all docs in specific workspaces\n- values: array of ID strings (at least 1 required)\n\nExamples:\n- { type: 'ids', values: ['123', '456'] }\n- { type: 'object_ids', values: ['123'] }\n- { type: 'workspace_ids', values: ['ws_101'] }\n\nUSAGE PATTERNS:\n- For specific documents: use type 'ids' or 'object_ids' (A monday doc has two unique identifiers)\n- For workspace exploration: use type 'workspace_ids' with pagination\n- For large searches: start with page 1, then paginate if has_more_pages=true"}getInputSchema(){return NT}async executeInternal(e){try{const a=e.ids;let t,i,n;switch(a.type){case"ids":t=a.values;break;case"object_ids":i=a.values;break;case"workspace_ids":n=a.values}const r={ids:t,object_ids:i,limit:e.limit||25,order_by:e.order_by,page:e.page,workspace_ids:n};let o=await this.mondayApi.request(Z_,r);if((!o.docs||0===o.docs.length)&&t){const a={ids:void 0,object_ids:t,limit:e.limit||25,order_by:e.order_by,page:e.page,workspace_ids:n};o=await this.mondayApi.request(Z_,a)}if(!o.docs||0===o.docs.length){return{content:`No documents found matching the specified criteria${e.page?` (page ${e.page})`:""}.`}}const s=await this.enrichDocsWithMarkdown(o.docs,r),p=this.shouldSuggestPagination(o.docs.length,r.limit||25,r.page||1);return{content:s.content+p}}catch(e){return{content:`Error reading documents: ${e instanceof Error?e.message:"Unknown error occurred"}`}}}shouldSuggestPagination(e,a,t){return e===a?`\n\n🔄 PAGINATION SUGGESTION: You received exactly ${a} documents, which suggests there may be more. Consider calling this tool again with page: ${t+1} to get additional documents.`:""}async enrichDocsWithMarkdown(e,a){const t=await Promise.all(e.filter((e=>null!==e)).map((async e=>{let a="";try{const t={docId:e.id},i=await this.mondayApi.request(eT,t);a=i.export_markdown_from_doc.success&&i.export_markdown_from_doc.markdown?i.export_markdown_from_doc.markdown:`Error getting markdown: ${i.export_markdown_from_doc.error||"Unknown error"}`}catch(e){a=`Error getting markdown: ${e instanceof Error?e.message:"Unknown error"}`}return{id:e.id,object_id:e.object_id,name:e.name,doc_kind:e.doc_kind,created_at:e.created_at,created_by:e.created_by?.name||"Unknown",url:e.url,relative_url:e.relative_url,workspace:e.workspace?.name||"Unknown",workspace_id:e.workspace_id,doc_folder_id:e.doc_folder_id,settings:e.settings,blocks_as_markdown:a}}))),i=a.page||1,n=a.limit||25,r=t.length,o=r===n;return{content:`Successfully retrieved ${t.length} document${1===t.length?"":"s"}.\n\nPAGINATION INFO:\n- Current page: ${i}\n- Documents per page: ${n}\n- Documents in this response: ${r}\n- Has more pages: ${o?"YES - call again with page: "+(i+1):"NO"}\n\nDOCUMENTS:\n${JSON.stringify(t,null,2)}`}}}];var AT;!function(e){e.API="api",e.APPS="apps"}(AT||(AT={}));const RT=(e,a)=>{let t=[];a?.mode===AT.APPS?t=[...en]:a?.mode!==AT.API&&a?.mode||(t=[...OT]);const i=t.map((a=>((e,a)=>e.prototype instanceof fg?new e(a.apiClient,a.apiToken):new e)(a,e)));return i.filter((e=>{if(!a)return e.type!==Zi.ALL_API;if(a.mode===AT.API&&"only"===a.enableDynamicApiTools)return e.type===Zi.ALL_API;let t=!1;return a.mode===AT.API&&!1===a.enableDynamicApiTools&&(t=t||e.type===Zi.ALL_API),a.readOnlyMode&&(t=t||e.type!==Zi.READ),a.include?t=t||!a.include?.includes(e.name):a.exclude&&(t=t||a.exclude?.includes(e.name)),!t}))};class kT{constructor(){this.dynamicTools=new Map}registerTool(e,a){const t=e.enabledByDefault??!0,i=t;this.dynamicTools.set(e.name,{instance:e,mcpTool:a,enabled:i,enabledByDefault:t}),t||a.disable()}enableTool(e){const a=this.dynamicTools.get(e);return!!a&&(a.enabled||(a.mcpTool.enable(),a.enabled=!0),!0)}disableTool(e){const a=this.dynamicTools.get(e);return!!a&&(a.enabled&&(a.mcpTool.disable(),a.enabled=!1),!0)}isToolEnabled(e){const a=this.dynamicTools.get(e);return!!a&&a.enabled}isToolEnabledByDefault(e){const a=this.dynamicTools.get(e);return!a||a.enabledByDefault}getToolsStatus(){const e={};return this.dynamicTools.forEach(((a,t)=>{e[t]=a.enabled})),e}getDynamicToolNames(){return Array.from(this.dynamicTools.keys())}getDetailedToolsStatus(){const e={};return this.dynamicTools.forEach(((a,t)=>{e[t]={enabled:a.enabled,enabledByDefault:a.enabledByDefault}})),e}resetToolToDefault(e){const a=this.dynamicTools.get(e);return!!a&&(a.enabledByDefault&&!a.enabled?(a.mcpTool.enable(),a.enabled=!0,!0):!(!a.enabledByDefault&&a.enabled)||(a.mcpTool.disable(),a.enabled=!1,!0))}getAllDynamicTools(){return this.dynamicTools}clear(){this.dynamicTools.clear()}}exports.DynamicToolManager=kT,exports.MondayAgentToolkit=class extends Ki{constructor(e){super({name:"monday.com",version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),this.dynamicToolManager=new kT,this.mondayApiClient=this.createApiClient(e),this.mondayApiToken=e.mondayApiToken,this.registerTools(e)}createApiClient(e){return new t.ApiClient({token:e.mondayApiToken,apiVersion:e.mondayApiVersion,requestConfig:{...e.mondayApiRequestConfig,headers:{...e.mondayApiRequestConfig?.headers||{},"user-agent":"monday-api-mcp"}}})}registerTools(e){try{this.initializeTools(e).forEach((e=>this.registerSingleTool(e))),!0===e.toolsConfiguration?.enableToolManager&&this.registerManagementTool()}catch(e){throw new Error(`Failed to initialize Monday Agent Toolkit: ${e instanceof Error?e.message:String(e)}`)}}registerManagementTool(){const e=new DT;e.setToolkitManager(this.dynamicToolManager),this.registerSingleTool(e)}initializeTools(e){const a={apiClient:this.mondayApiClient,apiToken:this.mondayApiToken};return RT(a,e.toolsConfiguration)}registerSingleTool(a){const t=a.getInputSchema(),i=this.registerTool(a.name,{title:a.annotations?.title,description:a.getDescription(),inputSchema:t,annotations:a.annotations},(async(i,n)=>{try{let n;if(t){const r=e.z.object(t).safeParse(i);if(!r.success)throw new Error(`Invalid arguments: ${r.error.message}`);n=await a.execute(r.data)}else n=await a.execute();return this.formatToolResult(n.content)}catch(e){return this.handleToolError(e,a.name)}}));this.dynamicToolManager.registerTool(a,i)}enableTool(e){return this.dynamicToolManager.enableTool(e)}disableTool(e){return this.dynamicToolManager.disableTool(e)}isToolEnabled(e){return this.dynamicToolManager.isToolEnabled(e)}getToolsStatus(){return this.dynamicToolManager.getToolsStatus()}getDynamicToolNames(){return this.dynamicToolManager.getDynamicToolNames()}getServer(){return this}formatToolResult(e){return{content:[{type:"text",text:e}]}}handleToolError(e,a){return{content:[{type:"text",text:`Failed to execute tool ${a}: ${e instanceof Error?e.message:String(e)}`}]}}};
404
449
  //# sourceMappingURL=index.js.map