@mondaydotcomorg/agent-toolkit 5.78.4 → 5.78.5

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.
@@ -1113,8 +1113,14 @@
1113
1113
  }
1114
1114
  }
1115
1115
  `,Kh=["#037f4c","#00c875","#9cd326","#cab641","#ffcb00","#784bd1","#9d50dd","#007eb5","#579bfc","#66ccff","#bb3354","#df2f4a","#ff007f","#ff5ac4","#ff642e","#fdab3d","#7f5347","#c4c4c4","#757575"],Jh={boardId:a.z.string().describe("The ID of the board to create the group in"),groupName:a.z.string().max(255).describe("The name of the new group (maximum 255 characters)"),groupColor:a.z.enum(Kh).optional().describe(`The color for the group. Must be one of the predefined Monday.com group colors: ${Kh.join(", ")}`),relativeTo:a.z.string().optional().describe("The ID of the group to position this new group relative to"),positionRelativeMethod:a.z.nativeEnum(ud).optional().describe("Whether to position the new group before or after the relativeTo group")};const Xh=Dc`
1116
- mutation duplicateItem($boardId: ID!, $itemId: ID!, $withUpdates: Boolean) {
1117
- duplicate_item(board_id: $boardId, item_id: $itemId, with_updates: $withUpdates) {
1116
+ mutation duplicateItem($boardId: ID!, $itemId: ID!, $itemName: String, $groupId: ID, $withUpdates: Boolean) {
1117
+ duplicate_item(
1118
+ board_id: $boardId
1119
+ item_id: $itemId
1120
+ item_name: $itemName
1121
+ group_id: $groupId
1122
+ with_updates: $withUpdates
1123
+ ) {
1118
1124
  id
1119
1125
  name
1120
1126
  url
@@ -1141,7 +1147,7 @@
1141
1147
  }
1142
1148
  }
1143
1149
  }
1144
- `,ef={name:a.z.string().min(1,"Item name cannot be empty").max(255,"Item name must be 255 characters or fewer").describe("The name of the new item to be created, must be relevant to the user's request. 1–255 characters."),groupId:a.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:a.z.string().describe(_m),createLabelsIfMissing:a.z.boolean().optional().describe("When true, missing status/dropdown labels referenced in columnValues will be auto-created on the board instead of erroring with ColumnValueException. Requires permission to change board structure. Use when the caller specifies label names that may not yet exist on the board."),parentItemId:a.z.number().optional().describe("The id of the parent item under which the new subitem will be created"),duplicateFromItemId:a.z.number().optional().describe("The id of existing item to duplicate and update with new values (only provide when duplicating)")},tf={boardId:a.z.number().describe("The id of the board to which the new item will be added"),...ef};class af extends me{constructor(){super(...arguments),this.name="create_item",this.type=exports.ToolType.WRITE,this.annotations=ce({title:"Create Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a single item or subitem on a monday.com board, or duplicate an existing item. [IMPORTANT] If you need to create multiple items in one call, use create_items instead of calling this tool in a loop. Otherwise: create a new item with provided values, create a subitem under a parent item, or duplicate an existing item and update it with new values. Use parentItemId when creating a subitem under an existing item. Use duplicateFromItemId when copying an existing item with modifications. [REQUIRED PRECONDITION]: Before using this tool, if new columns were added to the board or if you are not familiar with the board's structure (column IDs, column types, status labels, etc.), first use get_board_info with filters.columns.only to get column metadata without fetching views. This is essential for constructing proper column values and knowing which columns are available."}getInputSchema(){return this.context?.boardId?ef:tf}async executeInternal(e){const t={...e,columnValues:bm(e.columnValues)},a=this.context?.boardId??t.boardId;if(t.duplicateFromItemId&&t.parentItemId)throw new am("Cannot specify both parentItemId and duplicateFromItemId. Please provide only one of these parameters.","INVALID_ARGUMENTS_COMBINATION");return t.duplicateFromItemId?await this.duplicateAndUpdateItem(t,a):t.parentItemId?await this.createSubitem(t):await this.createNewItem(t,a)}async duplicateAndUpdateItem(e,t){try{const a={boardId:t.toString(),itemId:e.duplicateFromItemId.toString()},i=await this.mondayApi.request(Xh,a);if(!i.duplicate_item?.id)throw new am("Failed to duplicate item: no item duplicated","EMPTY_API_RESPONSE");let n;try{n=JSON.parse(e.columnValues)}catch(e){throw new am("Invalid columnValues JSON: expected a JSON object keyed by column id","INVALID_COLUMN_VALUES_JSON")}const o={...n,name:e.name},r=new wm(this.mondayApi,{boardId:t});return await r.execute({itemId:parseInt(i.duplicate_item.id),columnValues:JSON.stringify(o),createLabelsIfMissing:e.createLabelsIfMissing}),{content:{message:`Item ${i.duplicate_item.id} duplicated from ${e.duplicateFromItemId}`,item_id:i.duplicate_item.id,item_name:i.duplicate_item.name,item_url:i.duplicate_item.url,board_id:t}}}catch(e){im(e,"duplicate item")}}async createSubitem(e){const t={parentItemId:e.parentItemId.toString(),itemName:e.name,columnValues:e.columnValues,createLabelsIfMissing:e.createLabelsIfMissing};try{const a=await this.mondayApi.request(Zh,t);if(!a.create_subitem?.id)throw new am("Failed to create subitem: no subitem created","EMPTY_API_RESPONSE");return{content:{message:`Subitem ${a.create_subitem.id} created under ${e.parentItemId}`,item_id:a.create_subitem.id,item_name:a.create_subitem.name,item_url:a.create_subitem.url}}}catch(e){im(e,"create subitem")}}async createNewItem(e,t){try{const a={boardId:t.toString(),itemName:e.name,groupId:e.groupId,columnValues:e.columnValues,createLabelsIfMissing:e.createLabelsIfMissing},i=await this.mondayApi.request(xc,a);return{content:{message:`Item ${i.create_item?.id} successfully created`,item_id:i.create_item?.id,item_name:i.create_item?.name,item_url:i.create_item?.url,board_id:t}}}catch(e){im(e,"create item")}}}const nf={items:a.z.array(a.z.object({name:a.z.string().min(1,"Item name cannot be empty").max(255,"Item name must be 255 characters or fewer").optional().describe("Required. The name of the item to be created. 1-255 characters."),columnValues:a.z.string().default("{}").describe(`Column values for this item, keyed by column id. Defaults to "{}" (no column values). ${_m}`),groupId:a.z.string().optional().describe("The id of the group to add this item to. Ignored when parentItemId is set (subitems inherit their parent group). If neither is set, the board default group is used."),parentItemId:a.z.number().optional().describe("If provided, this item is created as a subitem of this parent (uses create_subitem mutation) and groupId is ignored. Mutually exclusive with duplicateFromItemId."),duplicateFromItemId:a.z.number().optional().describe("The id of an existing item to duplicate and then patch with this item name and columnValues. Use for bulk templating (e.g., duplicate a template item N times with different overrides). Mutually exclusive with parentItemId."),createLabelsIfMissing:a.z.boolean().optional().describe("When true, missing status/dropdown labels referenced in this item's columnValues will be auto-created on the board instead of erroring with ColumnValueException. Requires permission to change board structure.")})).min(1,"items must not be empty").max(20,"items must not exceed 20 per call").describe("The items to create, up to 20 per call. Each item returns its own item_id and item_url on success, or a raw error message on failure. Each item independently chooses its groupId, parentItemId, and createLabelsIfMissing.")},of={boardId:a.z.number().describe("The id of the board to which the new items will be added"),...nf};function rf(e){return e?.response?.errors?.[0]}function sf(e,t){const a=e instanceof Error?e.message:String(e);return void 0!==t&&function(e,t){const a=rf(e),i=`failed to acquire lock on '${t}|subitems__`;return"ColumnValueException"===a?.extensions?.code&&!0===a.message?.toLowerCase().startsWith(i.toLowerCase())}(e,t)?`${a}\nAn item-link update hit a temporary concurrency limit. Wait a few seconds, then retry only the failed items in one create_items call.`:a}function df(e,t){const a=rf(e),i=e instanceof Error?e.message:String(e);return{...e instanceof am?{code:e.code}:{},...a?.extensions??{},message:a?.message??i,path:["results",t]}}const pf={item_id:a.z.number().describe("The ID of the item to create the new timeline item on"),custom_activity_id:a.z.string().describe("The ID of the custom activity for the timeline item"),title:a.z.string().describe("The title of the new timeline item"),summary:a.z.string().optional().describe("The summary of the new timeline item (max 255 characters)"),content:a.z.string().optional().describe("The content of the new timeline item"),timestamp:a.z.string().describe("The creation time of the new timeline item in ISO8601 format (e.g., 2024-06-06T18:00:30Z)"),start_timestamp:a.z.string().optional().describe("The start time of the timeline item in ISO8601 format"),end_timestamp:a.z.string().optional().describe("The end time of the timeline item in ISO8601 format"),location:a.z.string().optional().describe("The location to add to the new timeline item"),phone:a.z.string().optional().describe("The phone number to add to the new timeline item"),url:a.z.string().optional().describe("The URL to add to the new timeline item")};const lf=Dc`
1150
+ `,ef={name:a.z.string().min(1,"Item name cannot be empty").max(255,"Item name must be 255 characters or fewer").describe("The name of the new item to be created, must be relevant to the user's request. 1–255 characters."),groupId:a.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. Not supported when duplicateFromItemId is a subitem."),columnValues:a.z.string().describe(_m),createLabelsIfMissing:a.z.boolean().optional().describe("When true, missing status/dropdown labels referenced in columnValues will be auto-created on the board instead of erroring with ColumnValueException. Requires permission to change board structure. Use when the caller specifies label names that may not yet exist on the board."),parentItemId:a.z.number().optional().describe("The id of the parent item under which the new subitem will be created"),duplicateFromItemId:a.z.number().optional().describe("The id of existing item to duplicate and update with new values (only provide when duplicating)")},tf={boardId:a.z.number().describe("The id of the board to which the new item will be added"),...ef};class af extends me{constructor(){super(...arguments),this.name="create_item",this.type=exports.ToolType.WRITE,this.annotations=ce({title:"Create Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a single item or subitem on a monday.com board, or duplicate an existing item. [IMPORTANT] If you need to create multiple items in one call, use create_items instead of calling this tool in a loop. Otherwise: create a new item with provided values, create a subitem under a parent item, or duplicate an existing item and update it with new values. Use parentItemId when creating a subitem under an existing item. Use duplicateFromItemId when copying an existing item with modifications. [REQUIRED PRECONDITION]: Before using this tool, if new columns were added to the board or if you are not familiar with the board's structure (column IDs, column types, status labels, etc.), first use get_board_info with filters.columns.only to get column metadata without fetching views. This is essential for constructing proper column values and knowing which columns are available."}getInputSchema(){return this.context?.boardId?ef:tf}async executeInternal(e){const t={...e,columnValues:bm(e.columnValues)},a=this.context?.boardId??t.boardId;if(t.duplicateFromItemId&&t.parentItemId)throw new am("Cannot specify both parentItemId and duplicateFromItemId. Please provide only one of these parameters.","INVALID_ARGUMENTS_COMBINATION");return t.duplicateFromItemId?await this.duplicateAndUpdateItem(t,a):t.parentItemId?await this.createSubitem(t):await this.createNewItem(t,a)}async duplicateAndUpdateItem(e,t){try{let a;try{a=JSON.parse(e.columnValues)}catch(e){throw new am("Invalid columnValues JSON: expected a JSON object keyed by column id","INVALID_COLUMN_VALUES_JSON")}if(null===a||"object"!=typeof a||Array.isArray(a))throw new am("Invalid columnValues JSON: expected a JSON object keyed by column id","INVALID_COLUMN_VALUES_JSON");const i={...a};delete i.name;const n={boardId:t.toString(),itemId:e.duplicateFromItemId.toString(),itemName:e.name,...e.groupId?{groupId:e.groupId}:{}},o=await this.mondayApi.request(Xh,n,{versionOverride:"2027-04"});if(!o.duplicate_item?.id)throw new am("Failed to duplicate item: no item duplicated","EMPTY_API_RESPONSE");const r=o.duplicate_item.name,s=r===`${e.name} (copy)`;if(s&&(i.name=e.name),Object.keys(i).length>0){const a=new wm(this.mondayApi,{boardId:t});await a.execute({itemId:parseInt(o.duplicate_item.id),columnValues:JSON.stringify(i),createLabelsIfMissing:e.createLabelsIfMissing})}return{content:{message:`Item ${o.duplicate_item.id} duplicated from ${e.duplicateFromItemId}`,item_id:o.duplicate_item.id,item_name:s?e.name:r,item_url:o.duplicate_item.url,board_id:t}}}catch(e){im(e,"duplicate item")}}async createSubitem(e){const t={parentItemId:e.parentItemId.toString(),itemName:e.name,columnValues:e.columnValues,createLabelsIfMissing:e.createLabelsIfMissing};try{const a=await this.mondayApi.request(Zh,t);if(!a.create_subitem?.id)throw new am("Failed to create subitem: no subitem created","EMPTY_API_RESPONSE");return{content:{message:`Subitem ${a.create_subitem.id} created under ${e.parentItemId}`,item_id:a.create_subitem.id,item_name:a.create_subitem.name,item_url:a.create_subitem.url}}}catch(e){im(e,"create subitem")}}async createNewItem(e,t){try{const a={boardId:t.toString(),itemName:e.name,groupId:e.groupId,columnValues:e.columnValues,createLabelsIfMissing:e.createLabelsIfMissing},i=await this.mondayApi.request(xc,a);return{content:{message:`Item ${i.create_item?.id} successfully created`,item_id:i.create_item?.id,item_name:i.create_item?.name,item_url:i.create_item?.url,board_id:t}}}catch(e){im(e,"create item")}}}const nf={items:a.z.array(a.z.object({name:a.z.string().min(1,"Item name cannot be empty").max(255,"Item name must be 255 characters or fewer").optional().describe("Required. The name of the item to be created. 1-255 characters."),columnValues:a.z.string().default("{}").describe(`Column values for this item, keyed by column id. Defaults to "{}" (no column values). ${_m}`),groupId:a.z.string().optional().describe("The id of the group to add this item to. Ignored when parentItemId is set (subitems inherit their parent group). Not supported when duplicateFromItemId is a subitem. If neither is set, the board default group is used."),parentItemId:a.z.number().optional().describe("If provided, this item is created as a subitem of this parent (uses create_subitem mutation) and groupId is ignored. Mutually exclusive with duplicateFromItemId."),duplicateFromItemId:a.z.number().optional().describe("The id of an existing item to duplicate and then patch with this item name and columnValues. Use for bulk templating (e.g., duplicate a template item N times with different overrides). Mutually exclusive with parentItemId."),createLabelsIfMissing:a.z.boolean().optional().describe("When true, missing status/dropdown labels referenced in this item's columnValues will be auto-created on the board instead of erroring with ColumnValueException. Requires permission to change board structure.")})).min(1,"items must not be empty").max(20,"items must not exceed 20 per call").describe("The items to create, up to 20 per call. Each item returns its own item_id and item_url on success, or a raw error message on failure. Each item independently chooses its groupId, parentItemId, and createLabelsIfMissing.")},of={boardId:a.z.number().describe("The id of the board to which the new items will be added"),...nf};function rf(e){return e?.response?.errors?.[0]}function sf(e,t){const a=e instanceof Error?e.message:String(e);return void 0!==t&&function(e,t){const a=rf(e),i=`failed to acquire lock on '${t}|subitems__`;return"ColumnValueException"===a?.extensions?.code&&!0===a.message?.toLowerCase().startsWith(i.toLowerCase())}(e,t)?`${a}\nAn item-link update hit a temporary concurrency limit. Wait a few seconds, then retry only the failed items in one create_items call.`:a}function df(e,t){const a=rf(e),i=e instanceof Error?e.message:String(e);return{...e instanceof am?{code:e.code}:{},...a?.extensions??{},message:a?.message??i,path:["results",t]}}const pf={item_id:a.z.number().describe("The ID of the item to create the new timeline item on"),custom_activity_id:a.z.string().describe("The ID of the custom activity for the timeline item"),title:a.z.string().describe("The title of the new timeline item"),summary:a.z.string().optional().describe("The summary of the new timeline item (max 255 characters)"),content:a.z.string().optional().describe("The content of the new timeline item"),timestamp:a.z.string().describe("The creation time of the new timeline item in ISO8601 format (e.g., 2024-06-06T18:00:30Z)"),start_timestamp:a.z.string().optional().describe("The start time of the timeline item in ISO8601 format"),end_timestamp:a.z.string().optional().describe("The end time of the timeline item in ISO8601 format"),location:a.z.string().optional().describe("The location to add to the new timeline item"),phone:a.z.string().optional().describe("The phone number to add to the new timeline item"),url:a.z.string().optional().describe("The URL to add to the new timeline item")};const lf=Dc`
1145
1151
  mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention], $parentId: ID) {
1146
1152
  create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList, parent_id: $parentId) {
1147
1153
  id