@mondaydotcomorg/agent-toolkit 5.6.0 → 5.7.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.
- package/CHANGELOG.md +9 -0
- package/dist/cjs/core/index.js +11 -2
- package/dist/cjs/core/index.js.map +1 -1
- package/dist/cjs/mcp/index.js +11 -2
- package/dist/cjs/mcp/index.js.map +1 -1
- package/dist/cjs/openai/index.js +11 -2
- package/dist/cjs/openai/index.js.map +1 -1
- package/dist/esm/core/index.js +11 -2
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/mcp/index.js +11 -2
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/openai/index.js +11 -2
- package/dist/esm/openai/index.js.map +1 -1
- package/package.json +1 -3
package/dist/esm/mcp/index.js
CHANGED
|
@@ -1925,6 +1925,15 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
1925
1925
|
id
|
|
1926
1926
|
name
|
|
1927
1927
|
title
|
|
1928
|
+
account {
|
|
1929
|
+
tier
|
|
1930
|
+
active_members_count
|
|
1931
|
+
is_during_trial
|
|
1932
|
+
products {
|
|
1933
|
+
kind
|
|
1934
|
+
tier
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1928
1937
|
}
|
|
1929
1938
|
favorites {
|
|
1930
1939
|
object {
|
|
@@ -2117,7 +2126,7 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
2117
2126
|
}
|
|
2118
2127
|
}
|
|
2119
2128
|
}
|
|
2120
|
-
`,ry={};const iy=[class extends bi{constructor(){super(...arguments),this.name="get_monday_dev_sprints_boards",this.type=xr.READ,this.annotations=yi({title:"monday-dev: Get Sprints Boards",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Discover monday-dev sprints boards and their associated tasks boards in your account.\n\n## Purpose:\nIdentifies and returns monday-dev sprints board IDs and tasks board IDs that you need to use with other monday-dev tools. \nThis tool scans your recently used boards (up to 100) to find valid monday-dev sprint management boards.\n\n## What it Returns:\n- Pairs of sprints boards and their corresponding tasks boards\n- Board IDs, names, and workspace information for each pair\n- The bidirectional relationship between each sprints board and its tasks board\n\n## Note:\nSearches recently used boards (up to 100). If none found, ask user to provide board IDs manually."}getInputSchema(){return ry}async executeInternal(e){try{const e={limit:100},t=((await this.mondayApi.request(ay,e)).boards||[]).filter((e=>null!==e));if(0===t.length)return{content:`${$g} No boards found in your account. Please verify you have access to monday.com boards.`};const a=this.extractBoardPairs(t);return 0===a.length?{content:{message:"No monday-dev sprints board pairs found. ### Possible Reasons:\n1. Boards exist but not accessed recently by your account\n2. Missing access permissions to sprint/task boards\n3. Monday-dev product was not set up in account\n### Next Steps:\n1. Ask user to access monday-dev boards in UI to refresh recent boards list\n2. Ask user to verify permissions to view sprint and task boards\n3. Ask user to provide board IDs manually if known`;",boards_checked:t.length,pairs:[]}}:{content:{message:`Found ${a.length} matched pair(s)`,...a.length>1?{warning:"Multiple board pairs detected. Confirm with user which pair and workspace to use before any operation."}:{},pairs:a.map((e=>({sprints_board:{id:e.sprintsBoard.id,name:e.sprintsBoard.name,workspace_id:e.sprintsBoard.workspaceId,workspace_name:e.sprintsBoard.workspaceName},tasks_board:{id:e.tasksBoard.id,name:e.tasksBoard.name,workspace_id:e.tasksBoard.workspaceId,workspace_name:e.tasksBoard.workspaceName}}))),technical_reference:"Sprint Operations (all require correct board pair): Add to Sprint: Update `task_sprint` column with sprint item ID. Remove from Sprint: Clear `task_sprint` column (set to null). Search in Sprint: Filter where `task_sprint` equals sprint item ID. Move Between Sprints: Update `task_sprint` with new sprint item ID. Backlog Tasks: `task_sprint` is empty/null. Critical: `task_sprint` column references ONLY its paired sprints board. Cross-pair operations WILL FAIL."}}}catch(e){return{content:`${Lg} Error retrieving sprints boards: ${e instanceof Error?e.message:"Unknown error"}`}}}createBoardInfo(e,t,a){return{id:e,name:t?.name||a,workspaceId:t?.workspace?.id||"unknown",workspaceName:t?.workspace?.name||"Unknown"}}processSprintsBoard(e,t,a){const r=Xg(e,kg.SPRINT_TASKS);if(!r)return;const i=Jg(r);if(!i)return;const o=`${e.id}:${i}`;if(a.has(o))return;const n=t.get(i);a.set(o,{sprintsBoard:this.createBoardInfo(e.id,e,`Sprints Board ${e.id}`),tasksBoard:this.createBoardInfo(i,n,`Tasks Board ${i}`)})}processTasksBoard(e,t,a){const r=Xg(e,jg);if(!r)return;const i=Jg(r);if(!i)return;const o=`${i}:${e.id}`;if(a.has(o))return;const n=t.get(i);a.set(o,{sprintsBoard:this.createBoardInfo(i,n,`Sprints Board ${i}`),tasksBoard:this.createBoardInfo(e.id,e,`Tasks Board ${e.id}`)})}extractBoardPairs(e){const t=new Map,a=new Map(e.map((e=>[e.id,e])));for(const r of e)r.columns&&(Yg(r)&&this.processSprintsBoard(r,a,t),Kg(r)&&this.processTasksBoard(r,a,t));return Array.from(t.values())}},class extends bi{constructor(){super(...arguments),this.name="get_sprints_metadata",this.type=xr.READ,this.annotations=yi({title:"monday-dev: Get Sprints Metadata",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get comprehensive sprint metadata from a monday-dev sprints board including:\n\n## Data Retrieved:\nA table of sprints with the following information:\n- Sprint ID\n- Sprint Name\n- Sprint timeline (planned from/to dates)\n- Sprint completion status (completed/in-progress/planned)\n- Sprint start date (actual)\n- Sprint end date (actual)\n- Sprint activation status\n- Sprint summary document object ID\n\n## Parameters:\n- **limit**: Number of sprints to retrieve (default: 25, max: 100)\n\nRequires the Main Sprints board ID of the monday-dev containing your sprints."}getInputSchema(){return ty}async executeInternal(e){try{const t=await this.validateBoardSchema(e.sprintsBoardId.toString());if(!t.success)return{content:t.error||"Board schema validation failed"};const a={boardId:e.sprintsBoardId.toString(),limit:e.limit},r=await this.mondayApi.request(ey,a),i=r.boards?.[0],o=i?.items_page?.items||[],n=this.buildSprintsMetadata(o);return{content:{message:"Sprints metadata retrieved",board_id:e.sprintsBoardId,total:o.length,data:n}}}catch(e){return{content:`${Lg} Error retrieving sprints metadata: ${e instanceof Error?e.message:"Unknown error"}`}}}async validateBoardSchema(e){try{const t={boardId:e.toString()},a=await this.mondayApi.request(Dc,t),r=a.boards?.[0];if(!r)return{success:!1,error:`${$g} Board with ID ${e} not found. Please verify the board ID is correct and you have access to it.`};const i=r.columns||[],o=this.validateSprintsBoardSchemaFromColumns(i);return o.isValid?{success:!0}:{success:!1,error:`${Vg} ${o.errorMessage}`}}catch(e){return{success:!1,error:`${Lg} Error validating board schema: ${e instanceof Error?e.message:"Unknown error"}`}}}validateSprintsBoardSchemaFromColumns(e){const t=new Set(e.filter((e=>null!==e)).map((e=>e.id))),a=Object.values(kg),r=Qg(t,a);if(!r.isValid){let e="BoardID provided is not a valid sprints board. Missing required columns:\n\n";return r.missingColumns.forEach((t=>{const a=(e=>Ug[e]||e)(t);e+=`- ${a}\n`})),{isValid:!1,errorMessage:e}}return{isValid:!0,errorMessage:""}}buildSprintsMetadata(e){return e.map((e=>{const t=Hg(e,Og.SPRINT_ACTIVATION),a=Hg(e,Og.SPRINT_COMPLETION),r=Gg(e,Og.SPRINT_START_DATE),i=Gg(e,Og.SPRINT_END_DATE),o=((e,t)=>{const a=qg(e,t);if("TimelineValue"===a?.__typename&&a.from&&a.to)return{from:a.from.split("T")[0],to:a.to.split("T")[0]};return null})(e,Og.SPRINT_TIMELINE),n=Wg(e,Og.SPRINT_SUMMARY);let s=Mg.Planned;return a?s=Mg.Completed:(t||r)&&(s=Mg.Active),{id:e.id,name:e.name||"Unknown",status:s,timeline:o?{from:o.from,to:o.to}:null,start_date:r||null,end_date:i||null,is_completed:a,document_object_id:n||null}}))}},class extends bi{constructor(){super(...arguments),this.name="get_sprint_summary",this.type=xr.READ,this.annotations=yi({title:"monday-dev: Get Sprint Summary",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Get the complete summary and analysis of a sprint.\n\n## Purpose:\nUnlock deep insights into completed sprint performance. \n\nThe sprint summary content including:\n- **Scope Management**: Analysis of planned vs. unplanned tasks, scope creep\n- **Velocity & Performance**: Individual velocity, task completion rates, workload distribution per team member\n- **Task Distribution**: Breakdown of completed tasks by type (Feature, Bug, Tech Debt, Infrastructure, etc.)\n- **AI Recommendations**: Action items, process improvements, retrospective focus areas\n\n## Requirements:\n- Sprint must be completed and must be created after 1/1/2025 \n\n## Important Note:\nWhen viewing the section "Completed by Assignee", you\'ll see user IDs in the format "@user-12345678". the 8 digits after the @is the user ID. To retrieve the actual owner names, use the list_users_and_teams tool with the user ID and set includeTeams=false for optimal performance.\n\n'}getInputSchema(){return Zg}async executeInternal(e){try{const t=await this.getSprintMetadata(e.sprintId);if(!t.success)return{content:t.error||`${Lg} Unknown error occurred while getting sprint metadata`};const a=await this.readSprintSummaryDocument(t.documentObjectId);return a.success?{content:{message:"Sprint summary retrieved",sprint_id:e.sprintId,sprint_name:t.sprintName,markdown:a.content}}:{content:a.error||`${Lg} Unknown error occurred while reading document content`}}catch(e){return{content:`${Lg} Error retrieving sprint summary: ${e instanceof Error?e.message:"Unknown error"}`}}}async getSprintMetadata(e){try{const t={ids:[String(e)]},a=(await this.mondayApi.request(Ag,t)).items||[];if(0===a.length)return{success:!1,error:`${Rg} Sprint with ID ${e} not found. Please verify the sprint ID is correct.`};const r=a[0];if(!r)return{success:!1,error:`${Rg} Sprint with ID ${e} not found.`};const i=((e,t=[])=>{const a=new Set((e.column_values||[]).map((e=>e.id))),r=[...Object.values(kg),...t];return Qg(a,r)})(r,[Og.SPRINT_SUMMARY]);if(!i.isValid)return{success:!1,error:`${Vg} Sprint item is missing required columns: ${i.missingColumns.join(", ")}. This may not be a valid sprint board item.`};const o=Wg(r,Og.SPRINT_SUMMARY);return o?{success:!0,documentObjectId:o,sprintName:r.name}:{success:!1,error:`${Pg} No sprint summary document found for sprint "${r.name}" (ID: ${e}). Sprint summary is only available for completed sprints that have analysis documents.`}}catch(e){return{success:!1,error:`${Lg} Error getting sprint item: ${e instanceof Error?e.message:"Unknown error"}`}}}async readSprintSummaryDocument(e){try{const t={object_ids:[e],limit:1},a=(await this.mondayApi.request(bc,t)).docs||[];if(0===a.length)return{success:!1,error:`${Pg} Document with object ID ${e} not found or not accessible.`};const r=a[0];if(!r||!r.id)return{success:!1,error:`${Cg} Document data is invalid for object ID ${e}.`};const i={docId:r.id,blockIds:[]},o=await this.mondayApi.request(Lc,i);if(!o.export_markdown_from_doc?.success)return{success:!1,error:`${Fg} Failed to export markdown from document: ${o.export_markdown_from_doc?.error||"Unknown error"}`};const n=o.export_markdown_from_doc.markdown;return n?{success:!0,content:n}:{success:!1,error:`${xg} Document content is empty or could not be retrieved.`}}catch(e){return{success:!1,error:`${Lg} Error reading document: ${e instanceof Error?e.message:"Unknown error"}`}}}}],oy=[class extends bi{constructor(){super(...arguments),this.name="delete_item",this.type=xr.WRITE,this.annotations=yi({title:"Delete Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete an item"}getInputSchema(){return Tf}async executeInternal(e){const t={id:e.itemId.toString()},a=await this.mondayApi.request(Ec,t);return{content:{message:`Item ${a.delete_item?.id} successfully deleted`,item_id:a.delete_item?.id}}}},class extends bi{constructor(){super(...arguments),this.name="get_board_items_page",this.type=xr.READ,this.annotations=yi({title:"Get Board Items Page",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Get all items from a monday.com board with pagination support and optional column values and item descriptions. Returns structured JSON with item details, creation/update timestamps, and pagination info. Use the nextCursor parameter from the response to get the next page of results when has_more is true. To retrieve an item description (the rich-text body/details of a monday.com item), set includeItemDescription to true — the response will include the item description document blocks with their content, type, and id. Use this whenever the user asks about an item description, body, details, or notes. [REQUIRED PRECONDITION]: Before using this tool, if new columns were added to the board or if you are not familiar with the board structure (column IDs, column types, status labels, etc.), first use get_board_info to understand the board metadata. This is essential for constructing proper filters and knowing which columns are available. VIEW-BASED FILTERING: If the user refers to a board view by name (e.g. "show me items in the Overdue view"), first call get_board_info to get the board views, find the matching view by name, then extract its filter field and pass it as the filters argument here.'}getInputSchema(){return Bf}async executeInternal(e){const t=!e.cursor;if(t&&e.searchTerm)try{if(e.itemIds=await this.getItemIdsFromSmartSearchAsync(e),0===e.itemIds.length)return{content:"No items found matching the specified searchTerm"}}catch(t){Mh(t),e.filters=this.rebuildFiltersWithManualSearch(e.searchTerm,e.filters)}const a={boardId:e.boardId.toString(),limit:e.limit,cursor:e.cursor||void 0,includeColumns:e.includeColumns,columnIds:e.columnIds,includeSubItems:e.includeSubItems,includeDescription:e.includeItemDescription};t&&(e.itemIds||e.filters||e.orderBy)&&(a.queryParams={ids:e.itemIds?.map((e=>e.toString())),operator:e.filtersOperator,rules:e.filters?.map((e=>({column_id:e.columnId.toString(),compare_value:e.compareValue,operator:e.operator,compare_attribute:e.compareAttribute}))),order_by:e.orderBy?.map((e=>({column_id:e.columnId,direction:e.direction})))});const r=await this.mondayApi.request(Uf,a);return{content:this.mapResult(r,e)}}rebuildFiltersWithManualSearch(e,t){return(t=(t=t??[]).filter((e=>"name"!==e.columnId))).push({columnId:"name",operator:Yp.ContainsText,compareValue:e}),t}mapResult(e,t){const a=e.boards?.[0],r=a?.items_page,i=r?.items||[];return{board:{id:a?.id,name:a?.name},items:i.map((e=>this.mapItem(e,t))),pagination:{has_more:!!r?.cursor,nextCursor:r?.cursor||null,count:i.length}}}mapItem(e,t){const a={id:e.id,name:e.name,url:e.url,created_at:e.created_at,updated_at:e.updated_at};if(t.includeColumns&&e.column_values){a.column_values={};for(const t of e.column_values)a.column_values[t.id]=this.getColumnValueData(t)}if(t.includeItemDescription&&"description"in e&&e.description){const t=(e.description.blocks??[]).filter((e=>!!e)).map((e=>({id:e.id,type:e.type,content:e.content})));a.item_description={id:e.description.id,blocks:t}}return t.includeSubItems&&"subitems"in e&&e.subitems&&(a.subitems=e.subitems.slice(0,t.subItemLimit).map((e=>this.mapItem(e,t)))),a}getColumnValueData(e){switch(e.type){case Jh.BoardRelation:return e.linked_items;case Jh.Formula:return e.display_value;case Jh.Mirror:return"Column value type is not supported"}if(e.text)return e.text;try{return JSON.parse(e.value)}catch{return e.value||null}}async getItemIdsFromSmartSearchAsync(e){const t={query:e.searchTerm,limit:20,boardIds:[e.boardId.toString()]},a=(await this.mondayApi.request(Mf,t,{versionOverride:"dev",timeout:jh})).search.items.results.map((e=>Number(e.id)));if(0===a.length)throw new Error("No items found for search term or new search is not enabled for this account");const r=e.itemIds??[];if(0===r.length)return a;const i=new Set(r);return a.filter((e=>i.has(e)))}},class extends bi{constructor(){super(...arguments),this.name="create_item",this.type=xr.WRITE,this.annotations=yi({title:"Create Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"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 to understand the board metadata. This is essential for constructing proper column values and knowing which columns are available."}getInputSchema(){return this.context?.boardId?pf:lf}async executeInternal(e){const t=this.context?.boardId??e.boardId;if(e.duplicateFromItemId&&e.parentItemId)throw new Error("Cannot specify both parentItemId and duplicateFromItemId. Please provide only one of these parameters.");return e.duplicateFromItemId?await this.duplicateAndUpdateItem(e,t):e.parentItemId?await this.createSubitem(e):await this.createNewItem(e,t)}async duplicateAndUpdateItem(e,t){try{const a={boardId:t.toString(),itemId:e.duplicateFromItemId.toString()},r=await this.mondayApi.request(sf,a);if(!r.duplicate_item?.id)throw new Error("Failed to duplicate item: no item duplicated");let i;try{i=JSON.parse(e.columnValues)}catch(e){throw new Error("Invalid JSON in columnValues")}const o={...i,name:e.name},n=new qc(this.mondayApi,{boardId:t});return await n.execute({itemId:parseInt(r.duplicate_item.id),columnValues:JSON.stringify(o)}),{content:{message:`Item ${r.duplicate_item.id} duplicated from ${e.duplicateFromItemId}`,item_id:r.duplicate_item.id,item_name:r.duplicate_item.name,item_url:r.duplicate_item.url,board_id:t}}}catch(e){Uh(e,"duplicate item")}}async createSubitem(e){const t={parentItemId:e.parentItemId.toString(),itemName:e.name,columnValues:e.columnValues};try{const a=await this.mondayApi.request(df,t);if(!a.create_subitem?.id)throw new Error("Failed to create subitem: no subitem created");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){Uh(e,"create subitem")}}async createNewItem(e,t){try{const a={boardId:t.toString(),itemName:e.name,groupId:e.groupId,columnValues:e.columnValues},r=await this.mondayApi.request(Sc,a);return{content:{message:`Item ${r.create_item?.id} successfully created`,item_id:r.create_item?.id,item_name:r.create_item?.name,item_url:r.create_item?.url,board_id:t}}}catch(e){Uh(e,"create item")}}},class extends bi{constructor(){super(...arguments),this.name="create_update",this.type=xr.WRITE,this.annotations=yi({title:"Create Update",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new update (comment/post) on a monday.com item. Updates can be used to add comments, notes, or discussions to items. You can optionally mention users, teams, or boards in the update. You can also reply to an existing update by using the parentId parameter."}getInputSchema(){return ff}async executeInternal(e){let t;if(e.mentionsList)try{const a=JSON.parse(e.mentionsList),r=hf.safeParse(a);if(!r.success)throw new Error(`Invalid mentionsList format: ${r.error.message}`);t=r.data}catch(e){throw new Error(`Invalid mentionsList JSON format: ${e.message}`)}try{const a={itemId:e.itemId.toString(),body:e.body,mentionsList:t,parentId:e.parentId?.toString()},r=await this.mondayApi.request(cf,a);if(!r.create_update?.id)throw new Error("Failed to create update: no update created");return{content:{message:`Update ${r.create_update.id} created on item ${e.itemId}`,update_id:r.create_update.id,item_id:e.itemId,item_name:r.create_update.item?.name,item_url:r.create_update.item?.url}}}catch(e){Uh(e,"create update")}}},class extends bi{constructor(){super(...arguments),this.name="get_updates",this.type=xr.READ,this.annotations=yi({title:"Get Updates",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get updates (comments/posts) from a monday.com item or board. Specify objectId and objectType (Item or Board) to retrieve updates. For Board queries, you can filter by date range using fromDate and toDate (both required together, ISO8601 format). By default, Board queries return only board discussion. Set includeItemUpdates to true to also include updates on individual items. Returns update text, creator info, timestamps, and optionally replies and assets."}getInputSchema(){return yf}async executeInternal(e){try{const t=void 0!==e.fromDate,a=void 0!==e.toDate;if(t!==a)throw new Error("Both fromDate and toDate must be provided together for date range filtering");if((t||a)&&e.objectType===gf.Item)throw new Error("Date range filtering (fromDate/toDate) is only supported for Board objectType");const r={limit:e.limit??25,page:e.page??1,includeReplies:e.includeReplies??!1,includeAssets:e.includeAssets??!1};let i;i=e.objectType===gf.Item?await this.mondayApi.request(vf,{...r,itemId:e.objectId}):await this.mondayApi.request(_f,{...r,boardId:e.objectId,boardUpdatesOnly:!e.includeItemUpdates,...e.fromDate&&e.toDate?{fromDate:bf(e.fromDate),toDate:bf(e.toDate)}:{}});const o=e.objectType===gf.Item?i.items?.[0]?.updates:i.boards?.[0]?.updates;if(!o||0===o.length)return{content:`No updates found for ${e.objectType.toLowerCase()} with id ${e.objectId}`};const n=o.map((t=>{const a={id:t.id,text_body:t.text_body,created_at:t.created_at,updated_at:t.updated_at,creator:t.creator?{id:t.creator.id,name:t.creator.name}:null,item_id:t.item_id};return e.includeReplies&&t.replies&&(a.replies=t.replies.map((e=>({id:e.id,text_body:e.text_body,created_at:e.created_at,updated_at:e.updated_at,creator:e.creator?{id:e.creator.id,name:e.creator.name}:null})))),e.includeAssets&&t.assets&&(a.assets=t.assets.filter((e=>!!e)).map((e=>({id:e.id,name:e.name,url:e.url,file_extension:e.file_extension,file_size:e.file_size,created_at:e.created_at})))),a})),s=e.objectType===gf.Item?i.items?.[0]?.url:i.boards?.[0]?.url;return{content:{message:"Updates retrieved",[`${e.objectType.toLowerCase()}_id`]:e.objectId,url:s,updates:n,pagination:{page:e.page??1,limit:e.limit??25,count:n.length}}}}catch(e){Uh(e,"get updates")}}},class extends bi{constructor(){super(...arguments),this.name="create_update_in_monday",this.type=xr.WRITE,this.annotations=yi({title:"Create Update in Monday, after calling this tool you should",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new update (comment/post) on a monday.com item. Updates can be used to add comments, notes, or discussions to items. You can optionally mention users, teams, or boards in the update. After calling this tool you should call the full board data tool to get data, and immediately after that call the show table tool to show the data from that tool. IMPORTANT: You MUST use the COMPLETE data from the full board data tool - do NOT cut, truncate, or omit any data. Pass the entire dataset to the show table tool."}getInputSchema(){return cg}async executeInternal(e){let t;if(e.mentionsList)try{const a=JSON.parse(e.mentionsList),r=mg.safeParse(a);if(!r.success)throw new Error(`Invalid mentionsList format: ${r.error.message}`);t=r.data}catch(e){throw new Error(`Invalid mentionsList JSON format: ${e.message}`)}try{const a={itemId:e.itemId.toString(),body:e.body,mentionsList:t},r=await this.mondayApi.request(cf,a);if(!r.create_update?.id)throw new Error("Failed to create update: no update created");return{content:{message:`Update ${r.create_update.id} successfully created on item ${e.itemId}`,update_id:r.create_update.id,item_id:e.itemId,next_steps:"Now call the full board data tool to get data, then immediately call the show table tool to show that data. CRITICAL: You MUST pass the COMPLETE and FULL data from the full board data tool to the show table tool - do NOT cut, summarize, truncate, or omit ANY data. Use the entire dataset exactly as received."}}}catch(e){Uh(e,"create update")}}},class extends bi{constructor(){super(...arguments),this.name="get_board_schema",this.type=xr.READ,this.annotations=yi({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 qf}async executeInternal(e){const t=this.context?.boardId??e.boardId,a={boardId:t.toString()},r=await this.mondayApi.request(Dc,a);return{content:{message:"Board schema retrieved",board_id:t,columns:r.boards?.[0]?.columns?.map((e=>({id:e?.id,title:e?.title,type:e?.type})))??[],groups:r.boards?.[0]?.groups?.map((e=>({id:e?.id,title:e?.title})))??[]}}}},class extends bi{constructor(){super(...arguments),this.name="get_board_activity",this.type=xr.READ,this.annotations=yi({title:"Get Board Activity",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}),this.defaultLimit=1e3}getDescription(){return"Get board activity logs for a specified time range (defaults to last 30 days)"}getInputSchema(){return $f}async executeInternal(e){const t=new Date,a=new Date(t.getTime()-Vh.MONTH30Days),r=e?.fromDate||a.toISOString(),i=e?.toDate||t.toISOString(),o={boardId:e.boardId.toString(),fromDate:r,toDate:i,limit:this.defaultLimit,page:1,includeData:e.includeData??!1},n=await this.mondayApi.request(Of,o),s=n.boards?.[0]?.activity_logs;if(!s||0===s.length)return{content:`No activity found for board ${e.boardId} in the specified time range (${r} to ${i}).`};const d=n.boards?.[0],p=e.includeData??!1;return{content:{message:"Board activity retrieved",board_id:e.boardId,board_name:d?.name,board_url:d?.url,data:s.filter((e=>null!=e)).map((e=>({created_at:e.created_at,event:e.event,entity:e.entity,user_id:e.user_id,...p&&e.data?{data:e.data}:{}})))}}}},class extends bi{constructor(){super(...arguments),this.name="get_board_info",this.type=xr.READ,this.annotations=yi({title:"Get Board Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get comprehensive board information including metadata, structure, owners, and configuration. Also returns the board's views (e.g. table views, filter views) — each view includes its id, name, type, and a structured filter object. "}getInputSchema(){return jf}async executeInternal(e){const t={boardId:e.boardId.toString()},a=await this.mondayApi.request(Rf,t),r=a.boards?.[0];if(!r)return{content:`Board with id ${e.boardId} not found or you don't have access to it.`};const i=await this.getSubItemsBoardAsync(r);return{content:Cf(r,i)}}async getSubItemsBoardAsync(e){const t=e.columns?.find((e=>e?.type===Jh.Subtasks));if(!t)return null;const a=t.settings.boardIds[0],r=await this.mondayApi.request(Pf,{boardId:a});return r.boards?.[0]??null}},class extends bi{constructor(){super(...arguments),this.name="get_full_board_data",this.type=xr.READ,this.annotations=yi({title:"Get Full Board Data",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"INTERNAL USE ONLY - DO NOT CALL THIS TOOL DIRECTLY. This tool is exclusively triggered by UI components and should never be invoked directly by the agent."}getInputSchema(){return kf}async executeInternal(e){try{const t={boardId:e.boardId,itemsLimit:7};e.filters&&(t.queryParams={operator:e.filtersOperator,rules:e.filters.map((e=>({column_id:e.columnId.toString(),compare_value:e.compareValue,operator:e.operator,compare_attribute:e.compareAttribute})))});const a=await this.mondayApi.request(Sf,t);if(!a.boards||0===a.boards.length||!a.boards[0])throw new Error(`Board with ID ${e.boardId} not found`);const r=a.boards[0],i=new Set;r.items_page.items.forEach((e=>{e.updates?.forEach((e=>{e.creator_id&&i.add(e.creator_id),e.replies?.forEach((e=>{e.creator_id&&i.add(e.creator_id)}))})),e.column_values.forEach((e=>{if("persons_and_teams"in e){const t=e;t.persons_and_teams?.forEach((e=>{"person"===e.kind&&e.id&&i.add(e.id)}))}}))}));const o=Array.from(i).filter((e=>!(Number(e)<0)));let n=[];if(o.length>0){const e={userIds:o},t=await this.mondayApi.request(Df,e);n=t.users?.filter((e=>null!==e))||[]}const s=new Map(n.map((e=>[e.id,e])));return{content:{board:{id:r.id,name:r.name,columns:r.columns,items:r.items_page.items.map((e=>({id:e.id,name:e.name,column_values:e.column_values,updates:e.updates?.map((e=>({id:e.id,creator_id:e.creator_id||"",creator:e.creator_id&&s.get(e.creator_id)||null,text_body:e.text_body,created_at:e.created_at,replies:e.replies?.map((e=>({id:e.id,creator_id:e.creator_id||"",creator:e.creator_id&&s.get(e.creator_id)||null,text_body:e.text_body,created_at:e.created_at})))||[]})))||[]})))},users:n,stats:{total_items:r.items_page.items.length,total_updates:r.items_page.items.reduce(((e,t)=>e+(t.updates?.length||0)),0),total_unique_creators:n.length}}}}catch(e){Uh(e,"get full board data")}}},class extends bi{constructor(){super(...arguments),this.name="list_users_and_teams",this.type=xr.READ,this.annotations=yi({title:"List Users and Teams",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Tool to fetch users and/or teams data. \n\n MANDATORY BEST PRACTICES:\n 1. ALWAYS use specific IDs or names when available\n 2. If no ids available, use name search if possible (USERS ONLY)\n 3. Use 'getMe: true' to get current user information\n 4. AVOID broad queries (no parameters) - use only as last resort\n\n REQUIRED PARAMETER PRIORITY (use in this order):\n 1. getMe - STANDALONE\n 2. userIds\n 3. name - STANDALONE (USERS ONLY, NOT for teams)\n 4. teamIds + teamsOnly\n 5. No parameters - LAST RESORT\n\n CRITICAL USAGE RULES:\n • userIds + teamIds requires explicit includeTeams: true flag\n • includeTeams: true fetches both users and teams, do not use this to fetch a specific user's teams rather fetch that user by id and you will get their team memberships.\n • name parameter is for USER search ONLY - it cannot be used to search for teams. Use teamIds to fetch specific teams."}getInputSchema(){return yv}async executeInternal(e){const t=e.userIds&&e.userIds.length>0,a=e.teamIds&&e.teamIds.length>0,r=e.includeTeams||!1,i=e.teamsOnly||!1,o=e.includeTeamMembers||!1,n=!!e.name;if(e.getMe||!1){if(t||a||r||i||o||n)return{content:"PARAMETER_CONFLICT: getMe is STANDALONE only. Remove all other parameters when using getMe: true for current user lookup."};const e=await this.mondayApi.request(pv);if(!e.me)return{content:"AUTHENTICATION_ERROR: Current user fetch failed. Verify API token and user permissions."};const s={users:[e.me]},d=cv(s),p=await _v(this.mondayApi);return{content:{data:d,action_name:"Users and teams",url:p?`https://${p}.monday.com/teams/all`:void 0}}}if(n){if(t||a||r||i||o)return{content:"PARAMETER_CONFLICT: name is STANDALONE only. Remove userIds, teamIds, includeTeams, teamsOnly, and includeTeamMembers when using name search."};const n={name:e.name},s=await this.mondayApi.request(dv,n);if(!s.users||0===s.users.length)return{content:`NAME_SEARCH_EMPTY: No users found matching "${e.name}". Try broader search terms or verify user exists in account.`};const d=s.users.filter((e=>null!==e)).map((e=>`• **${e.name}** (ID: ${e.id})${e.title?` - ${e.title}`:""}`)).join("\n"),p=`Found ${s.users.length} user(s) matching "${e.name}":\n\n${d}`,l=await _v(this.mondayApi);return{content:{data:p,action_name:"Users and teams",url:l?`https://${l}.monday.com/teams/all`:void 0}}}if(i&&r)return{content:"PARAMETER_CONFLICT: Cannot use teamsOnly: true with includeTeams: true. Use teamsOnly for teams-only queries or includeTeams for combined data."};if(t&&e.userIds&&e.userIds.length>uv)return{content:`LIMIT_EXCEEDED: userIds array too large (${e.userIds.length}/500). Split into batches of max 500 IDs and make multiple calls.`};if(a&&e.teamIds&&e.teamIds.length>hv)return{content:`LIMIT_EXCEEDED: teamIds array too large (${e.teamIds.length}/500). Split into batches of max 500 IDs and make multiple calls.`};let s;if(i||!t&&a&&!r)if(o){const t={teamIds:e.teamIds};s=await this.mondayApi.request(sv,t)}else{const t={teamIds:e.teamIds};s=await this.mondayApi.request(nv,t)}else if(r){const t={userIds:e.userIds,teamIds:e.teamIds,limit:fv};s=await this.mondayApi.request(ov,t)}else if(t){const t={userIds:e.userIds,limit:fv};s=await this.mondayApi.request(rv,t)}else{const e={userIds:void 0,limit:fv};s=await this.mondayApi.request(iv,e)}const d=cv(s),p=await _v(this.mondayApi);return{content:{data:d,action_name:"Users and teams",url:p?`https://${p}.monday.com/teams/all`:void 0}}}},qc,class extends bi{constructor(){super(...arguments),this.name="move_item_to_group",this.type=xr.WRITE,this.annotations=yi({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 bv}async executeInternal(e){const t={itemId:e.itemId.toString(),groupId:e.groupId},a=await this.mondayApi.request(Ac,t);return{content:`Item ${a.move_item_to_group?.id} successfully moved to group ${e.groupId}`}}},class extends bi{constructor(){super(...arguments),this.name="create_board",this.type=xr.WRITE,this.annotations=yi({title:"Create Board",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com board"}getInputSchema(){return mu}async executeInternal(e){const t={boardName:e.boardName,boardKind:e.boardKind,boardDescription:e.boardDescription,workspaceId:e.workspaceId},a=await this.mondayApi.request(kc,t);return{content:{message:`Board ${a.create_board?.id} successfully created`,board_id:a.create_board?.id,board_name:a.create_board?.name,board_url:a.create_board?.url}}}},class extends bi{constructor(){super(...arguments),this.name="create_form",this.type=xr.WRITE,this.annotations=yi({title:"Create Form",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com form. Also creates a backing board to store responses. Returns the formToken for future mutations."}getInputSchema(){return Hu}async executeInternal(e){const t={destination_workspace_id:e.destination_workspace_id,destination_folder_id:e.destination_folder_id,destination_folder_name:e.destination_folder_name,board_kind:e.board_kind,destination_name:e.destination_name,board_owner_ids:e.board_owner_ids,board_owner_team_ids:e.board_owner_team_ids,board_subscriber_ids:e.board_subscriber_ids,board_subscriber_teams_ids:e.board_subscriber_teams_ids},a=await this.mondayApi.request(Iu,t);return{content:{message:"Form created successfully",board_id:a.create_form?.boardId,form_token:a.create_form?.token}}}},class extends bi{constructor(){super(...arguments),this.name="update_form",this.type=xr.WRITE,this.annotations=yi({title:"Update Form",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}),this.helpers=new Ch(this.mondayApi),this.actionHandlers=new Map([[lh.setFormPassword,this.helpers.setFormPassword.bind(this.helpers)],[lh.shortenFormUrl,this.helpers.shortenFormUrl.bind(this.helpers)],[lh.deactivate,this.helpers.deactivateForm.bind(this.helpers)],[lh.activate,this.helpers.activateForm.bind(this.helpers)],[lh.createTag,this.helpers.createTag.bind(this.helpers)],[lh.deleteTag,this.helpers.deleteTag.bind(this.helpers)],[lh.updateTag,this.helpers.updateTag.bind(this.helpers)],[lh.updateAppearance,this.helpers.updateAppearance.bind(this.helpers)],[lh.updateAccessibility,this.helpers.updateAccessibility.bind(this.helpers)],[lh.updateFeatures,this.helpers.updateFeatures.bind(this.helpers)],[lh.updateQuestionOrder,this.helpers.updateQuestionOrder.bind(this.helpers)],[lh.updateFormHeader,this.helpers.updateFormHeader.bind(this.helpers)]])}getDescription(){return"Update a monday.com form. Use the action field to specify the operation."}getInputSchema(){return Ph}async executeInternal(e){const t=this.actionHandlers.get(e.action);return t?await t(e):{content:"Received an invalid action for the update form tool."}}},class extends bi{constructor(){super(...arguments),this.name="get_form",this.type=xr.READ,this.annotations=yi({title:"Get Form",readOnlyHint:!0,destructiveHint:!1})}getDescription(){return"Get a monday.com form by its form token. Form tokens can be extracted from the form's url. Given a form url, such as https://forms.monday.com/forms/abc123def456ghi789?r=use1, the formToken is the alphanumeric string that appears right after /forms/ and before the ?. In the example, the formToken is abc123def456ghi789."}getInputSchema(){return xh}async executeInternal(e){const t={formToken:e.formToken},a=await this.mondayApi.request(Tu,t);return a.form?{content:{message:"Form retrieved",form_token:e.formToken,data:a.form}}:{content:`Form with token ${e.formToken} not found or you don't have access to it.`}}},class extends bi{constructor(){super(...arguments),this.name="form_questions_editor",this.type=xr.WRITE,this.annotations=yi({title:"Form Questions Editor",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}),this.helpers=new ph(this.mondayApi),this.actionHandlers=new Map([[nh.Delete,this.helpers.deleteQuestion.bind(this.helpers)],[nh.Update,this.helpers.updateQuestion.bind(this.helpers)],[nh.Create,this.helpers.createQuestion.bind(this.helpers)]])}getDescription(){return"Create, update, or delete a question in a monday.com form"}getInputSchema(){return dh}async executeInternal(e){const t=this.actionHandlers.get(e.action);return t?await t(e):{content:`Unknown action: ${e.action}`}}},class extends bi{constructor(){super(...arguments),this.name="create_form_submission",this.type=xr.WRITE,this.annotations=yi({title:"Create WorkForm Submission",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Submit a response to a monday.com WorkForm. Use get_form first to retrieve the WorkForm, then:\n- Inspect each question's showIfRules to determine which questions are conditionally shown based on previous answers.\n- Inspect each question's settings for any answer constraints (e.g. rating limits, select options, label limits).\n- Take note of any titles, descriptions, and content blocks to present the form naturally as you walk the user through it.\n- Take note of pages and question order to present questions in the correct sequence.\nGather all answers upfront before calling this tool — do not submit one question at a time. Accepts a bare form token, a full WorkForm URL (e.g. https://forms.monday.com/forms/{form_token}?r=use1), or a shortened wkf.ms URL (e.g. https://wkf.ms/4tqP28t) — shortened URLs are automatically resolved by following the redirect. Returns the submission ID."}getInputSchema(){return Kh}extractTokenFromUrl(e){const t=e.match(/\/forms\/([^/?]+)/);return t?t[1]:null}async resolveFormToken(e){if(e.includes("wkf.ms")){const t=(await i.head(e,{maxRedirects:0,validateStatus:e=>e<400})).headers.location;return t?this.extractTokenFromUrl(t):null}return e.startsWith("http://")||e.startsWith("https://")?this.extractTokenFromUrl(e):e}async executeInternal(e){const t=await this.resolveFormToken(e.form_token);if(!t)return{content:`Could not resolve a WorkForm token from "${e.form_token}". Please provide a valid WorkForm token or full WorkForm URL (e.g. https://forms.monday.com/forms/abc123).`};const a={form_token:t,answers:e.answers,form_timezone_offset:e.form_timezone_offset,password:e.password,tags:e.tags};try{const e=await this.mondayApi.request(Bh,a,{versionOverride:"dev"});return e.create_form_submission?{content:{message:"WorkForm submitted successfully",submission_id:e.create_form_submission.id}}:{content:`WorkForm with token ${t} was not found or is not accepting submissions. Verify the WorkForm token is correct, the WorkForm is active, and any required password was provided.`}}catch(e){Uh(e,"submit form")}}},class extends bi{constructor(){super(...arguments),this.name="create_column",this.type=xr.WRITE,this.annotations=yi({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?Xh:Zh}async executeInternal(e){const t=this.context?.boardId??e.boardId,a={boardId:t?.toString()??"",columnType:e.columnType,columnTitle:e.columnTitle,columnDescription:e.columnDescription,columnSettings:"string"==typeof e.columnSettings?JSON.parse(e.columnSettings):e.columnSettings},r=await this.mondayApi.request(Oc,a);return{content:{message:"Column successfully created",column_id:r.create_column?.id,column_title:r.create_column?.title}}}},class extends bi{constructor(){super(...arguments),this.name="create_group",this.type=xr.WRITE,this.annotations=yi({title:"Create Group",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new group in a monday.com board. Groups are sections that organize related items. Use when users want to add structure, categorize items, or create workflow phases. Groups can be positioned relative to existing groups and assigned predefined colors. Items will always be created in the top group and so the top group should be the most relevant one for new item creation"}getInputSchema(){return nf}async executeInternal(e){const t={boardId:e.boardId,groupName:e.groupName,groupColor:e.groupColor,relativeTo:e.relativeTo,positionRelativeMethod:e.positionRelativeMethod},a=await this.mondayApi.request(rf,t);return{content:{message:"Group created successfully",group_id:a.create_group?.id,group_title:a.create_group?.title,board_id:e.boardId,group_name:e.groupName}}}},class extends bi{constructor(){super(...arguments),this.name="delete_column",this.type=xr.WRITE,this.annotations=yi({title:"Delete Column",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete a column from a monday.com board"}getInputSchema(){return this.context?.boardId?wf:If}async executeInternal(e){const t={boardId:(this.context?.boardId??e.boardId).toString(),columnId:e.columnId},a=await this.mondayApi.request($c,t);return{content:{message:`Column ${a.delete_column?.id} successfully deleted`,column_id:a.delete_column?.id}}}},Uc,class extends bi{constructor(){super(...arguments),this.name="get_graphql_schema",this.type=xr.ALL_API,this.annotations=yi({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 Qf}async executeInternal(e){try{const t=await this.mondayApi.request(Rc),a=e?.operationType,r=t.__schema,i="write"!==a?t.queryType?.fields?.map((e=>({name:e.name,description:e.description??null})))??[]:void 0,o="read"!==a?t.mutationType?.fields?.map((e=>({name:e.name,description:e.description??null})))??[]:void 0,n=r?.types?.filter((e=>e.name&&!e.name.startsWith("__"))).map((e=>({name:e.name,kind:e.kind??"unknown"})))??[];return{content:{message:"GraphQL schema retrieved",...void 0!==i&&{query_fields:i},...void 0!==o&&{mutation_fields:o},types:n}}}catch(e){return{content:`Error fetching GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends bi{constructor(){super(...arguments),this.name="get_column_type_info",this.type=xr.READ,this.annotations=yi({title:"Get Column Type Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Retrieves comprehensive information about a specific column type, including JSON schema definition and other metadata. Use this before creating columns with the create_column tool to understand the structure, validation rules, and available properties for column settings."}getInputSchema(){return Wf}async executeInternal(e){const t={type:e.columnType},a=await this.mondayApi.request(Hf,t);if(!a?.get_column_type_schema)return{content:`Information for column type "${e.columnType}" not found or not available.`};const r={schema:a.get_column_type_schema};return{content:{message:`Column type info for ${e.columnType}`,data:r,url:Gf}}}},class extends bi{constructor(){super(...arguments),this.name="get_type_details",this.type=xr.ALL_API,this.annotations=yi({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 zf}async executeInternal(e){try{if(!e.typeName)return{content:"Error: typeName is required. Please provide a valid GraphQL type name."};const a=(t=e.typeName,yc`
|
|
2129
|
+
`,ry={};const iy=[class extends bi{constructor(){super(...arguments),this.name="get_monday_dev_sprints_boards",this.type=xr.READ,this.annotations=yi({title:"monday-dev: Get Sprints Boards",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Discover monday-dev sprints boards and their associated tasks boards in your account.\n\n## Purpose:\nIdentifies and returns monday-dev sprints board IDs and tasks board IDs that you need to use with other monday-dev tools. \nThis tool scans your recently used boards (up to 100) to find valid monday-dev sprint management boards.\n\n## What it Returns:\n- Pairs of sprints boards and their corresponding tasks boards\n- Board IDs, names, and workspace information for each pair\n- The bidirectional relationship between each sprints board and its tasks board\n\n## Note:\nSearches recently used boards (up to 100). If none found, ask user to provide board IDs manually."}getInputSchema(){return ry}async executeInternal(e){try{const e={limit:100},t=((await this.mondayApi.request(ay,e)).boards||[]).filter((e=>null!==e));if(0===t.length)return{content:`${$g} No boards found in your account. Please verify you have access to monday.com boards.`};const a=this.extractBoardPairs(t);return 0===a.length?{content:{message:"No monday-dev sprints board pairs found. ### Possible Reasons:\n1. Boards exist but not accessed recently by your account\n2. Missing access permissions to sprint/task boards\n3. Monday-dev product was not set up in account\n### Next Steps:\n1. Ask user to access monday-dev boards in UI to refresh recent boards list\n2. Ask user to verify permissions to view sprint and task boards\n3. Ask user to provide board IDs manually if known`;",boards_checked:t.length,pairs:[]}}:{content:{message:`Found ${a.length} matched pair(s)`,...a.length>1?{warning:"Multiple board pairs detected. Confirm with user which pair and workspace to use before any operation."}:{},pairs:a.map((e=>({sprints_board:{id:e.sprintsBoard.id,name:e.sprintsBoard.name,workspace_id:e.sprintsBoard.workspaceId,workspace_name:e.sprintsBoard.workspaceName},tasks_board:{id:e.tasksBoard.id,name:e.tasksBoard.name,workspace_id:e.tasksBoard.workspaceId,workspace_name:e.tasksBoard.workspaceName}}))),technical_reference:"Sprint Operations (all require correct board pair): Add to Sprint: Update `task_sprint` column with sprint item ID. Remove from Sprint: Clear `task_sprint` column (set to null). Search in Sprint: Filter where `task_sprint` equals sprint item ID. Move Between Sprints: Update `task_sprint` with new sprint item ID. Backlog Tasks: `task_sprint` is empty/null. Critical: `task_sprint` column references ONLY its paired sprints board. Cross-pair operations WILL FAIL."}}}catch(e){return{content:`${Lg} Error retrieving sprints boards: ${e instanceof Error?e.message:"Unknown error"}`}}}createBoardInfo(e,t,a){return{id:e,name:t?.name||a,workspaceId:t?.workspace?.id||"unknown",workspaceName:t?.workspace?.name||"Unknown"}}processSprintsBoard(e,t,a){const r=Xg(e,kg.SPRINT_TASKS);if(!r)return;const i=Jg(r);if(!i)return;const o=`${e.id}:${i}`;if(a.has(o))return;const n=t.get(i);a.set(o,{sprintsBoard:this.createBoardInfo(e.id,e,`Sprints Board ${e.id}`),tasksBoard:this.createBoardInfo(i,n,`Tasks Board ${i}`)})}processTasksBoard(e,t,a){const r=Xg(e,jg);if(!r)return;const i=Jg(r);if(!i)return;const o=`${i}:${e.id}`;if(a.has(o))return;const n=t.get(i);a.set(o,{sprintsBoard:this.createBoardInfo(i,n,`Sprints Board ${i}`),tasksBoard:this.createBoardInfo(e.id,e,`Tasks Board ${e.id}`)})}extractBoardPairs(e){const t=new Map,a=new Map(e.map((e=>[e.id,e])));for(const r of e)r.columns&&(Yg(r)&&this.processSprintsBoard(r,a,t),Kg(r)&&this.processTasksBoard(r,a,t));return Array.from(t.values())}},class extends bi{constructor(){super(...arguments),this.name="get_sprints_metadata",this.type=xr.READ,this.annotations=yi({title:"monday-dev: Get Sprints Metadata",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get comprehensive sprint metadata from a monday-dev sprints board including:\n\n## Data Retrieved:\nA table of sprints with the following information:\n- Sprint ID\n- Sprint Name\n- Sprint timeline (planned from/to dates)\n- Sprint completion status (completed/in-progress/planned)\n- Sprint start date (actual)\n- Sprint end date (actual)\n- Sprint activation status\n- Sprint summary document object ID\n\n## Parameters:\n- **limit**: Number of sprints to retrieve (default: 25, max: 100)\n\nRequires the Main Sprints board ID of the monday-dev containing your sprints."}getInputSchema(){return ty}async executeInternal(e){try{const t=await this.validateBoardSchema(e.sprintsBoardId.toString());if(!t.success)return{content:t.error||"Board schema validation failed"};const a={boardId:e.sprintsBoardId.toString(),limit:e.limit},r=await this.mondayApi.request(ey,a),i=r.boards?.[0],o=i?.items_page?.items||[],n=this.buildSprintsMetadata(o);return{content:{message:"Sprints metadata retrieved",board_id:e.sprintsBoardId,total:o.length,data:n}}}catch(e){return{content:`${Lg} Error retrieving sprints metadata: ${e instanceof Error?e.message:"Unknown error"}`}}}async validateBoardSchema(e){try{const t={boardId:e.toString()},a=await this.mondayApi.request(Dc,t),r=a.boards?.[0];if(!r)return{success:!1,error:`${$g} Board with ID ${e} not found. Please verify the board ID is correct and you have access to it.`};const i=r.columns||[],o=this.validateSprintsBoardSchemaFromColumns(i);return o.isValid?{success:!0}:{success:!1,error:`${Vg} ${o.errorMessage}`}}catch(e){return{success:!1,error:`${Lg} Error validating board schema: ${e instanceof Error?e.message:"Unknown error"}`}}}validateSprintsBoardSchemaFromColumns(e){const t=new Set(e.filter((e=>null!==e)).map((e=>e.id))),a=Object.values(kg),r=Qg(t,a);if(!r.isValid){let e="BoardID provided is not a valid sprints board. Missing required columns:\n\n";return r.missingColumns.forEach((t=>{const a=(e=>Ug[e]||e)(t);e+=`- ${a}\n`})),{isValid:!1,errorMessage:e}}return{isValid:!0,errorMessage:""}}buildSprintsMetadata(e){return e.map((e=>{const t=Hg(e,Og.SPRINT_ACTIVATION),a=Hg(e,Og.SPRINT_COMPLETION),r=Gg(e,Og.SPRINT_START_DATE),i=Gg(e,Og.SPRINT_END_DATE),o=((e,t)=>{const a=qg(e,t);if("TimelineValue"===a?.__typename&&a.from&&a.to)return{from:a.from.split("T")[0],to:a.to.split("T")[0]};return null})(e,Og.SPRINT_TIMELINE),n=Wg(e,Og.SPRINT_SUMMARY);let s=Mg.Planned;return a?s=Mg.Completed:(t||r)&&(s=Mg.Active),{id:e.id,name:e.name||"Unknown",status:s,timeline:o?{from:o.from,to:o.to}:null,start_date:r||null,end_date:i||null,is_completed:a,document_object_id:n||null}}))}},class extends bi{constructor(){super(...arguments),this.name="get_sprint_summary",this.type=xr.READ,this.annotations=yi({title:"monday-dev: Get Sprint Summary",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Get the complete summary and analysis of a sprint.\n\n## Purpose:\nUnlock deep insights into completed sprint performance. \n\nThe sprint summary content including:\n- **Scope Management**: Analysis of planned vs. unplanned tasks, scope creep\n- **Velocity & Performance**: Individual velocity, task completion rates, workload distribution per team member\n- **Task Distribution**: Breakdown of completed tasks by type (Feature, Bug, Tech Debt, Infrastructure, etc.)\n- **AI Recommendations**: Action items, process improvements, retrospective focus areas\n\n## Requirements:\n- Sprint must be completed and must be created after 1/1/2025 \n\n## Important Note:\nWhen viewing the section "Completed by Assignee", you\'ll see user IDs in the format "@user-12345678". the 8 digits after the @is the user ID. To retrieve the actual owner names, use the list_users_and_teams tool with the user ID and set includeTeams=false for optimal performance.\n\n'}getInputSchema(){return Zg}async executeInternal(e){try{const t=await this.getSprintMetadata(e.sprintId);if(!t.success)return{content:t.error||`${Lg} Unknown error occurred while getting sprint metadata`};const a=await this.readSprintSummaryDocument(t.documentObjectId);return a.success?{content:{message:"Sprint summary retrieved",sprint_id:e.sprintId,sprint_name:t.sprintName,markdown:a.content}}:{content:a.error||`${Lg} Unknown error occurred while reading document content`}}catch(e){return{content:`${Lg} Error retrieving sprint summary: ${e instanceof Error?e.message:"Unknown error"}`}}}async getSprintMetadata(e){try{const t={ids:[String(e)]},a=(await this.mondayApi.request(Ag,t)).items||[];if(0===a.length)return{success:!1,error:`${Rg} Sprint with ID ${e} not found. Please verify the sprint ID is correct.`};const r=a[0];if(!r)return{success:!1,error:`${Rg} Sprint with ID ${e} not found.`};const i=((e,t=[])=>{const a=new Set((e.column_values||[]).map((e=>e.id))),r=[...Object.values(kg),...t];return Qg(a,r)})(r,[Og.SPRINT_SUMMARY]);if(!i.isValid)return{success:!1,error:`${Vg} Sprint item is missing required columns: ${i.missingColumns.join(", ")}. This may not be a valid sprint board item.`};const o=Wg(r,Og.SPRINT_SUMMARY);return o?{success:!0,documentObjectId:o,sprintName:r.name}:{success:!1,error:`${Pg} No sprint summary document found for sprint "${r.name}" (ID: ${e}). Sprint summary is only available for completed sprints that have analysis documents.`}}catch(e){return{success:!1,error:`${Lg} Error getting sprint item: ${e instanceof Error?e.message:"Unknown error"}`}}}async readSprintSummaryDocument(e){try{const t={object_ids:[e],limit:1},a=(await this.mondayApi.request(bc,t)).docs||[];if(0===a.length)return{success:!1,error:`${Pg} Document with object ID ${e} not found or not accessible.`};const r=a[0];if(!r||!r.id)return{success:!1,error:`${Cg} Document data is invalid for object ID ${e}.`};const i={docId:r.id,blockIds:[]},o=await this.mondayApi.request(Lc,i);if(!o.export_markdown_from_doc?.success)return{success:!1,error:`${Fg} Failed to export markdown from document: ${o.export_markdown_from_doc?.error||"Unknown error"}`};const n=o.export_markdown_from_doc.markdown;return n?{success:!0,content:n}:{success:!1,error:`${xg} Document content is empty or could not be retrieved.`}}catch(e){return{success:!1,error:`${Lg} Error reading document: ${e instanceof Error?e.message:"Unknown error"}`}}}}],oy=[class extends bi{constructor(){super(...arguments),this.name="delete_item",this.type=xr.WRITE,this.annotations=yi({title:"Delete Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete an item"}getInputSchema(){return Tf}async executeInternal(e){const t={id:e.itemId.toString()},a=await this.mondayApi.request(Ec,t);return{content:{message:`Item ${a.delete_item?.id} successfully deleted`,item_id:a.delete_item?.id}}}},class extends bi{constructor(){super(...arguments),this.name="get_board_items_page",this.type=xr.READ,this.annotations=yi({title:"Get Board Items Page",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Get all items from a monday.com board with pagination support and optional column values and item descriptions. Returns structured JSON with item details, creation/update timestamps, and pagination info. Use the nextCursor parameter from the response to get the next page of results when has_more is true. To retrieve an item description (the rich-text body/details of a monday.com item), set includeItemDescription to true — the response will include the item description document blocks with their content, type, and id. Use this whenever the user asks about an item description, body, details, or notes. [REQUIRED PRECONDITION]: Before using this tool, if new columns were added to the board or if you are not familiar with the board structure (column IDs, column types, status labels, etc.), first use get_board_info to understand the board metadata. This is essential for constructing proper filters and knowing which columns are available. [REQUIRED PRECONDITION]: For board-relation / cross-board linking tasks, call link_board_items_workflow before using this tool. VIEW-BASED FILTERING: If the user refers to a board view by name (e.g. "show me items in the Overdue view"), first call get_board_info to get the board views, find the matching view by name, then extract its filter field and pass it as the filters argument here.'}getInputSchema(){return Bf}async executeInternal(e){const t=!e.cursor;if(t&&e.searchTerm)try{if(e.itemIds=await this.getItemIdsFromSmartSearchAsync(e),0===e.itemIds.length)return{content:"No items found matching the specified searchTerm"}}catch(t){Mh(t),e.filters=this.rebuildFiltersWithManualSearch(e.searchTerm,e.filters)}const a={boardId:e.boardId.toString(),limit:e.limit,cursor:e.cursor||void 0,includeColumns:e.includeColumns,columnIds:e.columnIds,includeSubItems:e.includeSubItems,includeDescription:e.includeItemDescription};t&&(e.itemIds||e.filters||e.orderBy)&&(a.queryParams={ids:e.itemIds?.map((e=>e.toString())),operator:e.filtersOperator,rules:e.filters?.map((e=>({column_id:e.columnId.toString(),compare_value:e.compareValue,operator:e.operator,compare_attribute:e.compareAttribute}))),order_by:e.orderBy?.map((e=>({column_id:e.columnId,direction:e.direction})))});const r=await this.mondayApi.request(Uf,a);return{content:this.mapResult(r,e)}}rebuildFiltersWithManualSearch(e,t){return(t=(t=t??[]).filter((e=>"name"!==e.columnId))).push({columnId:"name",operator:Yp.ContainsText,compareValue:e}),t}mapResult(e,t){const a=e.boards?.[0],r=a?.items_page,i=r?.items||[];return{board:{id:a?.id,name:a?.name},items:i.map((e=>this.mapItem(e,t))),pagination:{has_more:!!r?.cursor,nextCursor:r?.cursor||null,count:i.length}}}mapItem(e,t){const a={id:e.id,name:e.name,url:e.url,created_at:e.created_at,updated_at:e.updated_at};if(t.includeColumns&&e.column_values){a.column_values={};for(const t of e.column_values)a.column_values[t.id]=this.getColumnValueData(t)}if(t.includeItemDescription&&"description"in e&&e.description){const t=(e.description.blocks??[]).filter((e=>!!e)).map((e=>({id:e.id,type:e.type,content:e.content})));a.item_description={id:e.description.id,blocks:t}}return t.includeSubItems&&"subitems"in e&&e.subitems&&(a.subitems=e.subitems.slice(0,t.subItemLimit).map((e=>this.mapItem(e,t)))),a}getColumnValueData(e){switch(e.type){case Jh.BoardRelation:return e.linked_items;case Jh.Formula:return e.display_value;case Jh.Mirror:return"Column value type is not supported"}if(e.text)return e.text;try{return JSON.parse(e.value)}catch{return e.value||null}}async getItemIdsFromSmartSearchAsync(e){const t={query:e.searchTerm,limit:20,boardIds:[e.boardId.toString()]},a=(await this.mondayApi.request(Mf,t,{versionOverride:"dev",timeout:jh})).search.items.results.map((e=>Number(e.id)));if(0===a.length)throw new Error("No items found for search term or new search is not enabled for this account");const r=e.itemIds??[];if(0===r.length)return a;const i=new Set(r);return a.filter((e=>i.has(e)))}},class extends bi{constructor(){super(...arguments),this.name="create_item",this.type=xr.WRITE,this.annotations=yi({title:"Create Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"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 to understand the board metadata. This is essential for constructing proper column values and knowing which columns are available."}getInputSchema(){return this.context?.boardId?pf:lf}async executeInternal(e){const t=this.context?.boardId??e.boardId;if(e.duplicateFromItemId&&e.parentItemId)throw new Error("Cannot specify both parentItemId and duplicateFromItemId. Please provide only one of these parameters.");return e.duplicateFromItemId?await this.duplicateAndUpdateItem(e,t):e.parentItemId?await this.createSubitem(e):await this.createNewItem(e,t)}async duplicateAndUpdateItem(e,t){try{const a={boardId:t.toString(),itemId:e.duplicateFromItemId.toString()},r=await this.mondayApi.request(sf,a);if(!r.duplicate_item?.id)throw new Error("Failed to duplicate item: no item duplicated");let i;try{i=JSON.parse(e.columnValues)}catch(e){throw new Error("Invalid JSON in columnValues")}const o={...i,name:e.name},n=new qc(this.mondayApi,{boardId:t});return await n.execute({itemId:parseInt(r.duplicate_item.id),columnValues:JSON.stringify(o)}),{content:{message:`Item ${r.duplicate_item.id} duplicated from ${e.duplicateFromItemId}`,item_id:r.duplicate_item.id,item_name:r.duplicate_item.name,item_url:r.duplicate_item.url,board_id:t}}}catch(e){Uh(e,"duplicate item")}}async createSubitem(e){const t={parentItemId:e.parentItemId.toString(),itemName:e.name,columnValues:e.columnValues};try{const a=await this.mondayApi.request(df,t);if(!a.create_subitem?.id)throw new Error("Failed to create subitem: no subitem created");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){Uh(e,"create subitem")}}async createNewItem(e,t){try{const a={boardId:t.toString(),itemName:e.name,groupId:e.groupId,columnValues:e.columnValues},r=await this.mondayApi.request(Sc,a);return{content:{message:`Item ${r.create_item?.id} successfully created`,item_id:r.create_item?.id,item_name:r.create_item?.name,item_url:r.create_item?.url,board_id:t}}}catch(e){Uh(e,"create item")}}},class extends bi{constructor(){super(...arguments),this.name="create_update",this.type=xr.WRITE,this.annotations=yi({title:"Create Update",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new update (comment/post) on a monday.com item. Updates can be used to add comments, notes, or discussions to items. You can optionally mention users, teams, or boards in the update. You can also reply to an existing update by using the parentId parameter."}getInputSchema(){return ff}async executeInternal(e){let t;if(e.mentionsList)try{const a=JSON.parse(e.mentionsList),r=hf.safeParse(a);if(!r.success)throw new Error(`Invalid mentionsList format: ${r.error.message}`);t=r.data}catch(e){throw new Error(`Invalid mentionsList JSON format: ${e.message}`)}try{const a={itemId:e.itemId.toString(),body:e.body,mentionsList:t,parentId:e.parentId?.toString()},r=await this.mondayApi.request(cf,a);if(!r.create_update?.id)throw new Error("Failed to create update: no update created");return{content:{message:`Update ${r.create_update.id} created on item ${e.itemId}`,update_id:r.create_update.id,item_id:e.itemId,item_name:r.create_update.item?.name,item_url:r.create_update.item?.url}}}catch(e){Uh(e,"create update")}}},class extends bi{constructor(){super(...arguments),this.name="get_updates",this.type=xr.READ,this.annotations=yi({title:"Get Updates",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get updates (comments/posts) from a monday.com item or board. Specify objectId and objectType (Item or Board) to retrieve updates. For Board queries, you can filter by date range using fromDate and toDate (both required together, ISO8601 format). By default, Board queries return only board discussion. Set includeItemUpdates to true to also include updates on individual items. Returns update text, creator info, timestamps, and optionally replies and assets."}getInputSchema(){return yf}async executeInternal(e){try{const t=void 0!==e.fromDate,a=void 0!==e.toDate;if(t!==a)throw new Error("Both fromDate and toDate must be provided together for date range filtering");if((t||a)&&e.objectType===gf.Item)throw new Error("Date range filtering (fromDate/toDate) is only supported for Board objectType");const r={limit:e.limit??25,page:e.page??1,includeReplies:e.includeReplies??!1,includeAssets:e.includeAssets??!1};let i;i=e.objectType===gf.Item?await this.mondayApi.request(vf,{...r,itemId:e.objectId}):await this.mondayApi.request(_f,{...r,boardId:e.objectId,boardUpdatesOnly:!e.includeItemUpdates,...e.fromDate&&e.toDate?{fromDate:bf(e.fromDate),toDate:bf(e.toDate)}:{}});const o=e.objectType===gf.Item?i.items?.[0]?.updates:i.boards?.[0]?.updates;if(!o||0===o.length)return{content:`No updates found for ${e.objectType.toLowerCase()} with id ${e.objectId}`};const n=o.map((t=>{const a={id:t.id,text_body:t.text_body,created_at:t.created_at,updated_at:t.updated_at,creator:t.creator?{id:t.creator.id,name:t.creator.name}:null,item_id:t.item_id};return e.includeReplies&&t.replies&&(a.replies=t.replies.map((e=>({id:e.id,text_body:e.text_body,created_at:e.created_at,updated_at:e.updated_at,creator:e.creator?{id:e.creator.id,name:e.creator.name}:null})))),e.includeAssets&&t.assets&&(a.assets=t.assets.filter((e=>!!e)).map((e=>({id:e.id,name:e.name,url:e.url,file_extension:e.file_extension,file_size:e.file_size,created_at:e.created_at})))),a})),s=e.objectType===gf.Item?i.items?.[0]?.url:i.boards?.[0]?.url;return{content:{message:"Updates retrieved",[`${e.objectType.toLowerCase()}_id`]:e.objectId,url:s,updates:n,pagination:{page:e.page??1,limit:e.limit??25,count:n.length}}}}catch(e){Uh(e,"get updates")}}},class extends bi{constructor(){super(...arguments),this.name="create_update_in_monday",this.type=xr.WRITE,this.annotations=yi({title:"Create Update in Monday, after calling this tool you should",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new update (comment/post) on a monday.com item. Updates can be used to add comments, notes, or discussions to items. You can optionally mention users, teams, or boards in the update. After calling this tool you should call the full board data tool to get data, and immediately after that call the show table tool to show the data from that tool. IMPORTANT: You MUST use the COMPLETE data from the full board data tool - do NOT cut, truncate, or omit any data. Pass the entire dataset to the show table tool."}getInputSchema(){return cg}async executeInternal(e){let t;if(e.mentionsList)try{const a=JSON.parse(e.mentionsList),r=mg.safeParse(a);if(!r.success)throw new Error(`Invalid mentionsList format: ${r.error.message}`);t=r.data}catch(e){throw new Error(`Invalid mentionsList JSON format: ${e.message}`)}try{const a={itemId:e.itemId.toString(),body:e.body,mentionsList:t},r=await this.mondayApi.request(cf,a);if(!r.create_update?.id)throw new Error("Failed to create update: no update created");return{content:{message:`Update ${r.create_update.id} successfully created on item ${e.itemId}`,update_id:r.create_update.id,item_id:e.itemId,next_steps:"Now call the full board data tool to get data, then immediately call the show table tool to show that data. CRITICAL: You MUST pass the COMPLETE and FULL data from the full board data tool to the show table tool - do NOT cut, summarize, truncate, or omit ANY data. Use the entire dataset exactly as received."}}}catch(e){Uh(e,"create update")}}},class extends bi{constructor(){super(...arguments),this.name="get_board_schema",this.type=xr.READ,this.annotations=yi({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 qf}async executeInternal(e){const t=this.context?.boardId??e.boardId,a={boardId:t.toString()},r=await this.mondayApi.request(Dc,a);return{content:{message:"Board schema retrieved",board_id:t,columns:r.boards?.[0]?.columns?.map((e=>({id:e?.id,title:e?.title,type:e?.type})))??[],groups:r.boards?.[0]?.groups?.map((e=>({id:e?.id,title:e?.title})))??[]}}}},class extends bi{constructor(){super(...arguments),this.name="get_board_activity",this.type=xr.READ,this.annotations=yi({title:"Get Board Activity",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}),this.defaultLimit=1e3}getDescription(){return"Get board activity logs for a specified time range (defaults to last 30 days)"}getInputSchema(){return $f}async executeInternal(e){const t=new Date,a=new Date(t.getTime()-Vh.MONTH30Days),r=e?.fromDate||a.toISOString(),i=e?.toDate||t.toISOString(),o={boardId:e.boardId.toString(),fromDate:r,toDate:i,limit:this.defaultLimit,page:1,includeData:e.includeData??!1},n=await this.mondayApi.request(Of,o),s=n.boards?.[0]?.activity_logs;if(!s||0===s.length)return{content:`No activity found for board ${e.boardId} in the specified time range (${r} to ${i}).`};const d=n.boards?.[0],p=e.includeData??!1;return{content:{message:"Board activity retrieved",board_id:e.boardId,board_name:d?.name,board_url:d?.url,data:s.filter((e=>null!=e)).map((e=>({created_at:e.created_at,event:e.event,entity:e.entity,user_id:e.user_id,...p&&e.data?{data:e.data}:{}})))}}}},class extends bi{constructor(){super(...arguments),this.name="get_board_info",this.type=xr.READ,this.annotations=yi({title:"Get Board Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get comprehensive board information including metadata, structure, owners, and configuration. Also returns the board's views (e.g. table views, filter views) — each view includes its id, name, type, and a structured filter object. "}getInputSchema(){return jf}async executeInternal(e){const t={boardId:e.boardId.toString()},a=await this.mondayApi.request(Rf,t),r=a.boards?.[0];if(!r)return{content:`Board with id ${e.boardId} not found or you don't have access to it.`};const i=await this.getSubItemsBoardAsync(r);return{content:Cf(r,i)}}async getSubItemsBoardAsync(e){const t=e.columns?.find((e=>e?.type===Jh.Subtasks));if(!t)return null;const a=t.settings.boardIds[0],r=await this.mondayApi.request(Pf,{boardId:a});return r.boards?.[0]??null}},class extends bi{constructor(){super(...arguments),this.name="get_full_board_data",this.type=xr.READ,this.annotations=yi({title:"Get Full Board Data",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"INTERNAL USE ONLY - DO NOT CALL THIS TOOL DIRECTLY. This tool is exclusively triggered by UI components and should never be invoked directly by the agent."}getInputSchema(){return kf}async executeInternal(e){try{const t={boardId:e.boardId,itemsLimit:7};e.filters&&(t.queryParams={operator:e.filtersOperator,rules:e.filters.map((e=>({column_id:e.columnId.toString(),compare_value:e.compareValue,operator:e.operator,compare_attribute:e.compareAttribute})))});const a=await this.mondayApi.request(Sf,t);if(!a.boards||0===a.boards.length||!a.boards[0])throw new Error(`Board with ID ${e.boardId} not found`);const r=a.boards[0],i=new Set;r.items_page.items.forEach((e=>{e.updates?.forEach((e=>{e.creator_id&&i.add(e.creator_id),e.replies?.forEach((e=>{e.creator_id&&i.add(e.creator_id)}))})),e.column_values.forEach((e=>{if("persons_and_teams"in e){const t=e;t.persons_and_teams?.forEach((e=>{"person"===e.kind&&e.id&&i.add(e.id)}))}}))}));const o=Array.from(i).filter((e=>!(Number(e)<0)));let n=[];if(o.length>0){const e={userIds:o},t=await this.mondayApi.request(Df,e);n=t.users?.filter((e=>null!==e))||[]}const s=new Map(n.map((e=>[e.id,e])));return{content:{board:{id:r.id,name:r.name,columns:r.columns,items:r.items_page.items.map((e=>({id:e.id,name:e.name,column_values:e.column_values,updates:e.updates?.map((e=>({id:e.id,creator_id:e.creator_id||"",creator:e.creator_id&&s.get(e.creator_id)||null,text_body:e.text_body,created_at:e.created_at,replies:e.replies?.map((e=>({id:e.id,creator_id:e.creator_id||"",creator:e.creator_id&&s.get(e.creator_id)||null,text_body:e.text_body,created_at:e.created_at})))||[]})))||[]})))},users:n,stats:{total_items:r.items_page.items.length,total_updates:r.items_page.items.reduce(((e,t)=>e+(t.updates?.length||0)),0),total_unique_creators:n.length}}}}catch(e){Uh(e,"get full board data")}}},class extends bi{constructor(){super(...arguments),this.name="list_users_and_teams",this.type=xr.READ,this.annotations=yi({title:"List Users and Teams",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Tool to fetch users and/or teams data. \n\n MANDATORY BEST PRACTICES:\n 1. ALWAYS use specific IDs or names when available\n 2. If no ids available, use name search if possible (USERS ONLY)\n 3. Use 'getMe: true' to get current user information\n 4. AVOID broad queries (no parameters) - use only as last resort\n\n REQUIRED PARAMETER PRIORITY (use in this order):\n 1. getMe - STANDALONE\n 2. userIds\n 3. name - STANDALONE (USERS ONLY, NOT for teams)\n 4. teamIds + teamsOnly\n 5. No parameters - LAST RESORT\n\n CRITICAL USAGE RULES:\n • userIds + teamIds requires explicit includeTeams: true flag\n • includeTeams: true fetches both users and teams, do not use this to fetch a specific user's teams rather fetch that user by id and you will get their team memberships.\n • name parameter is for USER search ONLY - it cannot be used to search for teams. Use teamIds to fetch specific teams."}getInputSchema(){return yv}async executeInternal(e){const t=e.userIds&&e.userIds.length>0,a=e.teamIds&&e.teamIds.length>0,r=e.includeTeams||!1,i=e.teamsOnly||!1,o=e.includeTeamMembers||!1,n=!!e.name;if(e.getMe||!1){if(t||a||r||i||o||n)return{content:"PARAMETER_CONFLICT: getMe is STANDALONE only. Remove all other parameters when using getMe: true for current user lookup."};const e=await this.mondayApi.request(pv);if(!e.me)return{content:"AUTHENTICATION_ERROR: Current user fetch failed. Verify API token and user permissions."};const s={users:[e.me]},d=cv(s),p=await _v(this.mondayApi);return{content:{data:d,action_name:"Users and teams",url:p?`https://${p}.monday.com/teams/all`:void 0}}}if(n){if(t||a||r||i||o)return{content:"PARAMETER_CONFLICT: name is STANDALONE only. Remove userIds, teamIds, includeTeams, teamsOnly, and includeTeamMembers when using name search."};const n={name:e.name},s=await this.mondayApi.request(dv,n);if(!s.users||0===s.users.length)return{content:`NAME_SEARCH_EMPTY: No users found matching "${e.name}". Try broader search terms or verify user exists in account.`};const d=s.users.filter((e=>null!==e)).map((e=>`• **${e.name}** (ID: ${e.id})${e.title?` - ${e.title}`:""}`)).join("\n"),p=`Found ${s.users.length} user(s) matching "${e.name}":\n\n${d}`,l=await _v(this.mondayApi);return{content:{data:p,action_name:"Users and teams",url:l?`https://${l}.monday.com/teams/all`:void 0}}}if(i&&r)return{content:"PARAMETER_CONFLICT: Cannot use teamsOnly: true with includeTeams: true. Use teamsOnly for teams-only queries or includeTeams for combined data."};if(t&&e.userIds&&e.userIds.length>uv)return{content:`LIMIT_EXCEEDED: userIds array too large (${e.userIds.length}/500). Split into batches of max 500 IDs and make multiple calls.`};if(a&&e.teamIds&&e.teamIds.length>hv)return{content:`LIMIT_EXCEEDED: teamIds array too large (${e.teamIds.length}/500). Split into batches of max 500 IDs and make multiple calls.`};let s;if(i||!t&&a&&!r)if(o){const t={teamIds:e.teamIds};s=await this.mondayApi.request(sv,t)}else{const t={teamIds:e.teamIds};s=await this.mondayApi.request(nv,t)}else if(r){const t={userIds:e.userIds,teamIds:e.teamIds,limit:fv};s=await this.mondayApi.request(ov,t)}else if(t){const t={userIds:e.userIds,limit:fv};s=await this.mondayApi.request(rv,t)}else{const e={userIds:void 0,limit:fv};s=await this.mondayApi.request(iv,e)}const d=cv(s),p=await _v(this.mondayApi);return{content:{data:d,action_name:"Users and teams",url:p?`https://${p}.monday.com/teams/all`:void 0}}}},qc,class extends bi{constructor(){super(...arguments),this.name="move_item_to_group",this.type=xr.WRITE,this.annotations=yi({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 bv}async executeInternal(e){const t={itemId:e.itemId.toString(),groupId:e.groupId},a=await this.mondayApi.request(Ac,t);return{content:`Item ${a.move_item_to_group?.id} successfully moved to group ${e.groupId}`}}},class extends bi{constructor(){super(...arguments),this.name="create_board",this.type=xr.WRITE,this.annotations=yi({title:"Create Board",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com board"}getInputSchema(){return mu}async executeInternal(e){const t={boardName:e.boardName,boardKind:e.boardKind,boardDescription:e.boardDescription,workspaceId:e.workspaceId},a=await this.mondayApi.request(kc,t);return{content:{message:`Board ${a.create_board?.id} successfully created`,board_id:a.create_board?.id,board_name:a.create_board?.name,board_url:a.create_board?.url}}}},class extends bi{constructor(){super(...arguments),this.name="create_form",this.type=xr.WRITE,this.annotations=yi({title:"Create Form",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com form. Also creates a backing board to store responses. Returns the formToken for future mutations."}getInputSchema(){return Hu}async executeInternal(e){const t={destination_workspace_id:e.destination_workspace_id,destination_folder_id:e.destination_folder_id,destination_folder_name:e.destination_folder_name,board_kind:e.board_kind,destination_name:e.destination_name,board_owner_ids:e.board_owner_ids,board_owner_team_ids:e.board_owner_team_ids,board_subscriber_ids:e.board_subscriber_ids,board_subscriber_teams_ids:e.board_subscriber_teams_ids},a=await this.mondayApi.request(Iu,t);return{content:{message:"Form created successfully",board_id:a.create_form?.boardId,form_token:a.create_form?.token}}}},class extends bi{constructor(){super(...arguments),this.name="update_form",this.type=xr.WRITE,this.annotations=yi({title:"Update Form",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}),this.helpers=new Ch(this.mondayApi),this.actionHandlers=new Map([[lh.setFormPassword,this.helpers.setFormPassword.bind(this.helpers)],[lh.shortenFormUrl,this.helpers.shortenFormUrl.bind(this.helpers)],[lh.deactivate,this.helpers.deactivateForm.bind(this.helpers)],[lh.activate,this.helpers.activateForm.bind(this.helpers)],[lh.createTag,this.helpers.createTag.bind(this.helpers)],[lh.deleteTag,this.helpers.deleteTag.bind(this.helpers)],[lh.updateTag,this.helpers.updateTag.bind(this.helpers)],[lh.updateAppearance,this.helpers.updateAppearance.bind(this.helpers)],[lh.updateAccessibility,this.helpers.updateAccessibility.bind(this.helpers)],[lh.updateFeatures,this.helpers.updateFeatures.bind(this.helpers)],[lh.updateQuestionOrder,this.helpers.updateQuestionOrder.bind(this.helpers)],[lh.updateFormHeader,this.helpers.updateFormHeader.bind(this.helpers)]])}getDescription(){return"Update a monday.com form. Use the action field to specify the operation."}getInputSchema(){return Ph}async executeInternal(e){const t=this.actionHandlers.get(e.action);return t?await t(e):{content:"Received an invalid action for the update form tool."}}},class extends bi{constructor(){super(...arguments),this.name="get_form",this.type=xr.READ,this.annotations=yi({title:"Get Form",readOnlyHint:!0,destructiveHint:!1})}getDescription(){return"Get a monday.com form by its form token. Form tokens can be extracted from the form's url. Given a form url, such as https://forms.monday.com/forms/abc123def456ghi789?r=use1, the formToken is the alphanumeric string that appears right after /forms/ and before the ?. In the example, the formToken is abc123def456ghi789."}getInputSchema(){return xh}async executeInternal(e){const t={formToken:e.formToken},a=await this.mondayApi.request(Tu,t);return a.form?{content:{message:"Form retrieved",form_token:e.formToken,data:a.form}}:{content:`Form with token ${e.formToken} not found or you don't have access to it.`}}},class extends bi{constructor(){super(...arguments),this.name="form_questions_editor",this.type=xr.WRITE,this.annotations=yi({title:"Form Questions Editor",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}),this.helpers=new ph(this.mondayApi),this.actionHandlers=new Map([[nh.Delete,this.helpers.deleteQuestion.bind(this.helpers)],[nh.Update,this.helpers.updateQuestion.bind(this.helpers)],[nh.Create,this.helpers.createQuestion.bind(this.helpers)]])}getDescription(){return"Create, update, or delete a question in a monday.com form"}getInputSchema(){return dh}async executeInternal(e){const t=this.actionHandlers.get(e.action);return t?await t(e):{content:`Unknown action: ${e.action}`}}},class extends bi{constructor(){super(...arguments),this.name="create_form_submission",this.type=xr.WRITE,this.annotations=yi({title:"Create WorkForm Submission",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Submit a response to a monday.com WorkForm. Use get_form first to retrieve the WorkForm, then:\n- Inspect each question's showIfRules to determine which questions are conditionally shown based on previous answers.\n- Inspect each question's settings for any answer constraints (e.g. rating limits, select options, label limits).\n- Take note of any titles, descriptions, and content blocks to present the form naturally as you walk the user through it.\n- Take note of pages and question order to present questions in the correct sequence.\nGather all answers upfront before calling this tool — do not submit one question at a time. Accepts a bare form token, a full WorkForm URL (e.g. https://forms.monday.com/forms/{form_token}?r=use1), or a shortened wkf.ms URL (e.g. https://wkf.ms/4tqP28t) — shortened URLs are automatically resolved by following the redirect. Returns the submission ID."}getInputSchema(){return Kh}extractTokenFromUrl(e){const t=e.match(/\/forms\/([^/?]+)/);return t?t[1]:null}async resolveFormToken(e){if(e.includes("wkf.ms")){const t=(await i.head(e,{maxRedirects:0,validateStatus:e=>e<400})).headers.location;return t?this.extractTokenFromUrl(t):null}return e.startsWith("http://")||e.startsWith("https://")?this.extractTokenFromUrl(e):e}async executeInternal(e){const t=await this.resolveFormToken(e.form_token);if(!t)return{content:`Could not resolve a WorkForm token from "${e.form_token}". Please provide a valid WorkForm token or full WorkForm URL (e.g. https://forms.monday.com/forms/abc123).`};const a={form_token:t,answers:e.answers,form_timezone_offset:e.form_timezone_offset,password:e.password,tags:e.tags};try{const e=await this.mondayApi.request(Bh,a,{versionOverride:"dev"});return e.create_form_submission?{content:{message:"WorkForm submitted successfully",submission_id:e.create_form_submission.id}}:{content:`WorkForm with token ${t} was not found or is not accepting submissions. Verify the WorkForm token is correct, the WorkForm is active, and any required password was provided.`}}catch(e){Uh(e,"submit form")}}},class extends bi{constructor(){super(...arguments),this.name="create_column",this.type=xr.WRITE,this.annotations=yi({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?Xh:Zh}async executeInternal(e){const t=this.context?.boardId??e.boardId,a={boardId:t?.toString()??"",columnType:e.columnType,columnTitle:e.columnTitle,columnDescription:e.columnDescription,columnSettings:"string"==typeof e.columnSettings?JSON.parse(e.columnSettings):e.columnSettings},r=await this.mondayApi.request(Oc,a);return{content:{message:"Column successfully created",column_id:r.create_column?.id,column_title:r.create_column?.title}}}},class extends bi{constructor(){super(...arguments),this.name="create_group",this.type=xr.WRITE,this.annotations=yi({title:"Create Group",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new group in a monday.com board. Groups are sections that organize related items. Use when users want to add structure, categorize items, or create workflow phases. Groups can be positioned relative to existing groups and assigned predefined colors. Items will always be created in the top group and so the top group should be the most relevant one for new item creation"}getInputSchema(){return nf}async executeInternal(e){const t={boardId:e.boardId,groupName:e.groupName,groupColor:e.groupColor,relativeTo:e.relativeTo,positionRelativeMethod:e.positionRelativeMethod},a=await this.mondayApi.request(rf,t);return{content:{message:"Group created successfully",group_id:a.create_group?.id,group_title:a.create_group?.title,board_id:e.boardId,group_name:e.groupName}}}},class extends bi{constructor(){super(...arguments),this.name="delete_column",this.type=xr.WRITE,this.annotations=yi({title:"Delete Column",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete a column from a monday.com board"}getInputSchema(){return this.context?.boardId?wf:If}async executeInternal(e){const t={boardId:(this.context?.boardId??e.boardId).toString(),columnId:e.columnId},a=await this.mondayApi.request($c,t);return{content:{message:`Column ${a.delete_column?.id} successfully deleted`,column_id:a.delete_column?.id}}}},Uc,class extends bi{constructor(){super(...arguments),this.name="get_graphql_schema",this.type=xr.ALL_API,this.annotations=yi({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 Qf}async executeInternal(e){try{const t=await this.mondayApi.request(Rc),a=e?.operationType,r=t.__schema,i="write"!==a?t.queryType?.fields?.map((e=>({name:e.name,description:e.description??null})))??[]:void 0,o="read"!==a?t.mutationType?.fields?.map((e=>({name:e.name,description:e.description??null})))??[]:void 0,n=r?.types?.filter((e=>e.name&&!e.name.startsWith("__"))).map((e=>({name:e.name,kind:e.kind??"unknown"})))??[];return{content:{message:"GraphQL schema retrieved",...void 0!==i&&{query_fields:i},...void 0!==o&&{mutation_fields:o},types:n}}}catch(e){return{content:`Error fetching GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends bi{constructor(){super(...arguments),this.name="get_column_type_info",this.type=xr.READ,this.annotations=yi({title:"Get Column Type Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Retrieves comprehensive information about a specific column type, including JSON schema definition and other metadata. Use this before creating columns with the create_column tool to understand the structure, validation rules, and available properties for column settings."}getInputSchema(){return Wf}async executeInternal(e){const t={type:e.columnType},a=await this.mondayApi.request(Hf,t);if(!a?.get_column_type_schema)return{content:`Information for column type "${e.columnType}" not found or not available.`};const r={schema:a.get_column_type_schema};return{content:{message:`Column type info for ${e.columnType}`,data:r,url:Gf}}}},class extends bi{constructor(){super(...arguments),this.name="get_type_details",this.type=xr.ALL_API,this.annotations=yi({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 zf}async executeInternal(e){try{if(!e.typeName)return{content:"Error: typeName is required. Please provide a valid GraphQL type name."};const a=(t=e.typeName,yc`
|
|
2121
2130
|
query getTypeDetails {
|
|
2122
2131
|
__type(name: "${t}") {
|
|
2123
2132
|
name
|
|
@@ -2205,5 +2214,5 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
2205
2214
|
}
|
|
2206
2215
|
}
|
|
2207
2216
|
}
|
|
2208
|
-
`),r=await this.mondayApi.request(a);return r.__type?{content:{message:"Type details retrieved",data:{name:r.__type.name,kind:r.__type.kind,description:r.__type.description??null,fields:r.__type.fields??[],inputFields:r.__type.inputFields??[],interfaces:r.__type.interfaces??[],enumValues:r.__type.enumValues??[],possibleTypes:r.__type.possibleTypes??[]}}}:{content:`Type '${e.typeName}' not found in the GraphQL schema. Please check the type name and try again.`}}catch(e){const t=e instanceof Error?e.message:"Unknown error",a=t.includes("JSON");return{content:`Error fetching type details: ${t}${a?"\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 t}},class extends bi{constructor(){super(...arguments),this.name="create_custom_activity",this.type=xr.WRITE,this.annotations=yi({title:"Create Custom Activity",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new custom activity in the E&A app"}getInputSchema(){return ef}async executeInternal(e){const t={color:e.color,icon_id:e.icon_id,name:e.name};return await this.mondayApi.request(Cc,t),{content:{message:`Custom activity '${e.name}' with color ${e.color} and icon ${e.icon_id} successfully created`,name:e.name,color:e.color,icon_id:e.icon_id}}}},class extends bi{constructor(){super(...arguments),this.name="create_notification",this.type=xr.WRITE,this.annotations=yi({title:"Create Notification",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Send a notification to a user via the bell icon and optionally by email. Use target_type "Post" for updates/replies or "Project" for items/boards.'}getInputSchema(){return af}async executeInternal(e){const t={user_id:e.user_id,target_id:e.target_id,text:e.text,target_type:e.target_type};try{await this.mondayApi.request(tf,t);return{content:{message:"Notification sent",user_id:e.user_id,text:e.text}}}catch(t){return{content:`Failed to send notification to user ${e.user_id}`}}}},class extends bi{constructor(){super(...arguments),this.name="create_timeline_item",this.type=xr.WRITE,this.annotations=yi({title:"Create Timeline Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new timeline item in the E&A app"}getInputSchema(){return mf}async executeInternal(e){const t={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&&(t.time_range={start_timestamp:e.start_timestamp,end_timestamp:e.end_timestamp});const a=await this.mondayApi.request(xc,t);return{content:{message:`Timeline item '${e.title}' with ID ${a.create_timeline_item?.id} successfully created on item ${e.item_id}`,timeline_item_id:a.create_timeline_item?.id,item_id:e.item_id,title:e.title}}}},class extends bi{constructor(){super(...arguments),this.name="fetch_custom_activity",this.type=xr.READ,this.annotations=yi({title:"Fetch Custom Activities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get custom activities from the E&A app"}getInputSchema(){return Ef}async executeInternal(e){const t=await this.mondayApi.request(Fc);if(!t.custom_activity||0===t.custom_activity.length)return{content:{message:"No custom activities found",data:[]}};const a=t.custom_activity.map((e=>({id:e.id,name:e.name,color:e.color,icon_id:e.icon_id,type:e.type})));return{content:{message:`Found ${a.length} custom activities`,data:a}}}},class extends bi{constructor(){super(...arguments),this.name="read_docs",this.type=xr.READ,this.annotations=yi({title:"Read Documents",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Get information about monday.com documents. Supports two modes:\n\nMODE: "content" (default) — Fetch documents with their full markdown content.\n- Requires: type ("ids" | "object_ids" | "workspace_ids") and ids array\n- Supports pagination via page/limit. Check has_more_pages in response.\n- If type "ids" returns no results, automatically retries with object_ids.\n- Set include_blocks: true to include block IDs, types, and positions in the response — required before calling update_doc.\n- Set include_comments: true to fetch all comments and replies on the document. Use comments_limit to control how many comments per item (default 50).\n\nMODE: "version_history" — Fetch the edit history of a single document.\n- Requires: ids with the document\'s object_id (use the object_id field from content mode results, NOT the id field).\n- The object_id is the numeric ID visible in the document URL.\n- Returns restoring points sorted newest-first. Use version_history_limit to cap results (e.g., "last 3 changes" → version_history_limit: 3).\n- Use since/until to filter by time range. If omitted, returns full history.\n- Set include_diff: true to see what content changed between versions (fetches up to 10 diffs, may be slower).\n- Examples:\n - { mode: "version_history", ids: ["5001466606"], version_history_limit: 3 }\n - { mode: "version_history", ids: ["5001466606"], since: "2026-03-11T00:00:00Z", include_diff: true }'}getInputSchema(){return Ev}async executeInternal(e){return e.mode===Iv?this.executeVersionHistory(e):this.executeContent(e)}async executeContent(e){try{if(!e.type||!e.ids||0===e.ids.length)return{content:'Error: type and ids are required when mode is "content".'};let t,a,r;switch(this.sessionContext.metadata={...this.sessionContext.metadata,mode:e.mode??wv,include_comments:e.include_comments??!1,include_blocks:e.include_blocks??!1},e.type){case"ids":t=e.ids;break;case"object_ids":a=e.ids;break;case"workspace_ids":r=e.ids}const i=e.include_blocks??!1,o={ids:t,object_ids:a,limit:e.limit||25,order_by:e.order_by,page:e.page,workspace_ids:r,includeBlocks:i};let n=await this.mondayApi.request(bc,o);if((!n.docs||0===n.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:r,includeBlocks:i};n=await this.mondayApi.request(bc,a)}if(!n.docs||0===n.docs.length){return{content:`No documents found matching the specified criteria${e.page?` (page ${e.page})`:""}.`}}const s=e.include_comments??!1,d=e.comments_limit??50;return this.sessionContext.metadata={...this.sessionContext.metadata,doc_ids:n.docs.flatMap((e=>e?[e.id]:[])),object_ids:n.docs.flatMap((e=>e?.object_id?[e.object_id]:[]))},this.enrichDocsWithMarkdown(n.docs,o,i,s,d)}catch(e){return{content:`Error reading documents: ${e instanceof Error?e.message:"Unknown error occurred"}`}}}async executeVersionHistory(e){const{include_diff:t,since:a,until:r,version_history_limit:i}=e,o=e.ids?.[0];if(!o)return{content:'Error: ids is required when mode is "version_history". Provide the document object_id.'};this.sessionContext.metadata={...this.sessionContext.metadata,mode:Iv,object_ids:[o]};try{const e={docId:o,since:a,until:r},n=await this.mondayApi.request(wc,e);let s=n?.doc_version_history?.restoring_points;if(!s||0===s.length)return{content:`No version history found for document ${o}${a?` from ${a}`:""}.`};if(!t)return i&&(s=s.slice(0,i)),{content:{doc_id:o,since:a,until:r,restoring_points:s}};const d=Math.min(i??10,10),p=s.slice(0,d+1),l=s.length>d,m=(await Promise.allSettled(p.map((async(e,t)=>{if(t===p.length-1||!e.date)return e;const a=p[t+1];if(!a?.date)return e;const r={docId:o,date:e.date,prevDate:a.date},i=await this.mondayApi.request(Tc,r);return{...e,diff:i?.doc_version_diff?.blocks??[]}}))).then((e=>e.map(((e,t)=>"fulfilled"===e.status?e.value:p[t]))))).slice(0,d);return{content:{doc_id:o,since:a,until:r,restoring_points:m,...l&&{truncated:!0,total_count:s.length}}}}catch(e){return{content:`Error fetching version history for document ${o}: ${e instanceof Error?e.message:"Unknown error"}`}}}async fetchDocComments(e,t){try{const a={boardId:e,itemsLimit:100,updatesLimit:t},r=await this.mondayApi.request(Ic,a),i=r.boards?.[0]?.items_page?.items;if(!i)return[];const o=[];for(const e of i)if(e.updates&&0!==e.updates.length)for(const t of e.updates)o.push({id:t.id,text_body:t.text_body,body:t.body,created_at:t.created_at,creator:t.creator?{id:t.creator.id,name:t.creator.name}:null,item_id:e.id,item_name:e.name,replies:(t.replies??[]).map((e=>({id:e.id,text_body:e.text_body,body:e.body,created_at:e.created_at,creator:e.creator?{id:e.creator.id,name:e.creator.name}:null})))});return o}catch(e){return`Error fetching comments: ${e instanceof Error?e.message:"Unknown error"}`}}async enrichDocsWithMarkdown(e,t,a,r=!1,i=50){const o=await Promise.all(e.filter((e=>null!==e)).map((async e=>{let t,o="";try{const t={docId:e.id},a=await this.mondayApi.request(Lc,t);o=a.export_markdown_from_doc.success&&a.export_markdown_from_doc.markdown?a.export_markdown_from_doc.markdown:`Error getting markdown: ${a.export_markdown_from_doc.error||"Unknown error"}`}catch(e){o=`Error getting markdown: ${e instanceof Error?e.message:"Unknown error"}`}return r&&e.object_id&&(t=await this.fetchDocComments(e.object_id,i)),{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,...a&&{blocks:(e.blocks??[]).filter((e=>null!=e)).map((e=>({id:e.id,type:e.type,parent_block_id:e.parent_block_id,position:e.position,content:e.content})))},blocks_as_markdown:o,...r&&{comments:t}}}))),n=t.page||1,s=t.limit||25,d=o.length,p=d===s;return{content:{message:`Documents retrieved (${o.length})`,pagination:{current_page:n,limit:s,count:d,has_more_pages:p},data:o}}}},class extends bi{constructor(){super(...arguments),this.name="workspace_info",this.type=xr.READ,this.annotations=yi({title:"Get Workspace Information",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"This tool returns the boards, docs and folders in a workspace and which folder they are in. It returns up to 100 of each object type, if you receive 100 assume there are additional objects of that type in the workspace."}getInputSchema(){return Sv}async executeInternal(e){const t={workspace_id:e.workspace_id},a=await this.mondayApi.request(Vc,t);if(!a.workspaces||0===a.workspaces.length)return{content:`No workspace found with ID ${e.workspace_id}`};const r=function(e,t){const{workspaces:a,boards:r,docs:i,folders:o}=e,n=a?.[0];if(!n)throw new Error("No workspace found");const s=new Map((o||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).map((e=>[e.id,{id:e.id,name:e.name,boards:[],docs:[]}]))),d=[];(r||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).forEach((e=>{const t={id:e.id,name:e.name};e.board_folder_id&&s.has(e.board_folder_id)?s.get(e.board_folder_id).boards.push(t):d.push(t)}));const p=[];return(i||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).forEach((e=>{const t={id:e.id,name:e.name};e.doc_folder_id&&s.has(e.doc_folder_id)?s.get(e.doc_folder_id).docs.push(t):p.push(t)})),{workspace:{id:n.id,name:n.name,url:t?gv(t,n.id):void 0,description:n.description||"",kind:n.kind||"",created_at:n.created_at||"",state:n.state||"",is_default_workspace:n.is_default_workspace||!1,owners_subscribers:(n.owners_subscribers||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name&&null!=e.email)).map((e=>({id:e.id,name:e.name,email:e.email})))},folders:Array.from(s.values()),root_items:{boards:d,docs:p}}}(a,await _v(this.mondayApi));return{content:{message:"Workspace info retrieved",data:r}}}},class extends bi{constructor(){super(...arguments),this.name="list_workspaces",this.type=xr.READ,this.annotations=yi({title:"List Workspaces",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"List all workspaces available to the user. Returns up to 500 workspaces with their ID, name, and description."}getInputSchema(){return $v}async executeInternal(e){const t=e.searchTerm?1e4:e.limit,a=e.searchTerm?1:e.page;let r=null;if(e.searchTerm&&(r=Av(e.searchTerm),0===r.length))throw new Error("Search term did not include any alphanumeric characters. Please provide a valid search term.");const i=e=>({limit:t,page:a,membershipKind:e}),o=kv(await this.mondayApi.request(Dv,i(Jl.Member))),n=!Ov(o)||r&&!function(e,t){return t.some((t=>Av(t.name).includes(e)))}(r,o);let s=o;if(n){s=kv(await this.mondayApi.request(Dv,i(Jl.All)))}if(!Ov(s))return{content:{message:"No workspaces found.",data:[]}};const d=r&&s?.length<=Nv,p=function(e,t,a,r){if(!e||t.length<=Nv)return t;const i=(a-1)*r,o=i+r;return t.filter((t=>Av(t.name).includes(e))).slice(i,o)}(r,s,e.page,e.limit);if(!Ov(p))return{content:{message:"No workspaces found matching the search term. Try using the tool without a search term",data:[]}};const l=p.length===e.limit,m=await _v(this.mondayApi),c=p.map((e=>({id:e.id,name:e.name,description:e.description||void 0,url:m&&e.id?gv(m,e.id):void 0})));return{content:{message:"Workspaces retrieved",...d?{disclaimer:"Search term not applied - returning all workspaces. Perform the filtering manually."}:{},...l?{next_page:e.page+1}:{},data:c}}}},class extends bi{constructor(){super(...arguments),this.name="create_doc",this.type=xr.WRITE,this.annotations=yi({title:"Create Document",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a new monday.com doc either inside a workspace or attached to an item (via a doc column). After creation, the provided markdown will be appended to the document.\n\nLOCATION TYPES:\n- workspace: Creates a document in a workspace (requires workspace_id, optional doc_kind, optional folder_id)\n- item: Creates a document attached to an item (requires item_id, optional column_id)\n\nUSAGE EXAMPLES:\n- Workspace doc: { location: "workspace", workspace_id: 123, doc_kind: "private" , markdown: "..." }\n- Workspace doc in folder: { location: "workspace", workspace_id: 123, folder_id: 17264196 , markdown: "..." }\n- Item doc: { location: "item", item_id: 456, column_id: "doc_col_1" , markdown: "..." }'}getInputSchema(){return Vv}async executeInternal(e){const t=Lv.safeParse({...e,type:e.location});if(!t.success)return{content:`Required parameters were not provided for location parameter of ${e.location}`};const a=t.data;try{let t,r,i;if(a.type===Fv.enum.workspace){const o={location:{workspace:{workspace_id:a.workspace_id.toString(),name:e.doc_name,kind:a.doc_kind||Gd.Public,folder_id:a.folder_id?.toString()}}},n=await this.mondayApi.request(Pv,o);t=n?.create_doc?.id??void 0,r=n?.create_doc?.object_id??void 0,i=n?.create_doc?.url??void 0}else if(a.type===Fv.enum.item){const o={itemId:a.item_id.toString()},n=await this.mondayApi.request(Rv,o),s=n.items?.[0];if(!s)return{content:`Error: Item with id ${a.item_id} not found.`};const d=s.board?.id,p=s.board?.columns?.find((e=>e&&e.type===Jh.Doc));let l=a.column_id;if(!l)if(p)l=p.id;else{const e={boardId:d.toString(),columnType:Jh.Doc,columnTitle:"Doc"},t=await this.mondayApi.request(Oc,e);if(l=t?.create_column?.id,!l)return{content:"Error: Failed to create doc column."}}const m={location:{board:{item_id:a.item_id.toString(),column_id:l}}},c=await this.mondayApi.request(Pv,m);if(t=c.create_doc?.id??void 0,r=c.create_doc?.object_id??void 0,i=c.create_doc?.url??void 0,e.doc_name&&t)try{const a={docId:t,name:e.doc_name};await this.mondayApi.request(xv,a)}catch(e){console.warn("Failed to update doc name:",e)}}if(!t)return{content:"Error: Failed to create document."};const o={docId:t,markdown:e.markdown},n=await this.mondayApi.request(Cv,o),s=n?.add_content_to_doc_from_markdown?.success,d=n?.add_content_to_doc_from_markdown?.error;return s?(this.sessionContext.metadata={...this.sessionContext.metadata,location:e.location,...t&&{doc_id:t},...r&&{object_id:r}},{content:{message:"Document successfully created",doc_id:t,object_id:r,doc_url:i,doc_name:e.doc_name}}):{content:`Document ${t} created, but failed to add markdown content: ${d||"Unknown error"}`}}catch(e){return{content:`Error creating document: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends bi{constructor(){super(...arguments),this.name="add_content_to_doc",this.type=xr.WRITE,this.annotations=yi({title:"Add Content to Document",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Add markdown content to an existing monday.com document.\n\nIDENTIFICATION: Provide either doc_id or object_id to identify the document:\n- doc_id: The document ID (the id field returned by read_docs). Takes priority if both provided.\n- object_id: The document object ID (the object_id field from read_docs, also visible in the document URL). Will be resolved to a doc_id.\n\nUSAGE EXAMPLES:\n- By doc_id: { doc_id: "123", markdown: "# New Section\\nContent here" }\n- By object_id: { object_id: "456", markdown: "# New Section\\nContent here" }\n- Insert after block: { doc_id: "123", markdown: "Inserted content", after_block_id: "block_789" }'}getInputSchema(){return Bv}async executeInternal(e){if(!e.doc_id&&!e.object_id)return{content:"Error: Either doc_id or object_id must be provided."};try{let t=null;if(e.doc_id){const a=await this.mondayApi.request(Mv,{docId:[e.doc_id]});t=a.docs?.[0]??null}else{const a=await this.mondayApi.request(Uv,{objectId:[e.object_id]});t=a.docs?.[0]??null}if(!t){return{content:`Error: No document found for ${e.doc_id?`doc_id ${e.doc_id}`:`object_id ${e.object_id}`}.`}}this.sessionContext.metadata={...this.sessionContext.metadata,doc_id:t.id,...e.object_id&&{object_id:e.object_id}};const a={docId:t.id,markdown:e.markdown,afterBlockId:e.after_block_id},r=await this.mondayApi.request(jv,a);if(!r?.add_content_to_doc_from_markdown)return{content:"Error: Failed to add content to document — no response from API."};const{success:i,block_ids:o,error:n}=r.add_content_to_doc_from_markdown;if(!i)return{content:`Error adding content to document: ${n||"Unknown error"}`};const s=o?.length??0;return{content:{message:`Successfully added content to document ${t.id}. ${s} block${1===s?"":"s"} created.`,doc_id:t.id,block_ids:o,doc_name:t.name,doc_url:t.url}}}catch(e){return{content:`Error adding content to document: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends bi{constructor(){super(...arguments),this.name="update_doc",this.type=xr.WRITE,this.annotations=yi({title:"Update Document",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return'Update an existing monday.com document. Provide doc_id (preferred) or object_id, plus an ordered operations array (executed sequentially, stops on first failure).\n\nOPERATIONS:\n- set_name: Rename the document.\n- add_markdown_content: Append markdown as blocks (or insert after a block). Best for text, headings, lists, simple tables — no block IDs needed.\n- update_block: Update content of an existing text, code, or list_item block in-place.\n- create_block: Create a new block at a precise position. Use parent_block_id to nest inside notice_box, table cell, or layout cell.\n- delete_block: Remove any block. The ONLY option for BOARD, WIDGET, DOC embed, and GIPHY blocks.\n- replace_block: Delete a block and create a new one in its place (use when update_block is not supported).\n- add_comment: Create a new comment or reply on the document (doc-level, block-level, or text-selection).\n\nWHEN TO USE EACH OPERATION:\n- text / code / list_item → update_block. Use replace_block to change subtype (e.g. NORMAL_TEXT→LARGE_TITLE)\n- divider / table / image / video / notice_box / layout → replace_block (properties immutable after creation)\n- BOARD / WIDGET / DOC / GIPHY → delete_block only\n\nGETTING BLOCK IDs: Call read_docs with include_blocks: true — returns id, type, position, and content per block.\n\nBLOCK CONTENT (delta_format): Array of insert ops. Last op MUST be {insert: {text: "\\n"}}.\n- Plain: [{insert: {text: "Hello"}}, {insert: {text: "\\n"}}]\n- Bold: [{insert: {text: "Hi"}, attributes: {bold: true}}, {insert: {text: "\\n"}}]\n- Mention user/doc/board: [{insert: {text: "Hey "}}, {insert: {mention: {id: 12345, type: "USER"}}}, {insert: {text: "\\n"}}] — type is USER, DOC, or BOARD. id is numeric (user IDs from list_users_and_teams)\n- Inline column value: [{insert: {column_value: {item_id: 111, column_id: "status"}}}, {insert: {text: "\\n"}}]\n- Supported attributes: bold, italic, underline, strike, code, link, color, background (not applicable to mention/column_value ops)\n\nIMAGE WITH ASSET: For asset-based images, use create_block with block_type "image" and asset_id (instead of public_url). add_markdown_content does NOT support asset images — for mixed content, alternate add_markdown_content (text) and create_block (image) operations in sequence.\n\nCOMMENTS:\n- add_comment: Create a new comment or reply on the document. Three scopes:\n - Doc-level (no block_id): comment appears on the doc as a whole.\n - Block-level (block_id only): comment is anchored to a specific block. The block shows a comment indicator in the UI.\n - Text-selection (block_id + selection_from + selection_length): comment is anchored to a specific character range inside a text/code/list_item block. That text is highlighted with a comment marker.\n Block-level and text-selection comments only work on blocks with text content (text, code, list_item, title, quote). They do NOT work on: divider, page_break, table, layout, notice_box, image, video, or giphy blocks.\n Get block IDs from read_docs with include_blocks: true. Format body with HTML, not markdown. Use mentions_list for @mentions.'}getInputSchema(){return P_}async executeInternal(e){if(!e.doc_id&&!e.object_id)return{content:"Error: Either doc_id or object_id must be provided."};this.sessionContext.metadata={...this.sessionContext.metadata,operation_types:e.operations?.map((e=>e.operation_type)),operation_count:e.operations?.length??0,...e.object_id&&{object_id:e.object_id}};try{let t=e.doc_id;if(!t){const a=await this.mondayApi.request(Gv,{objectId:[e.object_id]}),r=a.docs?.[0];if(!r)return{content:`Error: No document found for object_id ${e.object_id}.`};t=r.id}const a=[];let r=null;for(let i=0;i<e.operations.length;i++){const o=e.operations[i];try{const r=await this.executeOperation(t,o,e.object_id);a.push(`- [OK] ${o.operation_type}${r?`: ${r}`:""}`)}catch(e){const t=e instanceof Error?e.message:"Unknown error";a.push(`- [FAILED] ${o.operation_type}: ${t}`),r=i;break}}const i=null!==r?r:e.operations.length,o=e.operations.length,n=`Completed ${i}/${o} operation${1===o?"":"s"} on doc ${t}.`;return this.sessionContext.metadata={...this.sessionContext.metadata,doc_id:t},{content:`${n}\n\nResults:\n${a.join("\n")}\n\nDoc ID: ${t}`}}catch(e){return{content:`Error: ${e instanceof Error?e.message:String(e)}`}}}async executeOperation(e,t,a){switch(t.operation_type){case"set_name":return this.executeSetName(e,t.name);case"add_markdown_content":return this.executeAddMarkdown(e,t.markdown,t.after_block_id);case"update_block":return this.executeUpdateBlock(t.block_id,t.content);case"create_block":return this.executeCreateBlock(e,t.block,t.after_block_id,t.parent_block_id);case"delete_block":return this.executeDeleteBlock(t.block_id);case"replace_block":return this.executeReplaceBlock(e,t.block_id,t.block,t.after_block_id,t.parent_block_id);case"add_comment":return this.executeAddComment(e,a,t.body,t.parent_update_id,t.mentions_list,t.block_id,t.selection_from,t.selection_length);default:{const e=t.operation_type;throw new Error(`Unsupported operation type: "${e}"`)}}}async executeSetName(e,t){const a={docId:e,name:t},r=await this.mondayApi.request(qv,a);if(!r?.update_doc_name)throw new Error(`No confirmation from update_doc_name — rename to "${t}" may not have applied`);return`Renamed to "${t}"`}async executeAddMarkdown(e,t,a){if(!t.trim())throw new Error("markdown must not be empty");const r={docId:e,markdown:t,afterBlockId:a},i=await this.mondayApi.request(Hv,r),o=i?.add_content_to_doc_from_markdown;if(!o?.success)throw new Error(o?.error||"Failed to add markdown content");const n=o.block_ids?.length??0;return`${n} block${1===n?"":"s"} added${o.block_ids?.length?`. Block IDs: ${o.block_ids.join(", ")}`:""}`}async executeUpdateBlock(e,t){const a=function(e){switch(e.block_content_type){case"text":return{deltaFormat:r_(e.delta_format),alignment:e.alignment,direction:e.direction};case"code":return{deltaFormat:r_(e.delta_format),language:e.language};case"list_item":return{deltaFormat:r_(e.delta_format),checked:e.checked,indentation:e.indentation};default:{const t=e.block_content_type;throw new Error(`Unsupported block_content_type: "${t}"`)}}}(t),r={blockId:e,content:JSON.stringify(a)},i=await this.mondayApi.request(Wv,r);if(!i?.update_doc_block)throw new Error("No response from update_doc_block");return`Block ${e} updated`}async executeCreateBlock(e,t,a,r){const i=function(e){switch(e.block_type){case"text":return{text_block:{delta_format:a_(e.delta_format),text_block_type:e.text_block_type?e.text_block_type:void 0,alignment:Zv(e.alignment),direction:e_(e.direction)}};case"list_item":return{list_block:{delta_format:a_(e.delta_format),list_block_type:e.list_block_type?e.list_block_type:void 0,indentation:e.indentation}};case"code":return{text_block:{delta_format:a_(e.delta_format),text_block_type:Pl.Code}};case"divider":return{divider_block:{}};case"page_break":return{page_break_block:{}};case"image":if(null==e.asset_id&&!e.public_url)throw new Error("image block requires either asset_id or public_url");return{image_block:null!=e.asset_id?{asset_id:String(e.asset_id),width:e.width}:{public_url:e.public_url,width:e.width}};case"video":return{video_block:{raw_url:e.raw_url,width:e.width}};case"notice_box":return{notice_box_block:{theme:e.theme}};case"table":return{table_block:{row_count:e.row_count,column_count:e.column_count,width:e.width,column_style:e.column_style?.map((e=>({width:e.width})))}};case"layout":return{layout_block:{column_count:e.column_count,column_style:e.column_style?.map((e=>({width:e.width})))}};default:{const t=e.block_type;throw new Error(`Unsupported block_type: "${t}"`)}}}(t);if(r){const e=Object.keys(i);if(1!==e.length)throw new Error(`Cannot inject parent_block_id: expected exactly 1 key in block input, got: ${e.join(", ")}`);const t=e[0],a=i[t];if(!a||"object"!=typeof a)throw new Error(`Cannot inject parent_block_id into block type "${t}" — block value is not an object`);a.parent_block_id=r}const o={docId:e,afterBlockId:a,blocksInput:[i]},n=await this.mondayApi.request(Xv,o),s=n?.create_doc_blocks;if(!s||0===s.length)throw new Error("No blocks returned from create_doc_blocks");return`Block created (ID: ${s.map((e=>e.id)).join(", ")})`}async executeDeleteBlock(e){const t={blockId:e},a=await this.mondayApi.request(Qv,t);if(!a?.delete_doc_block)throw new Error("No response from delete_doc_block");return`Block ${e} deleted`}async resolveObjectId(e,t){if(t)return t;const a=await this.mondayApi.request(zv,{docId:[e]}),r=a.docs?.[0];if(!r?.object_id)throw new Error(`Could not resolve object_id for doc ${e}`);return r.object_id}async resolveDocItemId(e){const t=await this.mondayApi.request(Yv,{boardId:e}),a=t.boards?.[0]?.items_page?.items?.[0]?.id;if(!a)throw new Error(`No item found on the document backing board (object_id: ${e})`);return a}async fetchAllBlockContent(e){const t=await this.mondayApi.request(Kv,{docId:[e]});return(t.docs?.[0]?.blocks??[]).filter((e=>null!=e)).map((t=>{let a;if("string"==typeof t.content)try{a=JSON.parse(t.content)}catch{throw new Error(`Failed to parse content of block ${t.id} in doc ${e} as JSON`)}else a=t.content??{};return{id:t.id??"",type:t.type??"",content:a}}))}async executeAddComment(e,t,a,r,i,o,n,s){if((null!=n||null!=s)&&!o)throw new Error("selection_from and selection_length require block_id");if(null!=n!=(null!=s))throw new Error("selection_from and selection_length must both be provided together");const d=o?Array.isArray(o)?o:[o]:[];if((null!=n||null!=s)&&d.length>1)throw new Error("selection_from and selection_length are only supported with a single block_id");const p=await this.resolveObjectId(e,t),l=await this.resolveDocItemId(p);let m;if(i){const e=JSON.parse(i),t=hf.safeParse(e);if(!t.success)throw new Error(`Invalid mentions_list format: ${t.error.message}`);m=t.data}const c={itemId:l,body:a,parentId:r?.toString(),mentionsList:m},u=await this.mondayApi.request(Jv,c);if(!u.create_update?.id)throw new Error("Failed to create comment: no update returned");const h=u.create_update.id,f=Number(h),v=r?`Reply to update ${r}`:"Comment";if(d.length>0){if(Number.isNaN(f))throw new Error(`${v} created (update ID: ${h}) but block annotation aborted: comment ID is not numeric and cannot be used as a delta reference`);const t=await this.fetchAllBlockContent(e);for(const a of d){const r=t.find((e=>e.id===a));if(!r)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: block ${a} not found in doc ${e}`);const i=r.content.deltaFormat;if(!i)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: block ${a} has no deltaFormat — only text, code, and list_item blocks are supported`);let o=0;for(const e of i)o+="string"==typeof e.insert?e.insert.length:1;if(0===o)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: block ${a} has an empty deltaFormat and cannot be annotated`);const d=n??0,p=s??o;if(d+p>o)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: selection [${d}, ${d+p}) is out of range for block ${a} (total length ${o})`);let l;try{l=o_(i,f,d,p)}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`${v} created (update ID: ${h}) but delta annotation failed for block ${a}: ${t}`)}const m={...r.content,deltaFormat:l},c=await this.mondayApi.request(Wv,{blockId:a,content:JSON.stringify(m)});if(!c?.update_doc_block)throw new Error(`${v} created (update ID: ${h}) but block annotation write returned no confirmation for block ${a}`)}}const _=d.length;return`${v} created${_>1?` across ${_} blocks`:1===_?" on block":""} (update ID: ${h})`}async executeReplaceBlock(e,t,a,r,i){await this.executeDeleteBlock(t);try{return`Block ${t} replaced. ${await this.executeCreateBlock(e,a,r,i)}`}catch(e){const a=e instanceof Error?e.message:String(e);throw new Error(`Original block ${t} was deleted, but replacement creation failed: ${a}. The original block is gone.`)}}},class extends bi{constructor(){super(...arguments),this.name="update_workspace",this.type=xr.WRITE,this.annotations=yi({title:"Update Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing workspace in monday.com"}getInputSchema(){return U_}async executeInternal(e){const t={id:e.id,attributes:{account_product_id:e.attributeAccountProductId,description:e.attributeDescription,kind:e.attributeKind,name:e.attributeName}},a=await this.mondayApi.request(j_,t),r=await _v(this.mondayApi),i=r?gv(r,a.update_workspace?.id):void 0;return{content:{message:`Workspace ${a.update_workspace?.id} updated`,workspace_id:a.update_workspace?.id,workspace_name:a.update_workspace?.name,workspace_url:i}}}},class extends bi{constructor(){super(...arguments),this.name="update_folder",this.type=xr.WRITE,this.annotations=yi({title:"Update Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing folder in monday.com"}getInputSchema(){return B_}async executeInternal(e){const{position_object_id:t,position_object_type:a,position_is_after:r}=e;if(!!t!=!!a)throw new Error("position_object_id and position_object_type must be provided together");const i={folderId:e.folderId,name:e.name,color:e.color,fontWeight:e.fontWeight,customIcon:e.customIcon,parentFolderId:e.parentFolderId,workspaceId:e.workspaceId,accountProductId:e.accountProductId,position:t?{position_is_after:r,position_object_id:t,position_object_type:a}:void 0},o=await this.mondayApi.request(M_,i);return{content:{message:`Folder ${o.update_folder?.id} updated`,folder_id:o.update_folder?.id,folder_name:o.update_folder?.name}}}},class extends bi{constructor(){super(...arguments),this.name="create_workspace",this.type=xr.WRITE,this.annotations=yi({title:"Create Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new workspace in monday.com"}getInputSchema(){return H_}async executeInternal(e){const t={name:e.name,workspaceKind:e.workspaceKind,description:e.description,accountProductId:e.accountProductId},a=await this.mondayApi.request(q_,t),r=await _v(this.mondayApi),i=r&&a.create_workspace?.id?gv(r,a.create_workspace.id):void 0;return{content:{message:`Workspace ${a.create_workspace?.id} successfully created`,workspace_id:a.create_workspace?.id,workspace_name:a.create_workspace?.name,workspace_url:i}}}},class extends bi{constructor(){super(...arguments),this.name="create_folder",this.type=xr.WRITE,this.annotations=yi({title:"Create Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new folder in a monday.com workspace"}getInputSchema(){return W_}async executeInternal(e){const t={workspaceId:e.workspaceId,name:e.name,color:e.color,fontWeight:e.fontWeight,customIcon:e.customIcon,parentFolderId:e.parentFolderId},a=await this.mondayApi.request(G_,t);return{content:{message:`Folder ${a.create_folder?.id} successfully created`,folder_id:a.create_folder?.id,folder_name:a.create_folder?.name}}}},class extends bi{constructor(){super(...arguments),this.name="move_object",this.type=xr.WRITE,this.annotations=yi({title:"Move Object",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Move a folder, board, or overview in monday.com. Use position for relative placement based on another object, parentFolderId for folder changes, workspaceId for workspace moves, and accountProductId for account product changes."}getInputSchema(){return Y_}async executeUpdateFolder(e){const{id:t,position_object_id:a,position_object_type:r,position_is_after:i,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!r)throw new Error("position_object_id and position_object_type must be provided together");const d={folderId:t,position:a?{position_is_after:i,position_object_id:a,position_object_type:r}:void 0,parentFolderId:o,workspaceId:n,accountProductId:s},p=await this.mondayApi.request(M_,d);return{content:{message:"Object moved",object_id:p.update_folder?.id}}}async executeUpdateBoardHierarchy(e){const{id:t,position_object_id:a,position_object_type:r,position_is_after:i,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!r)throw new Error("position_object_id and position_object_type must be provided together");const d={boardId:t,attributes:{position:a?{position_is_after:i,position_object_id:a,position_object_type:r}:void 0,folder_id:o,workspace_id:n,account_product_id:s}},p=await this.mondayApi.request(Q_,d);return p.update_board_hierarchy?.success?{content:{message:"Board position updated",object_id:p.update_board_hierarchy?.board?.id,action_name:"move_board"}}:{content:`Board position update failed: ${p.update_board_hierarchy?.message}`}}async executeUpdateOverviewHierarchy(e){const{id:t,position_object_id:a,position_object_type:r,position_is_after:i,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!r)throw new Error("position_object_id and position_object_type must be provided together");const d={overviewId:t,attributes:{position:a?{position_is_after:i,position_object_id:a,position_object_type:r}:void 0,folder_id:o,workspace_id:n,account_product_id:s}},p=await this.mondayApi.request(z_,d);return p.update_overview_hierarchy?.success?{content:{message:"Overview position updated",object_id:p.update_overview_hierarchy?.overview?.id}}:{content:`Overview position update failed: ${p.update_overview_hierarchy?.message}`}}async executeInternal(e){const{objectType:t}=e;switch(t){case sl.Folder:return this.executeUpdateFolder(e);case sl.Board:return this.executeUpdateBoardHierarchy(e);case sl.Overview:return this.executeUpdateOverviewHierarchy(e);default:throw new Error(`Unsupported object type: ${t}`)}}},class extends bi{constructor(){super(...arguments),this.name="create_dashboard",this.type=xr.WRITE,this.annotations=yi({title:"Create Dashboard",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Use this tool to create a new monday.com dashboard that aggregates data from one or more boards. \n Dashboards provide visual representations of board data through widgets and charts.\n \n Use this tool when users want to:\n - Create a dashboard to visualize board data\n - Aggregate information from multiple boards\n - Set up a data visualization container for widgets"}getInputSchema(){return L_}async executeInternal(e){try{const t={name:e.name,workspace_id:e.workspace_id.toString(),board_ids:e.board_ids,kind:e.kind,board_folder_id:e.board_folder_id?.toString()},a=await this.mondayApi.request(C_,t);if(!a.create_dashboard)throw new Error("Failed to create dashboard");const r=a.create_dashboard;return{content:{message:`Dashboard ${r.id} successfully created`,dashboard_id:r.id,dashboard_name:r.name}}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to create dashboard: ${t}`)}}},class extends bi{constructor(){super(...arguments),this.name="all_widgets_schema",this.type=xr.READ,this.annotations=yi({title:"Get All Widget Schemas",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch complete JSON Schema 7 definitions for all available widget types in monday.com.\n \n This tool is essential before creating widgets as it provides:\n - Complete schema definitions for all supported widgets\n - Required and optional fields for each widget type\n - Data type specifications and validation rules\n - Detailed descriptions of widget capabilities\n \n Use this tool when you need to:\n - Understand widget configuration requirements before creating widgets\n - Validate widget settings against official schemas\n - Plan widget implementations with proper data structures\n \n The response includes JSON Schema 7 definitions that describe exactly what settings each widget type accepts."}getInputSchema(){return{}}async executeInternal(){try{const e={},t=await this.mondayApi.request(x_,e);if(!t.all_widgets_schema||0===t.all_widgets_schema.length)throw new Error("No widget schemas found - API returned empty response");const a={};let r=0;for(const e of t.all_widgets_schema)if(e?.widget_type&&e?.schema){const t="string"==typeof e.schema?JSON.parse(e.schema):e.schema,i=t?.description||t?.title||`${e.widget_type} widget for data visualization`;a[e.widget_type]={type:e.widget_type,description:i,schema:e.schema},r++}if(0===r)throw new Error("No valid widget schemas found in API response");Object.keys(a).map((e=>`• **${e}**: ${a[e].description}`)).join("\n");return{content:{message:"Widgets schema",data:a,url:Gf}}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to fetch widget schemas: ${t}`)}}},class extends bi{constructor(){super(...arguments),this.name="create_widget",this.type=xr.WRITE,this.annotations=yi({title:"Create Widget",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new widget in a dashboard or board view with specific configuration settings.\n \n This tool creates data visualization widgets that display information from monday.com boards:\n **Parent Containers:**\n - **DASHBOARD**: Place widget in a dashboard (most common use case)\n - **BOARD_VIEW**: Place widget in a specific board view\n \n **Critical Requirements:**\n 1. **Schema Compliance**: Widget settings MUST conform to the JSON schema for the specific widget type\n 2. **Use all_widgets_schema first**: Always fetch widget schemas before creating widgets\n 3. **Validate settings**: Ensure all required fields are provided and data types match\n \n **Workflow:**\n 1. Use 'all_widgets_schema' to get schema definitions\n 2. Prepare widget settings according to the schema\n 3. Use this tool to create the widget"}getInputSchema(){return V_}async executeInternal(e){if(!e.settings)throw new Error("You must pass the settings parameter");try{const t={parent:{kind:e.parent_container_type,id:e.parent_container_id.toString()},kind:e.widget_kind,name:e.widget_name,settings:e.settings},a=await this.mondayApi.request(F_,t);if(!a.create_widget)throw new Error("Failed to create widget");const r=a.create_widget;r.parent?.kind===Yl.Dashboard?r.parent.id:r.parent;return{content:{message:`Widget ${r.id} created`,widget_id:r.id,widget_name:r.name,dashboard_id:r.parent?.id}}}catch(t){const a=t instanceof Error?t.message:String(t);throw new Error(`Failed to create ${e.widget_kind} widget: ${a}`)}}},class extends bi{constructor(){super(...arguments),this.name="board_insights",this.type=xr.READ,this.annotations=yi({title:"Get Board Insights",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"This tool allows you to calculate insights about board's data by filtering, grouping and aggregating columns. For example, you can get the total number of items in a board, the number of items in each status, the number of items in each column, etc. Use this tool when you need to get a summary of the board's data, for example, you want to know the total number of items in a board, the number of items in each status, the number of items in each column, etc.[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 to understand the board metadata. This is essential for constructing proper filters and knowing which columns are available.[IMPORTANT]: For some columns, human-friendly label is returned inside 'LABEL_<column_id' field. E.g. for column with id 'status_123' the label is returned inside 'LABEL_status_123' field."}getInputSchema(){return tg}async executeInternal(e){if(!e.aggregations)return{content:'Input must contain the "aggregations" field.'};const{selectElements:t,groupByElements:a}=function(e){const t={},a=e.groupBy?.map((e=>({column_id:e})))||[],r=new Set(e.aggregations.filter((e=>e.function===Ad.Label)).map((e=>e.columnId))),i=e.groupBy?.filter((e=>!r.has(e))).map((e=>({function:Ad.Label,columnId:e})))??[],o=e.aggregations.concat(i).map((e=>{if(e.function){const o=`${e.function}_${e.columnId}`,n=t[o]||0;t[o]=n+1;const s=`${o}_${n}`;return Z_.has(e.function)&&(a.some((e=>e.column_id===s))||a.push({column_id:s})),{type:Nd.Function,function:(r=e.function,i=e.columnId,{function:r,params:r===Ad.CountItems?[]:[{type:Nd.Column,column:eg(i),as:i}]}),as:s}}var r,i;const o={type:Nd.Column,column:eg(e.columnId),as:e.columnId};return a.some((t=>t.column_id===e.columnId))||a.push({column_id:e.columnId}),o}));return a.forEach((e=>{o.some((t=>t.as===e.column_id))||o.push({type:Nd.Column,column:eg(e.column_id),as:e.column_id})})),{selectElements:o,groupByElements:a}}(e),r=function(e){if(!e.filters&&!e.orderBy)return;const t={};return e.filters&&(t.rules=e.filters.map((e=>({column_id:e.columnId,compare_value:e.compareValue,operator:e.operator,compare_attribute:e.compareAttribute}))),t.operator=e.filtersOperator),e.orderBy&&(t.order_by=function(e){return e.orderBy?.map((e=>({column_id:e.columnId,direction:e.direction})))}(e)),t}(e),i=function(e){return{id:e.boardId.toString(),type:Dd.Table}}(e),o={query:{from:i,query:r,select:t,group_by:a,limit:e.limit},boardId:String(e.boardId)},n=await this.mondayApi.request(K_,o),s=(n.aggregate?.results??[]).map((e=>{const t={};return(e.entries??[]).forEach((e=>{const a=e.alias??"";if(!a)return;const r=e.value;if(!r)return void(t[a]=null);const i=r.result??r.value??null;t[a]=i})),t}));return s.length?{content:{message:"Board insights retrieved",board_name:n.boards?.[0]?.name,board_url:n.boards?.[0]?.url,data:s}}:{content:"No board insights found for the given query."}}},class extends bi{constructor(){super(...arguments),this.name="search",this.type=xr.READ,this.annotations=yi({title:"Search",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Search within monday.com platform. Can search for boards, documents, forms, folders.\nFor users and teams, use list_users_and_teams tool.\nFor workspaces, use list_workspaces tool.\nFor items and groups, use get_board_items_page tool.\nFor groups, use get_board_info tool.\nIMPORTANT: ids returned by this tool are prefixed with the type of the object (e.g doc-123, board-456, folder-789). When passing the ids to other tools, you need to remove the prefix and just pass the number.\n "}getInputSchema(){return pg}async executeInternal(e){if(e.searchType!==dg.FOLDERS&&e.searchTerm)try{return{content:{message:"Search results",data:(await this.searchWithDevEndpointAsync(e)).items}}}catch(e){Mh(e)}const t={[dg.BOARD]:this.searchBoardsAsync.bind(this),[dg.DOCUMENTS]:this.searchDocsAsync.bind(this),[dg.FOLDERS]:this.searchFoldersAsync.bind(this)}[e.searchType];if(!t)throw new Error(`Unsupported search type: ${e.searchType}`);const a=await t(e);return{content:{message:"Search results",disclaimer:a.wasFiltered||!e.searchTerm?void 0:"[IMPORTANT]Items were not filtered. Please perform the filtering.",data:a.items}}}async searchWithDevEndpointAsync(e){if(e.page>1)throw new Error("Pagination is not supported for search, increase the limit parameter instead");const t=e.workspaceIds?.map((e=>e.toString()));if(e.searchType===dg.BOARD)return this.searchBoardsWithDevEndpointAsync(e.searchTerm,e.limit,t);if(e.searchType===dg.DOCUMENTS)return this.searchDocsWithDevEndpointAsync(e.searchTerm,e.limit,t);throw new Error(`Unsupported search type for dev endpoint: ${e.searchType}`)}async searchBoardsWithDevEndpointAsync(e,t,a){const r={query:e,limit:t,workspaceIds:a};return{items:(await this.mondayApi.request(og,r,{versionOverride:"dev",timeout:jh})).search.boards.results.map((e=>({id:sg.BOARD+e.indexed_data.id,title:e.indexed_data.name,url:e.indexed_data.url}))),wasFiltered:!0}}async searchDocsWithDevEndpointAsync(e,t,a){const r={query:e,limit:t,workspaceIds:a};return{items:(await this.mondayApi.request(ng,r,{versionOverride:"dev",timeout:jh})).search.docs.results.map((e=>({id:sg.DOCUMENT+e.indexed_data.id,title:e.indexed_data.name}))),wasFiltered:!0}}async searchFoldersAsync(e){const t={...this.getPagingParamsForSearch(e,100),workspace_ids:e.workspaceIds?.map((e=>e.toString()))};t.workspace_ids??=[],0===t.workspace_ids.length&&Uh(new Error("Searching for folders require specifying workspace ids"),"search folders");const a=await this.mondayApi.request(ig,t),r=this.searchAndVirtuallyPaginate(e,a.folders||[],(e=>e.name));return{items:r.items.map((e=>({id:sg.FOLDER+e.id,title:e.name}))),wasFiltered:r.wasFiltered}}async searchDocsAsync(e){const t={...this.getPagingParamsForSearch(e),workspace_ids:e.workspaceIds?.map((e=>e.toString()))},a=await this.mondayApi.request(rg,t),r=this.searchAndVirtuallyPaginate(e,a.docs||[],(e=>e.name));return{items:r.items.map((e=>({id:sg.DOCUMENT+e.id,title:e.name,url:e.url||void 0}))),wasFiltered:r.wasFiltered}}async searchBoardsAsync(e){const t={...this.getPagingParamsForSearch(e),workspace_ids:e.workspaceIds?.map((e=>e.toString()))},a=await this.mondayApi.request(ag,t),r=this.searchAndVirtuallyPaginate(e,a.boards||[],(e=>e.name));return{items:r.items.map((e=>({id:sg.BOARD+e.id,title:e.name,url:e.url}))),wasFiltered:r.wasFiltered}}getPagingParamsForSearch(e,t=1e3){return{page:e.searchTerm?1:e.page,limit:e.searchTerm?Math.min(1e3,t):e.limit}}searchAndVirtuallyPaginate(e,t,a){if(t.length<=20)return{items:t,wasFiltered:!1};const r=Av(e.searchTerm??""),i=(e.page-1)*e.limit,o=i+e.limit;return{items:t.filter((e=>Av(a(e)).includes(r))).slice(i,o),wasFiltered:!0}}},class extends bi{constructor(){super(...arguments),this.name="get_user_context",this.type=xr.READ,this.annotations=yi({title:"Get User Context",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch current user information and their relevant items (boards, folders, workspaces, dashboards).\n \n Use this tool at the beginning of conversations to:\n - Get context about who the current user is (id, name, title)\n - Discover user's favorite boards, folders, workspaces, and dashboards\n - Get user's most relevant boards based on visit frequency and recency\n - Get user's most relevant people based on interaction frequency and recency\n - Reduce the need for search requests by knowing user's commonly accessed items\n "}getInputSchema(){}async executeInternal(){const{me:e,favorites:t,intelligence:a}=await this.mondayApi.request(gg,{},{versionOverride:"dev"});if(!e)return{content:"AUTHENTICATION_ERROR: Unable to fetch current user. Verify API token and user permissions."};return{content:{message:"User context",...{user:e,favorites:await this.fetchFavorites(t||[]),relevantBoards:this.extractRelevantBoards(a),relevantPeople:this.extractRelevantPeople(a)}}}}async fetchFavorites(e){const t=this.groupByType(e),a=Object.keys(t);if(0===a.length)return[];const r={};for(const e of a)r[bg[e]]=t[e];const i=await this.mondayApi.request(yg,r),o=[];for(const e of a){const t=wg[e];for(const a of i[t]??[])a?.id&&o.push({id:a.id,name:a.name,type:e})}return o}extractRelevantBoards(e){if(!e?.relevant_boards)return[];const t=[];for(const a of e.relevant_boards)a?.id&&a?.board?.name&&t.push({id:a.id,name:a.board.name});return t}extractRelevantPeople(e){if(!e?.relevant_people)return[];const t=[];for(const a of e.relevant_people)a?.id&&a?.user?.name&&t.push({id:a.id,name:a.user.name});return t}groupByType(e){const t={};for(const a of e){const e=a?.object;e?.id&&e?.type&&(t[e.type]??=[]).push(e.id)}return t}},class extends bi{constructor(){super(...arguments),this.name="update_assets_on_item",this.type=xr.WRITE,this.annotations=yi({title:"Update Assets On Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update a file or doc column value on an item using existing assets, docs, or links. Sets the column to the provided list of files, adding new ones and removing any not in the list."}getInputSchema(){return fg}async executeInternal(e){const t={boardId:e.boardId,itemId:e.itemId,columnId:e.columnId,files:e.files},a=await this.mondayApi.request(ug,t);return{content:`Item ${a.update_assets_on_item?.id} (${a.update_assets_on_item?.name}) assets successfully updated`}}},class extends bi{constructor(){super(...arguments),this.name="get_assets",this.type=xr.READ,this.annotations=yi({title:"Get Assets",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get assets (files) by their IDs. Returns file metadata including name, extension, size, public URL (valid for 1 hour), thumbnail URL, upload date, and who uploaded it."}getInputSchema(){return _g}async executeInternal(e){const t=await this.mondayApi.request(vg,{ids:e.ids}),a=t.assets?.filter(Boolean);if(!a||0===a.length)return{content:`No assets found for the provided IDs: ${e.ids.join(", ")}`};return{content:{results:a.map((e=>({id:e.id,name:e.name,file_extension:e.file_extension,file_size:e.file_size,public_url:e.public_url,url:e.url,url_thumbnail:e.url_thumbnail??null,created_at:e.created_at??null,original_geometry:e.original_geometry??null,uploaded_by:e.uploaded_by})))}}}},class extends bi{constructor(){super(...arguments),this.name="get_notetaker_meetings",this.type=xr.READ,this.annotations=yi({title:"Get Notetaker Meetings",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Retrieve notetaker meetings with optional detailed fields. Use include_summary, include_topics, include_action_items, and include_transcript flags to control which details are returned. Use access to filter by meeting access level (OWN, SHARED_WITH_ME, SHARED_WITH_ACCOUNT, ALL). Defaults to OWN. Supports filtering by ids, search term, and cursor-based pagination."}getInputSchema(){return Tg}async executeInternal(e){const t={access:e.access};e.ids&&e.ids.length>0&&(t.ids=e.ids),e.search&&(t.search=e.search);const a={limit:e.limit,cursor:e.cursor||void 0,filters:t,includeSummary:e.include_summary,includeTopics:e.include_topics,includeActionItems:e.include_action_items,includeTranscript:e.include_transcript},r=await this.mondayApi.request(Ig,a,{versionOverride:"2026-04"}),i=r.notetaker?.meetings;if(!i?.meetings||0===i.meetings.length)return{content:"No notetaker meetings found matching the specified criteria."};return{content:{message:"Meetings retrieved",data:{meetings:i.meetings,pagination:{has_next_page:i.page_info?.has_next_page??!1,cursor:i.page_info?.cursor??null,count:i.meetings.length}}}}}},class extends bi{constructor(){super(...arguments),this.name="create_view",this.type=xr.WRITE,this.annotations=yi({title:"Create View",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a new board view (tab) with optional filters and sorting. This creates a saved view on a monday.com board that users can switch to.\n\nFilter operators: any_of, not_any_of, is_empty, is_not_empty, greater_than, lower_than, between, contains_text, not_contains_text\n\nExample filter for people column: { "rules": [{ "column_id": "people", "compare_value": ["person-12345"], "operator": "any_of" }] }\nExample filter for status column: { "rules": [{ "column_id": "status", "compare_value": [1], "operator": "any_of" }] }'}getInputSchema(){return uu}async executeInternal(e){const t={boardId:e.boardId,type:e.type,name:e.name,filter:e.filter,sort:e.sort},a=await this.mondayApi.request(cu,t);return a.create_view?{content:`View "${a.create_view.name}" (ID: ${a.create_view.id}, type: ${a.create_view.type}) successfully created`}:{content:"Failed to create view - no response from API"}}},class extends bi{constructor(){super(...arguments),this.name="undo_action",this.type=xr.WRITE,this.annotations=yi({title:"Undo Action",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Undo a previous action on a board using its action_record_uuid. Supports undoing column changes, deletes, archives, moves, duplicates, and more. Use get_board_activity with includeData=true to find the action_record_uuid."}getInputSchema(){return Sg}async executeInternal(e){return await this.mondayApi.request(Eg,{boardId:e.boardId.toString(),undoRecordId:e.undoRecordId},{versionOverride:"dev"}),{content:`Successfully undid action "${e.undoRecordId}" on board ${e.boardId}.`}}},class extends bi{constructor(){super(...arguments),this.name="get_object_schemas",this.type=xr.READ,this.annotations=yi({title:"Get Object Schemas",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Retrieve account-level object schemas by their IDs or names. Schemas define the structure and columns of boards. Provide ids or names to filter specific schemas. Omit both to list all schemas (paginated)."}getInputSchema(){return Gc}async executeInternal(e){const t={ids:e.ids,names:e.names,limit:e.limit,page:e.page,excludeCreatedByMonday:e.excludeCreatedByMonday},a=(await this.mondayApi.request(Hc,t)).get_object_schemas??[];return{content:{message:`Retrieved ${a.length} object schema(s)`,schemas:a}}}},class extends bi{constructor(){super(...arguments),this.name="create_object_schema",this.type=xr.WRITE,this.annotations=yi({title:"Create Object Schema",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new account-level object schema. Schemas define the structure and columns of boards."}getInputSchema(){return Qc}async executeInternal(e){const t={name:e.name,parentId:e.parentId,description:e.description},a=await this.mondayApi.request(Wc,t);return{content:{message:`Object schema "${a.create_object_schema?.name}" successfully created`,schema_id:a.create_object_schema?.id,schema_name:a.create_object_schema?.name,revision:a.create_object_schema?.revision}}}},class extends bi{constructor(){super(...arguments),this.name="update_object_schema",this.type=xr.WRITE,this.annotations=yi({title:"Update Object Schema",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Update an account-level object schema. Requires the current revision number for optimistic locking — retrieve it first via get_object_schemas."}getInputSchema(){return Yc}async executeInternal(e){const t={id:e.id,revision:e.revision,parentId:e.parentId,description:e.description},a=await this.mondayApi.request(zc,t);return{content:{message:`Object schema "${a.update_object_schema?.name}" successfully updated`,schema_id:a.update_object_schema?.id,schema_name:a.update_object_schema?.name,revision:a.update_object_schema?.revision}}}},class extends bi{constructor(){super(...arguments),this.name="delete_object_schema",this.type=xr.WRITE,this.annotations=yi({title:"Delete Object Schema",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete an account-level object schema. Only allowed when no boards are connected to the schema. Provide either id or name."}getInputSchema(){return Jc}async executeInternal(e){if(!e.id&&!e.name)throw new Error("Either id or name must be provided");const t={id:e.id,name:e.name},a=await this.mondayApi.request(Kc,t);return{content:{message:`Object schema "${a.delete_object_schema?.name}" successfully deleted`,schema_id:a.delete_object_schema?.id,schema_name:a.delete_object_schema?.name}}}},class extends bi{constructor(){super(...arguments),this.name="delete_object_schema_columns",this.type=xr.WRITE,this.annotations=yi({title:"Delete Object Schema Columns",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Permanently delete columns from an account-level object schema. Only allowed when no boards are connected to the schema. Use manage_object_schema_column with action=deactivate for a reversible alternative."}getInputSchema(){return Zc}async executeInternal(e){if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided");const t={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columnIds:e.columnIds},a=await this.mondayApi.request(Xc,t,{versionOverride:"dev"});return{content:{message:`${e.columnIds.length} column(s) successfully deleted from object schema "${a.delete_object_schema_columns?.name}"`,schema_id:a.delete_object_schema_columns?.id,schema_name:a.delete_object_schema_columns?.name,revision:a.delete_object_schema_columns?.revision}}}},class extends bi{constructor(){super(...arguments),this.name="manage_object_schema_board_connection",this.type=xr.WRITE,this.annotations=yi({title:"Manage Object Schema Board Connection",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Connect or detach a board from an account-level object schema. connect: attaches a board to an object schema so it inherits the schema column structure. detach: removes one or more boards from their object schema."}getInputSchema(){return au}async executeInternal(e){if("connect"===e.action){if(!e.boardId)throw new Error("boardId is required for action=connect");if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided for action=connect");const t={boardId:e.boardId,objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName},a=await this.mondayApi.request(eu,t);return{content:{message:"Board successfully connected to object schema",connection_id:a.connect_board_to_object_schema?.id,schema_id:a.connect_board_to_object_schema?.object_schema_id}}}{if(!e.boardIds?.length)throw new Error("boardIds is required for action=detach");const t={boardIds:e.boardIds},a=(await this.mondayApi.request(tu,t)).detach_boards_from_object_schema??[],r=a.filter((e=>e.success)).length,i=a.filter((e=>!e.success));return{content:{message:`${r} board(s) successfully detached`,results:a,...i.length>0&&{failures:i}}}}}},class extends bi{constructor(){super(...arguments),this.name="manage_object_schema_columns",this.type=xr.WRITE,this.annotations=yi({title:"Manage Object Schema Columns",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create or update columns on an account-level object schema. Column changes are propagated to all boards connected to the schema. create: adds new columns. Each column requires type and title. Call get_column_type_info first to understand valid defaults per column type. update: modifies existing columns. Each entry must include column_id. Only send the columns you want to modify — other columns are unaffected. Use opt_out_by_default=true to stop a column from being auto-added to boards (opt out), or opt_out_by_default=false to restore auto-adding (opt in)."}getInputSchema(){return du}async executeInternal(e){if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided");if("create"===e.action){const t=e.columns.map((e=>{const t=e;return{type:t.type,title:t.title,description:t.description,defaults:t.defaults,opt_out_by_default:t.opt_out_by_default,policy:{can_override:t.policy?.can_override??[],cannot_delete:t.policy?.cannot_delete??!1}}})),a={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columns:t},r=await this.mondayApi.request(ru,a);return{content:{message:`Columns successfully added to object schema "${r.create_object_schema_columns?.name}"`,schema_id:r.create_object_schema_columns?.id,schema_name:r.create_object_schema_columns?.name,revision:r.create_object_schema_columns?.revision}}}{const t={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columns:e.columns.map((e=>{const t=e;return{column_id:t.column_id,title:t.title,description:t.description,defaults:t.defaults,opt_out_by_default:t.opt_out_by_default,policy:t.policy?{can_override:t.policy.can_override??[],cannot_delete:t.policy.cannot_delete??!1}:void 0}}))},a=await this.mondayApi.request(iu,t);return{content:{message:`Columns successfully updated on object schema "${a.update_object_schema_columns?.name}"`,schema_id:a.update_object_schema_columns?.id,schema_name:a.update_object_schema_columns?.name,revision:a.update_object_schema_columns?.revision}}}}},class extends bi{constructor(){super(...arguments),this.name="set_object_schema_column_active_state",this.type=xr.WRITE,this.annotations=yi({title:"Set Object Schema Column Active State",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Set the active state of a column on an account-level object schema. deactivate: soft-disables the column, preventing it from being used on new boards. The column is not deleted and can be restored. reactivate: restores a previously deactivated column, making it available again."}getInputSchema(){return lu}async executeInternal(e){if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided");const t={deactivate:ip.Deactivate,reactivate:ip.Reactivate},a={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columnId:e.columnId,action:t[e.action]},r=await this.mondayApi.request(pu,a);return{content:{message:`Column successfully ${e.action}d on object schema "${r.set_object_schema_column_active_state?.name}"`,schema_id:r.set_object_schema_column_active_state?.id,schema_name:r.set_object_schema_column_active_state?.name,revision:r.set_object_schema_column_active_state?.revision}}}}];var ny;!function(e){e.API="api",e.APPS="apps",e.ATP="atp"}(ny||(ny={}));const sy=(e,t)=>{let a=[];t?.mode===ny.APPS?a=[...gi]:t?.mode!==ny.API&&t?.mode||(a=[...oy,...iy]);const r=a.map((t=>((e,t)=>e.prototype instanceof bi?new e(t.apiClient,t.apiToken,t.context):e.prototype instanceof Kr?new e(t.apiToken):new e)(t,e)));return r.filter((e=>{if(!t)return e.type!==xr.ALL_API;if(t.mode===ny.API&&"only"===t.enableDynamicApiTools)return e.type===xr.ALL_API;let a=!1;return t.mode===ny.API&&!1===t.enableDynamicApiTools&&(a=a||e.type===xr.ALL_API),t.readOnlyMode&&(a=a||e.type!==xr.READ),t.include?a=a||!t.include?.includes(e.name):t.exclude&&(a=a||t.exclude?.includes(e.name)),!a}))};class dy{constructor(){this.dynamicTools=new Map}registerTool(e,t){const a=e.enabledByDefault??!0,r=a;this.dynamicTools.set(e.name,{instance:e,mcpTool:t,enabled:r,enabledByDefault:a}),a||t.disable()}enableTool(e){const t=this.dynamicTools.get(e);return!!t&&(t.enabled||(t.mcpTool.enable(),t.enabled=!0),!0)}disableTool(e){const t=this.dynamicTools.get(e);return!!t&&(t.enabled&&(t.mcpTool.disable(),t.enabled=!1),!0)}isToolEnabled(e){const t=this.dynamicTools.get(e);return!!t&&t.enabled}isToolEnabledByDefault(e){const t=this.dynamicTools.get(e);return!t||t.enabledByDefault}getToolsStatus(){const e={};return this.dynamicTools.forEach(((t,a)=>{e[a]=t.enabled})),e}getDynamicToolNames(){return Array.from(this.dynamicTools.keys())}getDetailedToolsStatus(){const e={};return this.dynamicTools.forEach(((t,a)=>{e[a]={enabled:t.enabled,enabledByDefault:t.enabledByDefault}})),e}resetToolToDefault(e){const t=this.dynamicTools.get(e);return!!t&&(t.enabledByDefault&&!t.enabled?(t.mcpTool.enable(),t.enabled=!0,!0):!(!t.enabledByDefault&&t.enabled)||(t.mcpTool.disable(),t.enabled=!1,!0))}getAllDynamicTools(){return this.dynamicTools}clear(){this.dynamicTools.clear()}}class py extends kr{constructor(e){super({name:"monday.com",version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),this.dynamicToolManager=new dy,this.toolInstances=[],this.managementTool=null,this.mondayApiClient=this.createApiClient(e),this.mondayApiToken=e.mondayApiToken,this.context={...e.context,apiVersion:e.mondayApiVersion??zr},this.registerTools(e)}createApiClient(e){return new r({token:e.mondayApiToken,apiVersion:e.mondayApiVersion??zr,endpoint:e.mondayApiEndpoint,requestConfig:{...e.mondayApiRequestConfig,headers:{...e.mondayApiRequestConfig?.headers||{},"user-agent":"monday-api-mcp"}}})}registerTools(e){try{this.toolInstances=this.initializeTools(e),this.toolInstances.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 Ng;e.setToolkitManager(this.dynamicToolManager),this.managementTool=e,this.registerSingleTool(this.managementTool)}initializeTools(e){const t={apiClient:this.mondayApiClient,apiToken:this.mondayApiToken,context:this.context};return sy(t,e.toolsConfiguration)}registerSingleTool(t){const a=t.getInputSchema(),r=this.registerTool(t.name,{...t,title:t.annotations?.title,description:t.getDescription(),inputSchema:a,annotations:t.annotations},(async(r,i)=>{try{let i;if(a){const o=e.object(a).safeParse(r);if(!o.success)throw new Error(`Invalid arguments: ${o.error.message}`);i=await t.execute(o.data)}else i=await t.execute();return this.formatToolResult(i.content)}catch(e){return this.handleToolError(e,t.name)}}));this.dynamicToolManager.registerTool(t,r)}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}getTools(e){const t=[...this.toolInstances];return this.managementTool&&t.push(this.managementTool),t.map((t=>({name:t.name,description:t.getDescription(),schema:this.getSchemaForTool(t,e),annotations:t.annotations,handler:this.createToolHandler(t)})))}getToolsForMcp(e){const t=[...this.toolInstances];return this.managementTool&&t.push(this.managementTool),t.map((t=>({name:t.name,description:t.getDescription(),schema:this.getSchemaForTool(t,e),annotations:t.annotations,handler:this.createMcpToolHandler(t)})))}createToolHandler(t){return async a=>{const r=t.getInputSchema();if(r){const i=e.object(r).safeParse(a);if(!i.success)throw new Error(`Invalid arguments: ${i.error.message}`);return(await t.execute(i.data)).content}return(await t.execute()).content}}createMcpToolHandler(t){return async(a,r)=>{try{const i=t.getInputSchema();if(i){const o=e.object(i).safeParse(a);if(!o.success)throw new Error(`Invalid arguments: ${o.error.message}`);const n=await t.execute(o.data,r);return this.formatToolResult(n.content)}{const e=await t.execute(void 0,r);return this.formatToolResult(e.content)}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}}}getSchemaForTool(t,r){const i=t.getInputSchema();if(i)return"json"===r?.schemaFormat?a(e.object(i)):i}formatToolResult(e){return"string"==typeof e?{content:[{type:"text",text:e}]}:{structuredContent:e,content:[{type:"text",text:JSON.stringify(e)}]}}handleToolError(e,t){return{content:[{type:"text",text:`Failed to execute tool ${t}: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}}export{dy as DynamicToolManager,py as MondayAgentToolkit};
|
|
2217
|
+
`),r=await this.mondayApi.request(a);return r.__type?{content:{message:"Type details retrieved",data:{name:r.__type.name,kind:r.__type.kind,description:r.__type.description??null,fields:r.__type.fields??[],inputFields:r.__type.inputFields??[],interfaces:r.__type.interfaces??[],enumValues:r.__type.enumValues??[],possibleTypes:r.__type.possibleTypes??[]}}}:{content:`Type '${e.typeName}' not found in the GraphQL schema. Please check the type name and try again.`}}catch(e){const t=e instanceof Error?e.message:"Unknown error",a=t.includes("JSON");return{content:`Error fetching type details: ${t}${a?"\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 t}},class extends bi{constructor(){super(...arguments),this.name="create_custom_activity",this.type=xr.WRITE,this.annotations=yi({title:"Create Custom Activity",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new custom activity in the E&A app"}getInputSchema(){return ef}async executeInternal(e){const t={color:e.color,icon_id:e.icon_id,name:e.name};return await this.mondayApi.request(Cc,t),{content:{message:`Custom activity '${e.name}' with color ${e.color} and icon ${e.icon_id} successfully created`,name:e.name,color:e.color,icon_id:e.icon_id}}}},class extends bi{constructor(){super(...arguments),this.name="create_notification",this.type=xr.WRITE,this.annotations=yi({title:"Create Notification",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Send a notification to a user via the bell icon and optionally by email. Use target_type "Post" for updates/replies or "Project" for items/boards.'}getInputSchema(){return af}async executeInternal(e){const t={user_id:e.user_id,target_id:e.target_id,text:e.text,target_type:e.target_type};try{await this.mondayApi.request(tf,t);return{content:{message:"Notification sent",user_id:e.user_id,text:e.text}}}catch(t){return{content:`Failed to send notification to user ${e.user_id}`}}}},class extends bi{constructor(){super(...arguments),this.name="create_timeline_item",this.type=xr.WRITE,this.annotations=yi({title:"Create Timeline Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new timeline item in the E&A app"}getInputSchema(){return mf}async executeInternal(e){const t={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&&(t.time_range={start_timestamp:e.start_timestamp,end_timestamp:e.end_timestamp});const a=await this.mondayApi.request(xc,t);return{content:{message:`Timeline item '${e.title}' with ID ${a.create_timeline_item?.id} successfully created on item ${e.item_id}`,timeline_item_id:a.create_timeline_item?.id,item_id:e.item_id,title:e.title}}}},class extends bi{constructor(){super(...arguments),this.name="fetch_custom_activity",this.type=xr.READ,this.annotations=yi({title:"Fetch Custom Activities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get custom activities from the E&A app"}getInputSchema(){return Ef}async executeInternal(e){const t=await this.mondayApi.request(Fc);if(!t.custom_activity||0===t.custom_activity.length)return{content:{message:"No custom activities found",data:[]}};const a=t.custom_activity.map((e=>({id:e.id,name:e.name,color:e.color,icon_id:e.icon_id,type:e.type})));return{content:{message:`Found ${a.length} custom activities`,data:a}}}},class extends bi{constructor(){super(...arguments),this.name="read_docs",this.type=xr.READ,this.annotations=yi({title:"Read Documents",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Get information about monday.com documents. Supports two modes:\n\nMODE: "content" (default) — Fetch documents with their full markdown content.\n- Requires: type ("ids" | "object_ids" | "workspace_ids") and ids array\n- Supports pagination via page/limit. Check has_more_pages in response.\n- If type "ids" returns no results, automatically retries with object_ids.\n- Set include_blocks: true to include block IDs, types, and positions in the response — required before calling update_doc.\n- Set include_comments: true to fetch all comments and replies on the document. Use comments_limit to control how many comments per item (default 50).\n\nMODE: "version_history" — Fetch the edit history of a single document.\n- Requires: ids with the document\'s object_id (use the object_id field from content mode results, NOT the id field).\n- The object_id is the numeric ID visible in the document URL.\n- Returns restoring points sorted newest-first. Use version_history_limit to cap results (e.g., "last 3 changes" → version_history_limit: 3).\n- Use since/until to filter by time range. If omitted, returns full history.\n- Set include_diff: true to see what content changed between versions (fetches up to 10 diffs, may be slower).\n- Examples:\n - { mode: "version_history", ids: ["5001466606"], version_history_limit: 3 }\n - { mode: "version_history", ids: ["5001466606"], since: "2026-03-11T00:00:00Z", include_diff: true }'}getInputSchema(){return Ev}async executeInternal(e){return e.mode===Iv?this.executeVersionHistory(e):this.executeContent(e)}async executeContent(e){try{if(!e.type||!e.ids||0===e.ids.length)return{content:'Error: type and ids are required when mode is "content".'};let t,a,r;switch(this.sessionContext.metadata={...this.sessionContext.metadata,mode:e.mode??wv,include_comments:e.include_comments??!1,include_blocks:e.include_blocks??!1},e.type){case"ids":t=e.ids;break;case"object_ids":a=e.ids;break;case"workspace_ids":r=e.ids}const i=e.include_blocks??!1,o={ids:t,object_ids:a,limit:e.limit||25,order_by:e.order_by,page:e.page,workspace_ids:r,includeBlocks:i};let n=await this.mondayApi.request(bc,o);if((!n.docs||0===n.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:r,includeBlocks:i};n=await this.mondayApi.request(bc,a)}if(!n.docs||0===n.docs.length){return{content:`No documents found matching the specified criteria${e.page?` (page ${e.page})`:""}.`}}const s=e.include_comments??!1,d=e.comments_limit??50;return this.sessionContext.metadata={...this.sessionContext.metadata,doc_ids:n.docs.flatMap((e=>e?[e.id]:[])),object_ids:n.docs.flatMap((e=>e?.object_id?[e.object_id]:[]))},this.enrichDocsWithMarkdown(n.docs,o,i,s,d)}catch(e){return{content:`Error reading documents: ${e instanceof Error?e.message:"Unknown error occurred"}`}}}async executeVersionHistory(e){const{include_diff:t,since:a,until:r,version_history_limit:i}=e,o=e.ids?.[0];if(!o)return{content:'Error: ids is required when mode is "version_history". Provide the document object_id.'};this.sessionContext.metadata={...this.sessionContext.metadata,mode:Iv,object_ids:[o]};try{const e={docId:o,since:a,until:r},n=await this.mondayApi.request(wc,e);let s=n?.doc_version_history?.restoring_points;if(!s||0===s.length)return{content:`No version history found for document ${o}${a?` from ${a}`:""}.`};if(!t)return i&&(s=s.slice(0,i)),{content:{doc_id:o,since:a,until:r,restoring_points:s}};const d=Math.min(i??10,10),p=s.slice(0,d+1),l=s.length>d,m=(await Promise.allSettled(p.map((async(e,t)=>{if(t===p.length-1||!e.date)return e;const a=p[t+1];if(!a?.date)return e;const r={docId:o,date:e.date,prevDate:a.date},i=await this.mondayApi.request(Tc,r);return{...e,diff:i?.doc_version_diff?.blocks??[]}}))).then((e=>e.map(((e,t)=>"fulfilled"===e.status?e.value:p[t]))))).slice(0,d);return{content:{doc_id:o,since:a,until:r,restoring_points:m,...l&&{truncated:!0,total_count:s.length}}}}catch(e){return{content:`Error fetching version history for document ${o}: ${e instanceof Error?e.message:"Unknown error"}`}}}async fetchDocComments(e,t){try{const a={boardId:e,itemsLimit:100,updatesLimit:t},r=await this.mondayApi.request(Ic,a),i=r.boards?.[0]?.items_page?.items;if(!i)return[];const o=[];for(const e of i)if(e.updates&&0!==e.updates.length)for(const t of e.updates)o.push({id:t.id,text_body:t.text_body,body:t.body,created_at:t.created_at,creator:t.creator?{id:t.creator.id,name:t.creator.name}:null,item_id:e.id,item_name:e.name,replies:(t.replies??[]).map((e=>({id:e.id,text_body:e.text_body,body:e.body,created_at:e.created_at,creator:e.creator?{id:e.creator.id,name:e.creator.name}:null})))});return o}catch(e){return`Error fetching comments: ${e instanceof Error?e.message:"Unknown error"}`}}async enrichDocsWithMarkdown(e,t,a,r=!1,i=50){const o=await Promise.all(e.filter((e=>null!==e)).map((async e=>{let t,o="";try{const t={docId:e.id},a=await this.mondayApi.request(Lc,t);o=a.export_markdown_from_doc.success&&a.export_markdown_from_doc.markdown?a.export_markdown_from_doc.markdown:`Error getting markdown: ${a.export_markdown_from_doc.error||"Unknown error"}`}catch(e){o=`Error getting markdown: ${e instanceof Error?e.message:"Unknown error"}`}return r&&e.object_id&&(t=await this.fetchDocComments(e.object_id,i)),{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,...a&&{blocks:(e.blocks??[]).filter((e=>null!=e)).map((e=>({id:e.id,type:e.type,parent_block_id:e.parent_block_id,position:e.position,content:e.content})))},blocks_as_markdown:o,...r&&{comments:t}}}))),n=t.page||1,s=t.limit||25,d=o.length,p=d===s;return{content:{message:`Documents retrieved (${o.length})`,pagination:{current_page:n,limit:s,count:d,has_more_pages:p},data:o}}}},class extends bi{constructor(){super(...arguments),this.name="workspace_info",this.type=xr.READ,this.annotations=yi({title:"Get Workspace Information",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"This tool returns the boards, docs and folders in a workspace and which folder they are in. It returns up to 100 of each object type, if you receive 100 assume there are additional objects of that type in the workspace."}getInputSchema(){return Sv}async executeInternal(e){const t={workspace_id:e.workspace_id},a=await this.mondayApi.request(Vc,t);if(!a.workspaces||0===a.workspaces.length)return{content:`No workspace found with ID ${e.workspace_id}`};const r=function(e,t){const{workspaces:a,boards:r,docs:i,folders:o}=e,n=a?.[0];if(!n)throw new Error("No workspace found");const s=new Map((o||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).map((e=>[e.id,{id:e.id,name:e.name,boards:[],docs:[]}]))),d=[];(r||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).forEach((e=>{const t={id:e.id,name:e.name};e.board_folder_id&&s.has(e.board_folder_id)?s.get(e.board_folder_id).boards.push(t):d.push(t)}));const p=[];return(i||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).forEach((e=>{const t={id:e.id,name:e.name};e.doc_folder_id&&s.has(e.doc_folder_id)?s.get(e.doc_folder_id).docs.push(t):p.push(t)})),{workspace:{id:n.id,name:n.name,url:t?gv(t,n.id):void 0,description:n.description||"",kind:n.kind||"",created_at:n.created_at||"",state:n.state||"",is_default_workspace:n.is_default_workspace||!1,owners_subscribers:(n.owners_subscribers||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name&&null!=e.email)).map((e=>({id:e.id,name:e.name,email:e.email})))},folders:Array.from(s.values()),root_items:{boards:d,docs:p}}}(a,await _v(this.mondayApi));return{content:{message:"Workspace info retrieved",data:r}}}},class extends bi{constructor(){super(...arguments),this.name="list_workspaces",this.type=xr.READ,this.annotations=yi({title:"List Workspaces",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"List all workspaces available to the user. Returns up to 500 workspaces with their ID, name, and description."}getInputSchema(){return $v}async executeInternal(e){const t=e.searchTerm?1e4:e.limit,a=e.searchTerm?1:e.page;let r=null;if(e.searchTerm&&(r=Av(e.searchTerm),0===r.length))throw new Error("Search term did not include any alphanumeric characters. Please provide a valid search term.");const i=e=>({limit:t,page:a,membershipKind:e}),o=kv(await this.mondayApi.request(Dv,i(Jl.Member))),n=!Ov(o)||r&&!function(e,t){return t.some((t=>Av(t.name).includes(e)))}(r,o);let s=o;if(n){s=kv(await this.mondayApi.request(Dv,i(Jl.All)))}if(!Ov(s))return{content:{message:"No workspaces found.",data:[]}};const d=r&&s?.length<=Nv,p=function(e,t,a,r){if(!e||t.length<=Nv)return t;const i=(a-1)*r,o=i+r;return t.filter((t=>Av(t.name).includes(e))).slice(i,o)}(r,s,e.page,e.limit);if(!Ov(p))return{content:{message:"No workspaces found matching the search term. Try using the tool without a search term",data:[]}};const l=p.length===e.limit,m=await _v(this.mondayApi),c=p.map((e=>({id:e.id,name:e.name,description:e.description||void 0,url:m&&e.id?gv(m,e.id):void 0})));return{content:{message:"Workspaces retrieved",...d?{disclaimer:"Search term not applied - returning all workspaces. Perform the filtering manually."}:{},...l?{next_page:e.page+1}:{},data:c}}}},class extends bi{constructor(){super(...arguments),this.name="create_doc",this.type=xr.WRITE,this.annotations=yi({title:"Create Document",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a new monday.com doc either inside a workspace or attached to an item (via a doc column). After creation, the provided markdown will be appended to the document.\n\nLOCATION TYPES:\n- workspace: Creates a document in a workspace (requires workspace_id, optional doc_kind, optional folder_id)\n- item: Creates a document attached to an item (requires item_id, optional column_id)\n\nUSAGE EXAMPLES:\n- Workspace doc: { location: "workspace", workspace_id: 123, doc_kind: "private" , markdown: "..." }\n- Workspace doc in folder: { location: "workspace", workspace_id: 123, folder_id: 17264196 , markdown: "..." }\n- Item doc: { location: "item", item_id: 456, column_id: "doc_col_1" , markdown: "..." }'}getInputSchema(){return Vv}async executeInternal(e){const t=Lv.safeParse({...e,type:e.location});if(!t.success)return{content:`Required parameters were not provided for location parameter of ${e.location}`};const a=t.data;try{let t,r,i;if(a.type===Fv.enum.workspace){const o={location:{workspace:{workspace_id:a.workspace_id.toString(),name:e.doc_name,kind:a.doc_kind||Gd.Public,folder_id:a.folder_id?.toString()}}},n=await this.mondayApi.request(Pv,o);t=n?.create_doc?.id??void 0,r=n?.create_doc?.object_id??void 0,i=n?.create_doc?.url??void 0}else if(a.type===Fv.enum.item){const o={itemId:a.item_id.toString()},n=await this.mondayApi.request(Rv,o),s=n.items?.[0];if(!s)return{content:`Error: Item with id ${a.item_id} not found.`};const d=s.board?.id,p=s.board?.columns?.find((e=>e&&e.type===Jh.Doc));let l=a.column_id;if(!l)if(p)l=p.id;else{const e={boardId:d.toString(),columnType:Jh.Doc,columnTitle:"Doc"},t=await this.mondayApi.request(Oc,e);if(l=t?.create_column?.id,!l)return{content:"Error: Failed to create doc column."}}const m={location:{board:{item_id:a.item_id.toString(),column_id:l}}},c=await this.mondayApi.request(Pv,m);if(t=c.create_doc?.id??void 0,r=c.create_doc?.object_id??void 0,i=c.create_doc?.url??void 0,e.doc_name&&t)try{const a={docId:t,name:e.doc_name};await this.mondayApi.request(xv,a)}catch(e){console.warn("Failed to update doc name:",e)}}if(!t)return{content:"Error: Failed to create document."};const o={docId:t,markdown:e.markdown},n=await this.mondayApi.request(Cv,o),s=n?.add_content_to_doc_from_markdown?.success,d=n?.add_content_to_doc_from_markdown?.error;return s?(this.sessionContext.metadata={...this.sessionContext.metadata,location:e.location,...t&&{doc_id:t},...r&&{object_id:r}},{content:{message:"Document successfully created",doc_id:t,object_id:r,doc_url:i,doc_name:e.doc_name}}):{content:`Document ${t} created, but failed to add markdown content: ${d||"Unknown error"}`}}catch(e){return{content:`Error creating document: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends bi{constructor(){super(...arguments),this.name="add_content_to_doc",this.type=xr.WRITE,this.annotations=yi({title:"Add Content to Document",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Add markdown content to an existing monday.com document.\n\nIDENTIFICATION: Provide either doc_id or object_id to identify the document:\n- doc_id: The document ID (the id field returned by read_docs). Takes priority if both provided.\n- object_id: The document object ID (the object_id field from read_docs, also visible in the document URL). Will be resolved to a doc_id.\n\nUSAGE EXAMPLES:\n- By doc_id: { doc_id: "123", markdown: "# New Section\\nContent here" }\n- By object_id: { object_id: "456", markdown: "# New Section\\nContent here" }\n- Insert after block: { doc_id: "123", markdown: "Inserted content", after_block_id: "block_789" }'}getInputSchema(){return Bv}async executeInternal(e){if(!e.doc_id&&!e.object_id)return{content:"Error: Either doc_id or object_id must be provided."};try{let t=null;if(e.doc_id){const a=await this.mondayApi.request(Mv,{docId:[e.doc_id]});t=a.docs?.[0]??null}else{const a=await this.mondayApi.request(Uv,{objectId:[e.object_id]});t=a.docs?.[0]??null}if(!t){return{content:`Error: No document found for ${e.doc_id?`doc_id ${e.doc_id}`:`object_id ${e.object_id}`}.`}}this.sessionContext.metadata={...this.sessionContext.metadata,doc_id:t.id,...e.object_id&&{object_id:e.object_id}};const a={docId:t.id,markdown:e.markdown,afterBlockId:e.after_block_id},r=await this.mondayApi.request(jv,a);if(!r?.add_content_to_doc_from_markdown)return{content:"Error: Failed to add content to document — no response from API."};const{success:i,block_ids:o,error:n}=r.add_content_to_doc_from_markdown;if(!i)return{content:`Error adding content to document: ${n||"Unknown error"}`};const s=o?.length??0;return{content:{message:`Successfully added content to document ${t.id}. ${s} block${1===s?"":"s"} created.`,doc_id:t.id,block_ids:o,doc_name:t.name,doc_url:t.url}}}catch(e){return{content:`Error adding content to document: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends bi{constructor(){super(...arguments),this.name="update_doc",this.type=xr.WRITE,this.annotations=yi({title:"Update Document",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return'Update an existing monday.com document. Provide doc_id (preferred) or object_id, plus an ordered operations array (executed sequentially, stops on first failure).\n\nOPERATIONS:\n- set_name: Rename the document.\n- add_markdown_content: Append markdown as blocks (or insert after a block). Best for text, headings, lists, simple tables — no block IDs needed.\n- update_block: Update content of an existing text, code, or list_item block in-place.\n- create_block: Create a new block at a precise position. Use parent_block_id to nest inside notice_box, table cell, or layout cell.\n- delete_block: Remove any block. The ONLY option for BOARD, WIDGET, DOC embed, and GIPHY blocks.\n- replace_block: Delete a block and create a new one in its place (use when update_block is not supported).\n- add_comment: Create a new comment or reply on the document (doc-level, block-level, or text-selection).\n\nWHEN TO USE EACH OPERATION:\n- text / code / list_item → update_block. Use replace_block to change subtype (e.g. NORMAL_TEXT→LARGE_TITLE)\n- divider / table / image / video / notice_box / layout → replace_block (properties immutable after creation)\n- BOARD / WIDGET / DOC / GIPHY → delete_block only\n\nGETTING BLOCK IDs: Call read_docs with include_blocks: true — returns id, type, position, and content per block.\n\nBLOCK CONTENT (delta_format): Array of insert ops. Last op MUST be {insert: {text: "\\n"}}.\n- Plain: [{insert: {text: "Hello"}}, {insert: {text: "\\n"}}]\n- Bold: [{insert: {text: "Hi"}, attributes: {bold: true}}, {insert: {text: "\\n"}}]\n- Mention user/doc/board: [{insert: {text: "Hey "}}, {insert: {mention: {id: 12345, type: "USER"}}}, {insert: {text: "\\n"}}] — type is USER, DOC, or BOARD. id is numeric (user IDs from list_users_and_teams)\n- Inline column value: [{insert: {column_value: {item_id: 111, column_id: "status"}}}, {insert: {text: "\\n"}}]\n- Supported attributes: bold, italic, underline, strike, code, link, color, background (not applicable to mention/column_value ops)\n\nIMAGE WITH ASSET: For asset-based images, use create_block with block_type "image" and asset_id (instead of public_url). add_markdown_content does NOT support asset images — for mixed content, alternate add_markdown_content (text) and create_block (image) operations in sequence.\n\nCOMMENTS:\n- add_comment: Create a new comment or reply on the document. Three scopes:\n - Doc-level (no block_id): comment appears on the doc as a whole.\n - Block-level (block_id only): comment is anchored to a specific block. The block shows a comment indicator in the UI.\n - Text-selection (block_id + selection_from + selection_length): comment is anchored to a specific character range inside a text/code/list_item block. That text is highlighted with a comment marker.\n Block-level and text-selection comments only work on blocks with text content (text, code, list_item, title, quote). They do NOT work on: divider, page_break, table, layout, notice_box, image, video, or giphy blocks.\n Get block IDs from read_docs with include_blocks: true. Format body with HTML, not markdown. Use mentions_list for @mentions.'}getInputSchema(){return P_}async executeInternal(e){if(!e.doc_id&&!e.object_id)return{content:"Error: Either doc_id or object_id must be provided."};this.sessionContext.metadata={...this.sessionContext.metadata,operation_types:e.operations?.map((e=>e.operation_type)),operation_count:e.operations?.length??0,...e.object_id&&{object_id:e.object_id}};try{let t=e.doc_id;if(!t){const a=await this.mondayApi.request(Gv,{objectId:[e.object_id]}),r=a.docs?.[0];if(!r)return{content:`Error: No document found for object_id ${e.object_id}.`};t=r.id}const a=[];let r=null;for(let i=0;i<e.operations.length;i++){const o=e.operations[i];try{const r=await this.executeOperation(t,o,e.object_id);a.push(`- [OK] ${o.operation_type}${r?`: ${r}`:""}`)}catch(e){const t=e instanceof Error?e.message:"Unknown error";a.push(`- [FAILED] ${o.operation_type}: ${t}`),r=i;break}}const i=null!==r?r:e.operations.length,o=e.operations.length,n=`Completed ${i}/${o} operation${1===o?"":"s"} on doc ${t}.`;return this.sessionContext.metadata={...this.sessionContext.metadata,doc_id:t},{content:`${n}\n\nResults:\n${a.join("\n")}\n\nDoc ID: ${t}`}}catch(e){return{content:`Error: ${e instanceof Error?e.message:String(e)}`}}}async executeOperation(e,t,a){switch(t.operation_type){case"set_name":return this.executeSetName(e,t.name);case"add_markdown_content":return this.executeAddMarkdown(e,t.markdown,t.after_block_id);case"update_block":return this.executeUpdateBlock(t.block_id,t.content);case"create_block":return this.executeCreateBlock(e,t.block,t.after_block_id,t.parent_block_id);case"delete_block":return this.executeDeleteBlock(t.block_id);case"replace_block":return this.executeReplaceBlock(e,t.block_id,t.block,t.after_block_id,t.parent_block_id);case"add_comment":return this.executeAddComment(e,a,t.body,t.parent_update_id,t.mentions_list,t.block_id,t.selection_from,t.selection_length);default:{const e=t.operation_type;throw new Error(`Unsupported operation type: "${e}"`)}}}async executeSetName(e,t){const a={docId:e,name:t},r=await this.mondayApi.request(qv,a);if(!r?.update_doc_name)throw new Error(`No confirmation from update_doc_name — rename to "${t}" may not have applied`);return`Renamed to "${t}"`}async executeAddMarkdown(e,t,a){if(!t.trim())throw new Error("markdown must not be empty");const r={docId:e,markdown:t,afterBlockId:a},i=await this.mondayApi.request(Hv,r),o=i?.add_content_to_doc_from_markdown;if(!o?.success)throw new Error(o?.error||"Failed to add markdown content");const n=o.block_ids?.length??0;return`${n} block${1===n?"":"s"} added${o.block_ids?.length?`. Block IDs: ${o.block_ids.join(", ")}`:""}`}async executeUpdateBlock(e,t){const a=function(e){switch(e.block_content_type){case"text":return{deltaFormat:r_(e.delta_format),alignment:e.alignment,direction:e.direction};case"code":return{deltaFormat:r_(e.delta_format),language:e.language};case"list_item":return{deltaFormat:r_(e.delta_format),checked:e.checked,indentation:e.indentation};default:{const t=e.block_content_type;throw new Error(`Unsupported block_content_type: "${t}"`)}}}(t),r={blockId:e,content:JSON.stringify(a)},i=await this.mondayApi.request(Wv,r);if(!i?.update_doc_block)throw new Error("No response from update_doc_block");return`Block ${e} updated`}async executeCreateBlock(e,t,a,r){const i=function(e){switch(e.block_type){case"text":return{text_block:{delta_format:a_(e.delta_format),text_block_type:e.text_block_type?e.text_block_type:void 0,alignment:Zv(e.alignment),direction:e_(e.direction)}};case"list_item":return{list_block:{delta_format:a_(e.delta_format),list_block_type:e.list_block_type?e.list_block_type:void 0,indentation:e.indentation}};case"code":return{text_block:{delta_format:a_(e.delta_format),text_block_type:Pl.Code}};case"divider":return{divider_block:{}};case"page_break":return{page_break_block:{}};case"image":if(null==e.asset_id&&!e.public_url)throw new Error("image block requires either asset_id or public_url");return{image_block:null!=e.asset_id?{asset_id:String(e.asset_id),width:e.width}:{public_url:e.public_url,width:e.width}};case"video":return{video_block:{raw_url:e.raw_url,width:e.width}};case"notice_box":return{notice_box_block:{theme:e.theme}};case"table":return{table_block:{row_count:e.row_count,column_count:e.column_count,width:e.width,column_style:e.column_style?.map((e=>({width:e.width})))}};case"layout":return{layout_block:{column_count:e.column_count,column_style:e.column_style?.map((e=>({width:e.width})))}};default:{const t=e.block_type;throw new Error(`Unsupported block_type: "${t}"`)}}}(t);if(r){const e=Object.keys(i);if(1!==e.length)throw new Error(`Cannot inject parent_block_id: expected exactly 1 key in block input, got: ${e.join(", ")}`);const t=e[0],a=i[t];if(!a||"object"!=typeof a)throw new Error(`Cannot inject parent_block_id into block type "${t}" — block value is not an object`);a.parent_block_id=r}const o={docId:e,afterBlockId:a,blocksInput:[i]},n=await this.mondayApi.request(Xv,o),s=n?.create_doc_blocks;if(!s||0===s.length)throw new Error("No blocks returned from create_doc_blocks");return`Block created (ID: ${s.map((e=>e.id)).join(", ")})`}async executeDeleteBlock(e){const t={blockId:e},a=await this.mondayApi.request(Qv,t);if(!a?.delete_doc_block)throw new Error("No response from delete_doc_block");return`Block ${e} deleted`}async resolveObjectId(e,t){if(t)return t;const a=await this.mondayApi.request(zv,{docId:[e]}),r=a.docs?.[0];if(!r?.object_id)throw new Error(`Could not resolve object_id for doc ${e}`);return r.object_id}async resolveDocItemId(e){const t=await this.mondayApi.request(Yv,{boardId:e}),a=t.boards?.[0]?.items_page?.items?.[0]?.id;if(!a)throw new Error(`No item found on the document backing board (object_id: ${e})`);return a}async fetchAllBlockContent(e){const t=await this.mondayApi.request(Kv,{docId:[e]});return(t.docs?.[0]?.blocks??[]).filter((e=>null!=e)).map((t=>{let a;if("string"==typeof t.content)try{a=JSON.parse(t.content)}catch{throw new Error(`Failed to parse content of block ${t.id} in doc ${e} as JSON`)}else a=t.content??{};return{id:t.id??"",type:t.type??"",content:a}}))}async executeAddComment(e,t,a,r,i,o,n,s){if((null!=n||null!=s)&&!o)throw new Error("selection_from and selection_length require block_id");if(null!=n!=(null!=s))throw new Error("selection_from and selection_length must both be provided together");const d=o?Array.isArray(o)?o:[o]:[];if((null!=n||null!=s)&&d.length>1)throw new Error("selection_from and selection_length are only supported with a single block_id");const p=await this.resolveObjectId(e,t),l=await this.resolveDocItemId(p);let m;if(i){const e=JSON.parse(i),t=hf.safeParse(e);if(!t.success)throw new Error(`Invalid mentions_list format: ${t.error.message}`);m=t.data}const c={itemId:l,body:a,parentId:r?.toString(),mentionsList:m},u=await this.mondayApi.request(Jv,c);if(!u.create_update?.id)throw new Error("Failed to create comment: no update returned");const h=u.create_update.id,f=Number(h),v=r?`Reply to update ${r}`:"Comment";if(d.length>0){if(Number.isNaN(f))throw new Error(`${v} created (update ID: ${h}) but block annotation aborted: comment ID is not numeric and cannot be used as a delta reference`);const t=await this.fetchAllBlockContent(e);for(const a of d){const r=t.find((e=>e.id===a));if(!r)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: block ${a} not found in doc ${e}`);const i=r.content.deltaFormat;if(!i)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: block ${a} has no deltaFormat — only text, code, and list_item blocks are supported`);let o=0;for(const e of i)o+="string"==typeof e.insert?e.insert.length:1;if(0===o)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: block ${a} has an empty deltaFormat and cannot be annotated`);const d=n??0,p=s??o;if(d+p>o)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: selection [${d}, ${d+p}) is out of range for block ${a} (total length ${o})`);let l;try{l=o_(i,f,d,p)}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`${v} created (update ID: ${h}) but delta annotation failed for block ${a}: ${t}`)}const m={...r.content,deltaFormat:l},c=await this.mondayApi.request(Wv,{blockId:a,content:JSON.stringify(m)});if(!c?.update_doc_block)throw new Error(`${v} created (update ID: ${h}) but block annotation write returned no confirmation for block ${a}`)}}const _=d.length;return`${v} created${_>1?` across ${_} blocks`:1===_?" on block":""} (update ID: ${h})`}async executeReplaceBlock(e,t,a,r,i){await this.executeDeleteBlock(t);try{return`Block ${t} replaced. ${await this.executeCreateBlock(e,a,r,i)}`}catch(e){const a=e instanceof Error?e.message:String(e);throw new Error(`Original block ${t} was deleted, but replacement creation failed: ${a}. The original block is gone.`)}}},class extends bi{constructor(){super(...arguments),this.name="update_workspace",this.type=xr.WRITE,this.annotations=yi({title:"Update Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing workspace in monday.com"}getInputSchema(){return U_}async executeInternal(e){const t={id:e.id,attributes:{account_product_id:e.attributeAccountProductId,description:e.attributeDescription,kind:e.attributeKind,name:e.attributeName}},a=await this.mondayApi.request(j_,t),r=await _v(this.mondayApi),i=r?gv(r,a.update_workspace?.id):void 0;return{content:{message:`Workspace ${a.update_workspace?.id} updated`,workspace_id:a.update_workspace?.id,workspace_name:a.update_workspace?.name,workspace_url:i}}}},class extends bi{constructor(){super(...arguments),this.name="update_folder",this.type=xr.WRITE,this.annotations=yi({title:"Update Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing folder in monday.com"}getInputSchema(){return B_}async executeInternal(e){const{position_object_id:t,position_object_type:a,position_is_after:r}=e;if(!!t!=!!a)throw new Error("position_object_id and position_object_type must be provided together");const i={folderId:e.folderId,name:e.name,color:e.color,fontWeight:e.fontWeight,customIcon:e.customIcon,parentFolderId:e.parentFolderId,workspaceId:e.workspaceId,accountProductId:e.accountProductId,position:t?{position_is_after:r,position_object_id:t,position_object_type:a}:void 0},o=await this.mondayApi.request(M_,i);return{content:{message:`Folder ${o.update_folder?.id} updated`,folder_id:o.update_folder?.id,folder_name:o.update_folder?.name}}}},class extends bi{constructor(){super(...arguments),this.name="create_workspace",this.type=xr.WRITE,this.annotations=yi({title:"Create Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new workspace in monday.com"}getInputSchema(){return H_}async executeInternal(e){const t={name:e.name,workspaceKind:e.workspaceKind,description:e.description,accountProductId:e.accountProductId},a=await this.mondayApi.request(q_,t),r=await _v(this.mondayApi),i=r&&a.create_workspace?.id?gv(r,a.create_workspace.id):void 0;return{content:{message:`Workspace ${a.create_workspace?.id} successfully created`,workspace_id:a.create_workspace?.id,workspace_name:a.create_workspace?.name,workspace_url:i}}}},class extends bi{constructor(){super(...arguments),this.name="create_folder",this.type=xr.WRITE,this.annotations=yi({title:"Create Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new folder in a monday.com workspace"}getInputSchema(){return W_}async executeInternal(e){const t={workspaceId:e.workspaceId,name:e.name,color:e.color,fontWeight:e.fontWeight,customIcon:e.customIcon,parentFolderId:e.parentFolderId},a=await this.mondayApi.request(G_,t);return{content:{message:`Folder ${a.create_folder?.id} successfully created`,folder_id:a.create_folder?.id,folder_name:a.create_folder?.name}}}},class extends bi{constructor(){super(...arguments),this.name="move_object",this.type=xr.WRITE,this.annotations=yi({title:"Move Object",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Move a folder, board, or overview in monday.com. Use position for relative placement based on another object, parentFolderId for folder changes, workspaceId for workspace moves, and accountProductId for account product changes."}getInputSchema(){return Y_}async executeUpdateFolder(e){const{id:t,position_object_id:a,position_object_type:r,position_is_after:i,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!r)throw new Error("position_object_id and position_object_type must be provided together");const d={folderId:t,position:a?{position_is_after:i,position_object_id:a,position_object_type:r}:void 0,parentFolderId:o,workspaceId:n,accountProductId:s},p=await this.mondayApi.request(M_,d);return{content:{message:"Object moved",object_id:p.update_folder?.id}}}async executeUpdateBoardHierarchy(e){const{id:t,position_object_id:a,position_object_type:r,position_is_after:i,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!r)throw new Error("position_object_id and position_object_type must be provided together");const d={boardId:t,attributes:{position:a?{position_is_after:i,position_object_id:a,position_object_type:r}:void 0,folder_id:o,workspace_id:n,account_product_id:s}},p=await this.mondayApi.request(Q_,d);return p.update_board_hierarchy?.success?{content:{message:"Board position updated",object_id:p.update_board_hierarchy?.board?.id,action_name:"move_board"}}:{content:`Board position update failed: ${p.update_board_hierarchy?.message}`}}async executeUpdateOverviewHierarchy(e){const{id:t,position_object_id:a,position_object_type:r,position_is_after:i,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!r)throw new Error("position_object_id and position_object_type must be provided together");const d={overviewId:t,attributes:{position:a?{position_is_after:i,position_object_id:a,position_object_type:r}:void 0,folder_id:o,workspace_id:n,account_product_id:s}},p=await this.mondayApi.request(z_,d);return p.update_overview_hierarchy?.success?{content:{message:"Overview position updated",object_id:p.update_overview_hierarchy?.overview?.id}}:{content:`Overview position update failed: ${p.update_overview_hierarchy?.message}`}}async executeInternal(e){const{objectType:t}=e;switch(t){case sl.Folder:return this.executeUpdateFolder(e);case sl.Board:return this.executeUpdateBoardHierarchy(e);case sl.Overview:return this.executeUpdateOverviewHierarchy(e);default:throw new Error(`Unsupported object type: ${t}`)}}},class extends bi{constructor(){super(...arguments),this.name="create_dashboard",this.type=xr.WRITE,this.annotations=yi({title:"Create Dashboard",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Use this tool to create a new monday.com dashboard that aggregates data from one or more boards. \n Dashboards provide visual representations of board data through widgets and charts.\n \n Use this tool when users want to:\n - Create a dashboard to visualize board data\n - Aggregate information from multiple boards\n - Set up a data visualization container for widgets"}getInputSchema(){return L_}async executeInternal(e){try{const t={name:e.name,workspace_id:e.workspace_id.toString(),board_ids:e.board_ids,kind:e.kind,board_folder_id:e.board_folder_id?.toString()},a=await this.mondayApi.request(C_,t);if(!a.create_dashboard)throw new Error("Failed to create dashboard");const r=a.create_dashboard;return{content:{message:`Dashboard ${r.id} successfully created`,dashboard_id:r.id,dashboard_name:r.name}}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to create dashboard: ${t}`)}}},class extends bi{constructor(){super(...arguments),this.name="all_widgets_schema",this.type=xr.READ,this.annotations=yi({title:"Get All Widget Schemas",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch complete JSON Schema 7 definitions for all available widget types in monday.com.\n \n This tool is essential before creating widgets as it provides:\n - Complete schema definitions for all supported widgets\n - Required and optional fields for each widget type\n - Data type specifications and validation rules\n - Detailed descriptions of widget capabilities\n \n Use this tool when you need to:\n - Understand widget configuration requirements before creating widgets\n - Validate widget settings against official schemas\n - Plan widget implementations with proper data structures\n \n The response includes JSON Schema 7 definitions that describe exactly what settings each widget type accepts."}getInputSchema(){return{}}async executeInternal(){try{const e={},t=await this.mondayApi.request(x_,e);if(!t.all_widgets_schema||0===t.all_widgets_schema.length)throw new Error("No widget schemas found - API returned empty response");const a={};let r=0;for(const e of t.all_widgets_schema)if(e?.widget_type&&e?.schema){const t="string"==typeof e.schema?JSON.parse(e.schema):e.schema,i=t?.description||t?.title||`${e.widget_type} widget for data visualization`;a[e.widget_type]={type:e.widget_type,description:i,schema:e.schema},r++}if(0===r)throw new Error("No valid widget schemas found in API response");Object.keys(a).map((e=>`• **${e}**: ${a[e].description}`)).join("\n");return{content:{message:"Widgets schema",data:a,url:Gf}}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to fetch widget schemas: ${t}`)}}},class extends bi{constructor(){super(...arguments),this.name="create_widget",this.type=xr.WRITE,this.annotations=yi({title:"Create Widget",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new widget in a dashboard or board view with specific configuration settings.\n \n This tool creates data visualization widgets that display information from monday.com boards:\n **Parent Containers:**\n - **DASHBOARD**: Place widget in a dashboard (most common use case)\n - **BOARD_VIEW**: Place widget in a specific board view\n \n **Critical Requirements:**\n 1. **Schema Compliance**: Widget settings MUST conform to the JSON schema for the specific widget type\n 2. **Use all_widgets_schema first**: Always fetch widget schemas before creating widgets\n 3. **Validate settings**: Ensure all required fields are provided and data types match\n \n **Workflow:**\n 1. Use 'all_widgets_schema' to get schema definitions\n 2. Prepare widget settings according to the schema\n 3. Use this tool to create the widget"}getInputSchema(){return V_}async executeInternal(e){if(!e.settings)throw new Error("You must pass the settings parameter");try{const t={parent:{kind:e.parent_container_type,id:e.parent_container_id.toString()},kind:e.widget_kind,name:e.widget_name,settings:e.settings},a=await this.mondayApi.request(F_,t);if(!a.create_widget)throw new Error("Failed to create widget");const r=a.create_widget;r.parent?.kind===Yl.Dashboard?r.parent.id:r.parent;return{content:{message:`Widget ${r.id} created`,widget_id:r.id,widget_name:r.name,dashboard_id:r.parent?.id}}}catch(t){const a=t instanceof Error?t.message:String(t);throw new Error(`Failed to create ${e.widget_kind} widget: ${a}`)}}},class extends bi{constructor(){super(...arguments),this.name="board_insights",this.type=xr.READ,this.annotations=yi({title:"Get Board Insights",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"This tool allows you to calculate insights about board's data by filtering, grouping and aggregating columns. For example, you can get the total number of items in a board, the number of items in each status, the number of items in each column, etc. Use this tool when you need to get a summary of the board's data, for example, you want to know the total number of items in a board, the number of items in each status, the number of items in each column, etc.[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 to understand the board metadata. This is essential for constructing proper filters and knowing which columns are available.[IMPORTANT]: For some columns, human-friendly label is returned inside 'LABEL_<column_id' field. E.g. for column with id 'status_123' the label is returned inside 'LABEL_status_123' field."}getInputSchema(){return tg}async executeInternal(e){if(!e.aggregations)return{content:'Input must contain the "aggregations" field.'};const{selectElements:t,groupByElements:a}=function(e){const t={},a=e.groupBy?.map((e=>({column_id:e})))||[],r=new Set(e.aggregations.filter((e=>e.function===Ad.Label)).map((e=>e.columnId))),i=e.groupBy?.filter((e=>!r.has(e))).map((e=>({function:Ad.Label,columnId:e})))??[],o=e.aggregations.concat(i).map((e=>{if(e.function){const o=`${e.function}_${e.columnId}`,n=t[o]||0;t[o]=n+1;const s=`${o}_${n}`;return Z_.has(e.function)&&(a.some((e=>e.column_id===s))||a.push({column_id:s})),{type:Nd.Function,function:(r=e.function,i=e.columnId,{function:r,params:r===Ad.CountItems?[]:[{type:Nd.Column,column:eg(i),as:i}]}),as:s}}var r,i;const o={type:Nd.Column,column:eg(e.columnId),as:e.columnId};return a.some((t=>t.column_id===e.columnId))||a.push({column_id:e.columnId}),o}));return a.forEach((e=>{o.some((t=>t.as===e.column_id))||o.push({type:Nd.Column,column:eg(e.column_id),as:e.column_id})})),{selectElements:o,groupByElements:a}}(e),r=function(e){if(!e.filters&&!e.orderBy)return;const t={};return e.filters&&(t.rules=e.filters.map((e=>({column_id:e.columnId,compare_value:e.compareValue,operator:e.operator,compare_attribute:e.compareAttribute}))),t.operator=e.filtersOperator),e.orderBy&&(t.order_by=function(e){return e.orderBy?.map((e=>({column_id:e.columnId,direction:e.direction})))}(e)),t}(e),i=function(e){return{id:e.boardId.toString(),type:Dd.Table}}(e),o={query:{from:i,query:r,select:t,group_by:a,limit:e.limit},boardId:String(e.boardId)},n=await this.mondayApi.request(K_,o),s=(n.aggregate?.results??[]).map((e=>{const t={};return(e.entries??[]).forEach((e=>{const a=e.alias??"";if(!a)return;const r=e.value;if(!r)return void(t[a]=null);const i=r.result??r.value??null;t[a]=i})),t}));return s.length?{content:{message:"Board insights retrieved",board_name:n.boards?.[0]?.name,board_url:n.boards?.[0]?.url,data:s}}:{content:"No board insights found for the given query."}}},class extends bi{constructor(){super(...arguments),this.name="search",this.type=xr.READ,this.annotations=yi({title:"Search",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Search within monday.com platform. Can search for boards, documents, forms, folders.\nFor searching/listing specific users and teams, use list_users_and_teams tool.\nFor account-level info (plan, member count, products), use get_user_context tool.\nFor workspaces, use list_workspaces tool.\nFor items and groups, use get_board_items_page tool.\nFor groups, use get_board_info tool.\nIMPORTANT: ids returned by this tool are prefixed with the type of the object (e.g doc-123, board-456, folder-789). When passing the ids to other tools, you need to remove the prefix and just pass the number.\n "}getInputSchema(){return pg}async executeInternal(e){if(e.searchType!==dg.FOLDERS&&e.searchTerm)try{return{content:{message:"Search results",data:(await this.searchWithDevEndpointAsync(e)).items}}}catch(e){Mh(e)}const t={[dg.BOARD]:this.searchBoardsAsync.bind(this),[dg.DOCUMENTS]:this.searchDocsAsync.bind(this),[dg.FOLDERS]:this.searchFoldersAsync.bind(this)}[e.searchType];if(!t)throw new Error(`Unsupported search type: ${e.searchType}`);const a=await t(e);return{content:{message:"Search results",disclaimer:a.wasFiltered||!e.searchTerm?void 0:"[IMPORTANT]Items were not filtered. Please perform the filtering.",data:a.items}}}async searchWithDevEndpointAsync(e){if(e.page>1)throw new Error("Pagination is not supported for search, increase the limit parameter instead");const t=e.workspaceIds?.map((e=>e.toString()));if(e.searchType===dg.BOARD)return this.searchBoardsWithDevEndpointAsync(e.searchTerm,e.limit,t);if(e.searchType===dg.DOCUMENTS)return this.searchDocsWithDevEndpointAsync(e.searchTerm,e.limit,t);throw new Error(`Unsupported search type for dev endpoint: ${e.searchType}`)}async searchBoardsWithDevEndpointAsync(e,t,a){const r={query:e,limit:t,workspaceIds:a};return{items:(await this.mondayApi.request(og,r,{versionOverride:"dev",timeout:jh})).search.boards.results.map((e=>({id:sg.BOARD+e.indexed_data.id,title:e.indexed_data.name,url:e.indexed_data.url}))),wasFiltered:!0}}async searchDocsWithDevEndpointAsync(e,t,a){const r={query:e,limit:t,workspaceIds:a};return{items:(await this.mondayApi.request(ng,r,{versionOverride:"dev",timeout:jh})).search.docs.results.map((e=>({id:sg.DOCUMENT+e.indexed_data.id,title:e.indexed_data.name}))),wasFiltered:!0}}async searchFoldersAsync(e){const t={...this.getPagingParamsForSearch(e,100),workspace_ids:e.workspaceIds?.map((e=>e.toString()))};t.workspace_ids??=[],0===t.workspace_ids.length&&Uh(new Error("Searching for folders require specifying workspace ids"),"search folders");const a=await this.mondayApi.request(ig,t),r=this.searchAndVirtuallyPaginate(e,a.folders||[],(e=>e.name));return{items:r.items.map((e=>({id:sg.FOLDER+e.id,title:e.name}))),wasFiltered:r.wasFiltered}}async searchDocsAsync(e){const t={...this.getPagingParamsForSearch(e),workspace_ids:e.workspaceIds?.map((e=>e.toString()))},a=await this.mondayApi.request(rg,t),r=this.searchAndVirtuallyPaginate(e,a.docs||[],(e=>e.name));return{items:r.items.map((e=>({id:sg.DOCUMENT+e.id,title:e.name,url:e.url||void 0}))),wasFiltered:r.wasFiltered}}async searchBoardsAsync(e){const t={...this.getPagingParamsForSearch(e),workspace_ids:e.workspaceIds?.map((e=>e.toString()))},a=await this.mondayApi.request(ag,t),r=this.searchAndVirtuallyPaginate(e,a.boards||[],(e=>e.name));return{items:r.items.map((e=>({id:sg.BOARD+e.id,title:e.name,url:e.url}))),wasFiltered:r.wasFiltered}}getPagingParamsForSearch(e,t=1e3){return{page:e.searchTerm?1:e.page,limit:e.searchTerm?Math.min(1e3,t):e.limit}}searchAndVirtuallyPaginate(e,t,a){if(t.length<=20)return{items:t,wasFiltered:!1};const r=Av(e.searchTerm??""),i=(e.page-1)*e.limit,o=i+e.limit;return{items:t.filter((e=>Av(a(e)).includes(r))).slice(i,o),wasFiltered:!0}}},class extends bi{constructor(){super(...arguments),this.name="get_user_context",this.type=xr.READ,this.annotations=yi({title:"Get User Context",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch current user information, account information, and their relevant items (boards, folders, workspaces, dashboards).\n\n Use this tool to:\n - Get context about who the current user is (id, name, title)\n - Get account info: plan tier, active member count, trial status, and active products\n - Get the number of active members in the account (returns active_members_count)\n - Discover user's favorite boards, folders, workspaces, and dashboards\n - Get user's most relevant boards based on visit frequency and recency\n - Get user's most relevant people based on interaction frequency and recency\n - Reduce the need for search requests by knowing user's commonly accessed items\n "}getInputSchema(){}async executeInternal(){const{me:e,favorites:t,intelligence:a}=await this.mondayApi.request(gg,{},{versionOverride:"dev"});if(!e)return{content:"AUTHENTICATION_ERROR: Unable to fetch current user. Verify API token and user permissions."};const r=await this.fetchFavorites(t||[]),i=this.extractRelevantBoards(a),o=this.extractRelevantPeople(a),{account:n,...s}=e;return{content:{message:"User context",...{user:s,account:n?{tier:n.tier,active_members_count:n.active_members_count,is_during_trial:n.is_during_trial,products:n.products?.filter(Boolean).map((e=>({kind:e.kind,tier:e.tier})))??[]}:null,favorites:r,relevantBoards:i,relevantPeople:o}}}}async fetchFavorites(e){const t=this.groupByType(e),a=Object.keys(t);if(0===a.length)return[];const r={};for(const e of a)r[bg[e]]=t[e];const i=await this.mondayApi.request(yg,r),o=[];for(const e of a){const t=wg[e];for(const a of i[t]??[])a?.id&&o.push({id:a.id,name:a.name,type:e})}return o}extractRelevantBoards(e){if(!e?.relevant_boards)return[];const t=[];for(const a of e.relevant_boards)a?.id&&a?.board?.name&&t.push({id:a.id,name:a.board.name});return t}extractRelevantPeople(e){if(!e?.relevant_people)return[];const t=[];for(const a of e.relevant_people)a?.id&&a?.user?.name&&t.push({id:a.id,name:a.user.name});return t}groupByType(e){const t={};for(const a of e){const e=a?.object;e?.id&&e?.type&&(t[e.type]??=[]).push(e.id)}return t}},class extends bi{constructor(){super(...arguments),this.name="update_assets_on_item",this.type=xr.WRITE,this.annotations=yi({title:"Update Assets On Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update a file or doc column value on an item using existing assets, docs, or links. Sets the column to the provided list of files, adding new ones and removing any not in the list."}getInputSchema(){return fg}async executeInternal(e){const t={boardId:e.boardId,itemId:e.itemId,columnId:e.columnId,files:e.files},a=await this.mondayApi.request(ug,t);return{content:`Item ${a.update_assets_on_item?.id} (${a.update_assets_on_item?.name}) assets successfully updated`}}},class extends bi{constructor(){super(...arguments),this.name="get_assets",this.type=xr.READ,this.annotations=yi({title:"Get Assets",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get assets (files) by their IDs. Returns file metadata including name, extension, size, public URL (valid for 1 hour), thumbnail URL, upload date, and who uploaded it."}getInputSchema(){return _g}async executeInternal(e){const t=await this.mondayApi.request(vg,{ids:e.ids}),a=t.assets?.filter(Boolean);if(!a||0===a.length)return{content:`No assets found for the provided IDs: ${e.ids.join(", ")}`};return{content:{results:a.map((e=>({id:e.id,name:e.name,file_extension:e.file_extension,file_size:e.file_size,public_url:e.public_url,url:e.url,url_thumbnail:e.url_thumbnail??null,created_at:e.created_at??null,original_geometry:e.original_geometry??null,uploaded_by:e.uploaded_by})))}}}},class extends bi{constructor(){super(...arguments),this.name="get_notetaker_meetings",this.type=xr.READ,this.annotations=yi({title:"Get Notetaker Meetings",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Retrieve notetaker meetings with optional detailed fields. Use include_summary, include_topics, include_action_items, and include_transcript flags to control which details are returned. Use access to filter by meeting access level (OWN, SHARED_WITH_ME, SHARED_WITH_ACCOUNT, ALL). Defaults to OWN. Supports filtering by ids, search term, and cursor-based pagination."}getInputSchema(){return Tg}async executeInternal(e){const t={access:e.access};e.ids&&e.ids.length>0&&(t.ids=e.ids),e.search&&(t.search=e.search);const a={limit:e.limit,cursor:e.cursor||void 0,filters:t,includeSummary:e.include_summary,includeTopics:e.include_topics,includeActionItems:e.include_action_items,includeTranscript:e.include_transcript},r=await this.mondayApi.request(Ig,a,{versionOverride:"2026-04"}),i=r.notetaker?.meetings;if(!i?.meetings||0===i.meetings.length)return{content:"No notetaker meetings found matching the specified criteria."};return{content:{message:"Meetings retrieved",data:{meetings:i.meetings,pagination:{has_next_page:i.page_info?.has_next_page??!1,cursor:i.page_info?.cursor??null,count:i.meetings.length}}}}}},class extends bi{constructor(){super(...arguments),this.name="create_view",this.type=xr.WRITE,this.annotations=yi({title:"Create View",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a new board view (tab) with optional filters and sorting. This creates a saved view on a monday.com board that users can switch to.\n\nFilter operators: any_of, not_any_of, is_empty, is_not_empty, greater_than, lower_than, between, contains_text, not_contains_text\n\nExample filter for people column: { "rules": [{ "column_id": "people", "compare_value": ["person-12345"], "operator": "any_of" }] }\nExample filter for status column: { "rules": [{ "column_id": "status", "compare_value": [1], "operator": "any_of" }] }'}getInputSchema(){return uu}async executeInternal(e){const t={boardId:e.boardId,type:e.type,name:e.name,filter:e.filter,sort:e.sort},a=await this.mondayApi.request(cu,t);return a.create_view?{content:`View "${a.create_view.name}" (ID: ${a.create_view.id}, type: ${a.create_view.type}) successfully created`}:{content:"Failed to create view - no response from API"}}},class extends bi{constructor(){super(...arguments),this.name="undo_action",this.type=xr.WRITE,this.annotations=yi({title:"Undo Action",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Undo a previous action on a board using its action_record_uuid. Supports undoing column changes, deletes, archives, moves, duplicates, and more. Use get_board_activity with includeData=true to find the action_record_uuid."}getInputSchema(){return Sg}async executeInternal(e){return await this.mondayApi.request(Eg,{boardId:e.boardId.toString(),undoRecordId:e.undoRecordId},{versionOverride:"dev"}),{content:`Successfully undid action "${e.undoRecordId}" on board ${e.boardId}.`}}},class extends bi{constructor(){super(...arguments),this.name="get_object_schemas",this.type=xr.READ,this.annotations=yi({title:"Get Object Schemas",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Retrieve account-level object schemas by their IDs or names. Schemas define the structure and columns of boards. Provide ids or names to filter specific schemas. Omit both to list all schemas (paginated)."}getInputSchema(){return Gc}async executeInternal(e){const t={ids:e.ids,names:e.names,limit:e.limit,page:e.page,excludeCreatedByMonday:e.excludeCreatedByMonday},a=(await this.mondayApi.request(Hc,t)).get_object_schemas??[];return{content:{message:`Retrieved ${a.length} object schema(s)`,schemas:a}}}},class extends bi{constructor(){super(...arguments),this.name="create_object_schema",this.type=xr.WRITE,this.annotations=yi({title:"Create Object Schema",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new account-level object schema. Schemas define the structure and columns of boards."}getInputSchema(){return Qc}async executeInternal(e){const t={name:e.name,parentId:e.parentId,description:e.description},a=await this.mondayApi.request(Wc,t);return{content:{message:`Object schema "${a.create_object_schema?.name}" successfully created`,schema_id:a.create_object_schema?.id,schema_name:a.create_object_schema?.name,revision:a.create_object_schema?.revision}}}},class extends bi{constructor(){super(...arguments),this.name="update_object_schema",this.type=xr.WRITE,this.annotations=yi({title:"Update Object Schema",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Update an account-level object schema. Requires the current revision number for optimistic locking — retrieve it first via get_object_schemas."}getInputSchema(){return Yc}async executeInternal(e){const t={id:e.id,revision:e.revision,parentId:e.parentId,description:e.description},a=await this.mondayApi.request(zc,t);return{content:{message:`Object schema "${a.update_object_schema?.name}" successfully updated`,schema_id:a.update_object_schema?.id,schema_name:a.update_object_schema?.name,revision:a.update_object_schema?.revision}}}},class extends bi{constructor(){super(...arguments),this.name="delete_object_schema",this.type=xr.WRITE,this.annotations=yi({title:"Delete Object Schema",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete an account-level object schema. Only allowed when no boards are connected to the schema. Provide either id or name."}getInputSchema(){return Jc}async executeInternal(e){if(!e.id&&!e.name)throw new Error("Either id or name must be provided");const t={id:e.id,name:e.name},a=await this.mondayApi.request(Kc,t);return{content:{message:`Object schema "${a.delete_object_schema?.name}" successfully deleted`,schema_id:a.delete_object_schema?.id,schema_name:a.delete_object_schema?.name}}}},class extends bi{constructor(){super(...arguments),this.name="delete_object_schema_columns",this.type=xr.WRITE,this.annotations=yi({title:"Delete Object Schema Columns",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Permanently delete columns from an account-level object schema. Only allowed when no boards are connected to the schema. Use manage_object_schema_column with action=deactivate for a reversible alternative."}getInputSchema(){return Zc}async executeInternal(e){if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided");const t={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columnIds:e.columnIds},a=await this.mondayApi.request(Xc,t,{versionOverride:"dev"});return{content:{message:`${e.columnIds.length} column(s) successfully deleted from object schema "${a.delete_object_schema_columns?.name}"`,schema_id:a.delete_object_schema_columns?.id,schema_name:a.delete_object_schema_columns?.name,revision:a.delete_object_schema_columns?.revision}}}},class extends bi{constructor(){super(...arguments),this.name="manage_object_schema_board_connection",this.type=xr.WRITE,this.annotations=yi({title:"Manage Object Schema Board Connection",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Connect or detach a board from an account-level object schema. connect: attaches a board to an object schema so it inherits the schema column structure. detach: removes one or more boards from their object schema."}getInputSchema(){return au}async executeInternal(e){if("connect"===e.action){if(!e.boardId)throw new Error("boardId is required for action=connect");if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided for action=connect");const t={boardId:e.boardId,objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName},a=await this.mondayApi.request(eu,t);return{content:{message:"Board successfully connected to object schema",connection_id:a.connect_board_to_object_schema?.id,schema_id:a.connect_board_to_object_schema?.object_schema_id}}}{if(!e.boardIds?.length)throw new Error("boardIds is required for action=detach");const t={boardIds:e.boardIds},a=(await this.mondayApi.request(tu,t)).detach_boards_from_object_schema??[],r=a.filter((e=>e.success)).length,i=a.filter((e=>!e.success));return{content:{message:`${r} board(s) successfully detached`,results:a,...i.length>0&&{failures:i}}}}}},class extends bi{constructor(){super(...arguments),this.name="manage_object_schema_columns",this.type=xr.WRITE,this.annotations=yi({title:"Manage Object Schema Columns",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create or update columns on an account-level object schema. Column changes are propagated to all boards connected to the schema. create: adds new columns. Each column requires type and title. Call get_column_type_info first to understand valid defaults per column type. update: modifies existing columns. Each entry must include column_id. Only send the columns you want to modify — other columns are unaffected. Use opt_out_by_default=true to stop a column from being auto-added to boards (opt out), or opt_out_by_default=false to restore auto-adding (opt in)."}getInputSchema(){return du}async executeInternal(e){if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided");if("create"===e.action){const t=e.columns.map((e=>{const t=e;return{type:t.type,title:t.title,description:t.description,defaults:t.defaults,opt_out_by_default:t.opt_out_by_default,policy:{can_override:t.policy?.can_override??[],cannot_delete:t.policy?.cannot_delete??!1}}})),a={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columns:t},r=await this.mondayApi.request(ru,a);return{content:{message:`Columns successfully added to object schema "${r.create_object_schema_columns?.name}"`,schema_id:r.create_object_schema_columns?.id,schema_name:r.create_object_schema_columns?.name,revision:r.create_object_schema_columns?.revision}}}{const t={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columns:e.columns.map((e=>{const t=e;return{column_id:t.column_id,title:t.title,description:t.description,defaults:t.defaults,opt_out_by_default:t.opt_out_by_default,policy:t.policy?{can_override:t.policy.can_override??[],cannot_delete:t.policy.cannot_delete??!1}:void 0}}))},a=await this.mondayApi.request(iu,t);return{content:{message:`Columns successfully updated on object schema "${a.update_object_schema_columns?.name}"`,schema_id:a.update_object_schema_columns?.id,schema_name:a.update_object_schema_columns?.name,revision:a.update_object_schema_columns?.revision}}}}},class extends bi{constructor(){super(...arguments),this.name="set_object_schema_column_active_state",this.type=xr.WRITE,this.annotations=yi({title:"Set Object Schema Column Active State",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Set the active state of a column on an account-level object schema. deactivate: soft-disables the column, preventing it from being used on new boards. The column is not deleted and can be restored. reactivate: restores a previously deactivated column, making it available again."}getInputSchema(){return lu}async executeInternal(e){if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided");const t={deactivate:ip.Deactivate,reactivate:ip.Reactivate},a={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columnId:e.columnId,action:t[e.action]},r=await this.mondayApi.request(pu,a);return{content:{message:`Column successfully ${e.action}d on object schema "${r.set_object_schema_column_active_state?.name}"`,schema_id:r.set_object_schema_column_active_state?.id,schema_name:r.set_object_schema_column_active_state?.name,revision:r.set_object_schema_column_active_state?.revision}}}}];var ny;!function(e){e.API="api",e.APPS="apps",e.ATP="atp"}(ny||(ny={}));const sy=(e,t)=>{let a=[];t?.mode===ny.APPS?a=[...gi]:t?.mode!==ny.API&&t?.mode||(a=[...oy,...iy]);const r=a.map((t=>((e,t)=>e.prototype instanceof bi?new e(t.apiClient,t.apiToken,t.context):e.prototype instanceof Kr?new e(t.apiToken):new e)(t,e)));return r.filter((e=>{if(!t)return e.type!==xr.ALL_API;if(t.mode===ny.API&&"only"===t.enableDynamicApiTools)return e.type===xr.ALL_API;let a=!1;return t.mode===ny.API&&!1===t.enableDynamicApiTools&&(a=a||e.type===xr.ALL_API),t.readOnlyMode&&(a=a||e.type!==xr.READ),t.include?a=a||!t.include?.includes(e.name):t.exclude&&(a=a||t.exclude?.includes(e.name)),!a}))};class dy{constructor(){this.dynamicTools=new Map}registerTool(e,t){const a=e.enabledByDefault??!0,r=a;this.dynamicTools.set(e.name,{instance:e,mcpTool:t,enabled:r,enabledByDefault:a}),a||t.disable()}enableTool(e){const t=this.dynamicTools.get(e);return!!t&&(t.enabled||(t.mcpTool.enable(),t.enabled=!0),!0)}disableTool(e){const t=this.dynamicTools.get(e);return!!t&&(t.enabled&&(t.mcpTool.disable(),t.enabled=!1),!0)}isToolEnabled(e){const t=this.dynamicTools.get(e);return!!t&&t.enabled}isToolEnabledByDefault(e){const t=this.dynamicTools.get(e);return!t||t.enabledByDefault}getToolsStatus(){const e={};return this.dynamicTools.forEach(((t,a)=>{e[a]=t.enabled})),e}getDynamicToolNames(){return Array.from(this.dynamicTools.keys())}getDetailedToolsStatus(){const e={};return this.dynamicTools.forEach(((t,a)=>{e[a]={enabled:t.enabled,enabledByDefault:t.enabledByDefault}})),e}resetToolToDefault(e){const t=this.dynamicTools.get(e);return!!t&&(t.enabledByDefault&&!t.enabled?(t.mcpTool.enable(),t.enabled=!0,!0):!(!t.enabledByDefault&&t.enabled)||(t.mcpTool.disable(),t.enabled=!1,!0))}getAllDynamicTools(){return this.dynamicTools}clear(){this.dynamicTools.clear()}}class py extends kr{constructor(e){super({name:"monday.com",version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),this.dynamicToolManager=new dy,this.toolInstances=[],this.managementTool=null,this.mondayApiClient=this.createApiClient(e),this.mondayApiToken=e.mondayApiToken,this.context={...e.context,apiVersion:e.mondayApiVersion??zr},this.registerTools(e)}createApiClient(e){return new r({token:e.mondayApiToken,apiVersion:e.mondayApiVersion??zr,endpoint:e.mondayApiEndpoint,requestConfig:{...e.mondayApiRequestConfig,headers:{...e.mondayApiRequestConfig?.headers||{},"user-agent":"monday-api-mcp"}}})}registerTools(e){try{this.toolInstances=this.initializeTools(e),this.toolInstances.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 Ng;e.setToolkitManager(this.dynamicToolManager),this.managementTool=e,this.registerSingleTool(this.managementTool)}initializeTools(e){const t={apiClient:this.mondayApiClient,apiToken:this.mondayApiToken,context:this.context};return sy(t,e.toolsConfiguration)}registerSingleTool(t){const a=t.getInputSchema(),r=this.registerTool(t.name,{...t,title:t.annotations?.title,description:t.getDescription(),inputSchema:a,annotations:t.annotations},(async(r,i)=>{try{let i;if(a){const o=e.object(a).safeParse(r);if(!o.success)throw new Error(`Invalid arguments: ${o.error.message}`);i=await t.execute(o.data)}else i=await t.execute();return this.formatToolResult(i.content)}catch(e){return this.handleToolError(e,t.name)}}));this.dynamicToolManager.registerTool(t,r)}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}getTools(e){const t=[...this.toolInstances];return this.managementTool&&t.push(this.managementTool),t.map((t=>({name:t.name,description:t.getDescription(),schema:this.getSchemaForTool(t,e),annotations:t.annotations,handler:this.createToolHandler(t)})))}getToolsForMcp(e){const t=[...this.toolInstances];return this.managementTool&&t.push(this.managementTool),t.map((t=>({name:t.name,description:t.getDescription(),schema:this.getSchemaForTool(t,e),annotations:t.annotations,handler:this.createMcpToolHandler(t)})))}createToolHandler(t){return async a=>{const r=t.getInputSchema();if(r){const i=e.object(r).safeParse(a);if(!i.success)throw new Error(`Invalid arguments: ${i.error.message}`);return(await t.execute(i.data)).content}return(await t.execute()).content}}createMcpToolHandler(t){return async(a,r)=>{try{const i=t.getInputSchema();if(i){const o=e.object(i).safeParse(a);if(!o.success)throw new Error(`Invalid arguments: ${o.error.message}`);const n=await t.execute(o.data,r);return this.formatToolResult(n.content)}{const e=await t.execute(void 0,r);return this.formatToolResult(e.content)}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}}}getSchemaForTool(t,r){const i=t.getInputSchema();if(i)return"json"===r?.schemaFormat?a(e.object(i)):i}formatToolResult(e){return"string"==typeof e?{content:[{type:"text",text:e}]}:{structuredContent:e,content:[{type:"text",text:JSON.stringify(e)}]}}handleToolError(e,t){return{content:[{type:"text",text:`Failed to execute tool ${t}: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}}export{dy as DynamicToolManager,py as MondayAgentToolkit};
|
|
2209
2218
|
//# sourceMappingURL=index.js.map
|