@mondaydotcomorg/agent-toolkit 5.15.0 → 5.16.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/dist/cjs/core/index.js +78 -78
- package/dist/cjs/core/index.js.map +1 -1
- package/dist/cjs/mcp/index.js +78 -78
- package/dist/cjs/mcp/index.js.map +1 -1
- package/dist/cjs/openai/index.js +78 -78
- package/dist/cjs/openai/index.js.map +1 -1
- package/dist/esm/core/index.js +78 -78
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/mcp/index.js +78 -78
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/openai/index.js +78 -78
- package/dist/esm/openai/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/mcp/index.js
CHANGED
|
@@ -1610,49 +1610,11 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
1610
1610
|
}
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
1613
|
-
`;async function Cv(e){const t=await e.request(Pv);return t.me?.account?.slug??null}function xv(e,t){return`https://${e}.monday.com/workspaces/${t}`}const Fv={userIds:e.array(e.string()).max(Ov).optional().describe("Specific user IDs to fetch.[IMPORTANT] ALWAYS use when you have user IDs in context. PREFER over general search. RETURNS: user profiles including team memberships"),teamIds:e.array(e.string()).max($v).optional().describe("Specific team IDs to fetch.[IMPORTANT] ALWAYS use when you have team IDs in context, NEVER fetch all teams if specific IDs are available.\n RETURNS: Team details with owners and optional member data."),name:e.string().optional().describe("Name-based USER search ONLY. STANDALONE parameter - cannot be combined with others. PREFERRED method for finding users when you know names. Performs fuzzy matching.\n CRITICAL: This parameter searches for USERS ONLY, NOT teams. To search for teams, use teamIds parameter instead."),getMe:e.boolean().optional().describe('[TOP PRIORITY] Use ALWAYS when requesting current user information. Examples of when it should be used: ["get my user" or "get my teams"].\n This parameter CONFLICTS with all others. '),includeTeams:e.boolean().optional().describe("[AVOID] This fetches all teams in the account. To fetch a specific user's teams just fetch that user by id and you will get their team memberships."),teamsOnly:e.boolean().optional().describe("Fetch only teams, no users returned. Combine with includeTeamMembers for member details."),includeTeamMembers:e.boolean().optional().describe("Set to true only when you need additional member details for teams other than names and ids.")};const Lv={itemId:e.number().describe("The id of the item to which the update will be added"),groupId:e.string().describe("The id of the group to which the item will be moved")};const Vv=
|
|
1614
|
-
query listWorkspaces($limit: Int!, $page: Int!, $membershipKind: WorkspaceMembershipKind!) {
|
|
1615
|
-
workspaces(limit: $limit, page: $page, membership_kind: $membershipKind) {
|
|
1616
|
-
id
|
|
1617
|
-
name
|
|
1618
|
-
description
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
`,Hv=100,Gv=e=>e.toLocaleLowerCase().replace(/[^\p{L}\d]/gu,"");function Wv(e){const t=e.workspaces?.filter((e=>null!==e));return t||[]}function Qv(e){return Array.isArray(e)&&e.length>0}const zv={searchTerm:e.string().optional().describe("Optional search term used to filter workspaces. [IMPORTANT] Only alphanumeric characters are supported."),limit:e.number().min(1).max(Hv).default(Hv).describe("Number of workspaces to return. Default is (100), lower for a smaller response size"),page:e.number().min(1).default(1).describe("Page number to return. Default is 1.")};const Yv=Em`
|
|
1622
|
-
query getItemBoard($itemId: ID!) {
|
|
1623
|
-
items(ids: [$itemId]) {
|
|
1624
|
-
id
|
|
1625
|
-
board {
|
|
1626
|
-
id
|
|
1627
|
-
columns {
|
|
1628
|
-
id
|
|
1629
|
-
type
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
`,Kv=Em`
|
|
1635
|
-
mutation createDoc($location: CreateDocInput!, $docOwnerIds: [ID!]) {
|
|
1636
|
-
create_doc(location: $location, doc_owner_ids: $docOwnerIds) {
|
|
1637
|
-
id
|
|
1638
|
-
object_id
|
|
1639
|
-
url
|
|
1640
|
-
name
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
`,Jv=Em`
|
|
1644
|
-
mutation addContentToDocFromMarkdown($docId: ID!, $markdown: String!, $afterBlockId: String) {
|
|
1645
|
-
add_content_to_doc_from_markdown(docId: $docId, markdown: $markdown, afterBlockId: $afterBlockId) {
|
|
1646
|
-
success
|
|
1647
|
-
block_ids
|
|
1648
|
-
error
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
`,Xv=Em`
|
|
1613
|
+
`;async function Cv(e){const t=await e.request(Pv);return t.me?.account?.slug??null}function xv(e,t){return`https://${e}.monday.com/workspaces/${t}`}const Fv={userIds:e.array(e.string()).max(Ov).optional().describe("Specific user IDs to fetch.[IMPORTANT] ALWAYS use when you have user IDs in context. PREFER over general search. RETURNS: user profiles including team memberships"),teamIds:e.array(e.string()).max($v).optional().describe("Specific team IDs to fetch.[IMPORTANT] ALWAYS use when you have team IDs in context, NEVER fetch all teams if specific IDs are available.\n RETURNS: Team details with owners and optional member data."),name:e.string().optional().describe("Name-based USER search ONLY. STANDALONE parameter - cannot be combined with others. PREFERRED method for finding users when you know names. Performs fuzzy matching.\n CRITICAL: This parameter searches for USERS ONLY, NOT teams. To search for teams, use teamIds parameter instead."),getMe:e.boolean().optional().describe('[TOP PRIORITY] Use ALWAYS when requesting current user information. Examples of when it should be used: ["get my user" or "get my teams"].\n This parameter CONFLICTS with all others. '),includeTeams:e.boolean().optional().describe("[AVOID] This fetches all teams in the account. To fetch a specific user's teams just fetch that user by id and you will get their team memberships."),teamsOnly:e.boolean().optional().describe("Fetch only teams, no users returned. Combine with includeTeamMembers for member details."),includeTeamMembers:e.boolean().optional().describe("Set to true only when you need additional member details for teams other than names and ids.")};const Lv={itemId:e.number().describe("The id of the item to which the update will be added"),groupId:e.string().describe("The id of the group to which the item will be moved")};const Vv=Em`
|
|
1652
1614
|
mutation updateDocName($docId: ID!, $name: String!) {
|
|
1653
1615
|
update_doc_name(docId: $docId, name: $name)
|
|
1654
1616
|
}
|
|
1655
|
-
`,
|
|
1617
|
+
`,jv=Em`
|
|
1656
1618
|
mutation addContentToDocFromMarkdown($docId: ID!, $markdown: String!, $afterBlockId: String) {
|
|
1657
1619
|
add_content_to_doc_from_markdown(docId: $docId, markdown: $markdown, afterBlockId: $afterBlockId) {
|
|
1658
1620
|
success
|
|
@@ -1660,41 +1622,13 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
1660
1622
|
error
|
|
1661
1623
|
}
|
|
1662
1624
|
}
|
|
1663
|
-
`,
|
|
1664
|
-
query getDocByObjectId($objectId: [ID!]) {
|
|
1665
|
-
docs(object_ids: $objectId) {
|
|
1666
|
-
id
|
|
1667
|
-
name
|
|
1668
|
-
url
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
`,rg=Em`
|
|
1672
|
-
query getDocById($docId: [ID!]) {
|
|
1673
|
-
docs(ids: $docId) {
|
|
1674
|
-
id
|
|
1675
|
-
name
|
|
1676
|
-
url
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
`,og={doc_id:e.string().min(1).optional().describe("The document ID (the id field returned by read_docs). Provide this OR object_id. Takes priority if both are provided."),object_id:e.string().min(1).optional().describe("The document object ID (the object_id field from read_docs, also visible in the document URL). Will be resolved to a doc_id. Provide this OR doc_id."),markdown:e.string().describe("Markdown content to add to the document."),after_block_id:e.string().optional().describe("Block ID after which to insert the new content. If omitted, content is appended at the end. To insert at the beginning, pass the first block ID from read_docs. Block IDs can be obtained from read_docs or from a previous add_content_to_doc response.")};const ng=Em`
|
|
1680
|
-
mutation updateDocName($docId: ID!, $name: String!) {
|
|
1681
|
-
update_doc_name(docId: $docId, name: $name)
|
|
1682
|
-
}
|
|
1683
|
-
`,sg=Em`
|
|
1684
|
-
mutation addContentToDocFromMarkdown($docId: ID!, $markdown: String!, $afterBlockId: String) {
|
|
1685
|
-
add_content_to_doc_from_markdown(docId: $docId, markdown: $markdown, afterBlockId: $afterBlockId) {
|
|
1686
|
-
success
|
|
1687
|
-
block_ids
|
|
1688
|
-
error
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
`,dg=Em`
|
|
1625
|
+
`,Uv=Em`
|
|
1692
1626
|
query getDocIdByObjectId($objectId: [ID!]) {
|
|
1693
1627
|
docs(object_ids: $objectId) {
|
|
1694
1628
|
id
|
|
1695
1629
|
}
|
|
1696
1630
|
}
|
|
1697
|
-
`,
|
|
1631
|
+
`,Mv=Em`
|
|
1698
1632
|
mutation updateDocBlock($blockId: String!, $content: JSON!) {
|
|
1699
1633
|
update_doc_block(block_id: $blockId, content: $content) {
|
|
1700
1634
|
id
|
|
@@ -1702,20 +1636,20 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
1702
1636
|
created_at
|
|
1703
1637
|
}
|
|
1704
1638
|
}
|
|
1705
|
-
`,
|
|
1639
|
+
`,Bv=Em`
|
|
1706
1640
|
mutation deleteDocBlock($blockId: String!) {
|
|
1707
1641
|
delete_doc_block(block_id: $blockId) {
|
|
1708
1642
|
id
|
|
1709
1643
|
}
|
|
1710
1644
|
}
|
|
1711
|
-
`,
|
|
1645
|
+
`,qv=Em`
|
|
1712
1646
|
query getDocObjectIdByDocId($docId: [ID!]) {
|
|
1713
1647
|
docs(ids: $docId) {
|
|
1714
1648
|
id
|
|
1715
1649
|
object_id
|
|
1716
1650
|
}
|
|
1717
1651
|
}
|
|
1718
|
-
`,
|
|
1652
|
+
`,Hv=Em`
|
|
1719
1653
|
query getDocBoardItem($boardId: ID!) {
|
|
1720
1654
|
boards(ids: [$boardId]) {
|
|
1721
1655
|
items_page(limit: 1) {
|
|
@@ -1725,7 +1659,7 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
1725
1659
|
}
|
|
1726
1660
|
}
|
|
1727
1661
|
}
|
|
1728
|
-
`,
|
|
1662
|
+
`,Gv=Em`
|
|
1729
1663
|
query getDocBlockContent($docId: [ID!]) {
|
|
1730
1664
|
docs(ids: $docId) {
|
|
1731
1665
|
blocks {
|
|
@@ -1735,7 +1669,7 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
1735
1669
|
}
|
|
1736
1670
|
}
|
|
1737
1671
|
}
|
|
1738
|
-
`,
|
|
1672
|
+
`,Wv=Em`
|
|
1739
1673
|
mutation createDocComment($itemId: ID!, $body: String!, $parentId: ID, $mentionsList: [UpdateMention]) {
|
|
1740
1674
|
create_update(body: $body, item_id: $itemId, parent_id: $parentId, mentions_list: $mentionsList) {
|
|
1741
1675
|
id
|
|
@@ -1743,7 +1677,7 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
1743
1677
|
created_at
|
|
1744
1678
|
}
|
|
1745
1679
|
}
|
|
1746
|
-
`,
|
|
1680
|
+
`,Qv=Em`
|
|
1747
1681
|
mutation createDocBlocks($docId: ID!, $afterBlockId: String, $blocksInput: [CreateBlockInput!]!) {
|
|
1748
1682
|
create_doc_blocks(docId: $docId, afterBlockId: $afterBlockId, blocksInput: $blocksInput) {
|
|
1749
1683
|
id
|
|
@@ -1811,7 +1745,73 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
1811
1745
|
}
|
|
1812
1746
|
}
|
|
1813
1747
|
}
|
|
1814
|
-
`;function vg(e){if(e)return e}function gg(e){if(e)return e}function _g(e){if(e)return{bold:e.bold,italic:e.italic,underline:e.underline,strike:e.strike,code:e.code,link:e.link,color:e.color,background:e.background}}function bg(e){return e.map((e=>{if("mention"in e.insert){const t=Number(e.insert.mention.id);if(Number.isNaN(t))throw new Error(`Invalid mention id: "${e.insert.mention.id}" is not a valid numeric ID`);return{insert:{blot:{mention:{id:String(t),type:e.insert.mention.type}}}}}return"column_value"in e.insert?{insert:{blot:{column_value:{item_id:String(e.insert.column_value.item_id),column_id:e.insert.column_value.column_id}}}}:{insert:{text:e.insert.text},attributes:_g(e.attributes)}}))}function yg(e){return e.map((e=>{if("mention"in e.insert){const t=Number(e.insert.mention.id);if(Number.isNaN(t))throw new Error(`Invalid mention id: "${e.insert.mention.id}" is not a valid numeric ID`);return{insert:{mention:{id:t,type:e.insert.mention.type}}}}return"column_value"in e.insert?{insert:{macro:{type:"COLUMN_VALUE",macroId:n(),macroData:{itemId:Number(e.insert.column_value.item_id),columnId:e.insert.column_value.column_id}}}}:{insert:e.insert.text,attributes:_g(e.attributes)}}))}function wg(e,t){const a=e.attributes||{},i=a.comments||[];return{...e,attributes:{...a,comments:[...i,t]}}}function Ig(e,t,a,i){const r=a+i;let o=0;const n=[];for(const i of e){const e=i.insert;if(null==e)throw new Error(`Unexpected delta op at position ${o}: op has no 'insert' field. Block content may be from an unsupported block type.`);const s=o,d=s+("string"==typeof e?e.length:1),p=Math.max(s,a),l=Math.min(d,r);p>=l?n.push(i):"string"!=typeof e?n.push(wg(i,t)):(p>s&&n.push({...i,insert:e.slice(0,p-s)}),n.push(wg({...i,insert:e.slice(p-s,l-s)},t)),l<d&&n.push({...i,insert:e.slice(l-s)})),o=d}return n}const Tg=e.object({bold:e.boolean().optional(),italic:e.boolean().optional(),underline:e.boolean().optional(),strike:e.boolean().optional(),code:e.boolean().optional(),link:e.string().optional(),color:e.string().optional(),background:e.string().optional()}).optional(),Eg=e.object({mention:e.object({id:e.union([e.string(),e.number()]).describe("User, doc, or board ID. Get user IDs from list_users_and_teams."),type:e.enum(["USER","DOC","BOARD"]).default("USER").describe("Mention type. USER is most common.")}).describe("Mention blot — tags a user, doc, or board inline. Do not set attributes on mention ops.")}),Sg=e.object({column_value:e.object({item_id:e.union([e.string(),e.number()]).describe("The board item ID."),column_id:e.string().describe('The column ID (e.g. "status", "date4"). Get column IDs from get_board_schema.')}).describe("Column value blot — embeds a live board column value inline in the doc.")}),Dg=e.object({insert:e.union([e.string().transform((e=>({text:e}))),e.object({text:e.string()}),Eg,Sg]).describe('Content to insert. Use {text: "..."} for plain text, {mention: {id, type}} to tag a user/doc/board, or {column_value: {item_id, column_id}} to embed a live column value. The last operation in the array must be {text: "\\n"}.'),attributes:Tg.describe("Optional formatting: bold, italic, underline, strike, code, link, color, background. Not applicable to mention or column_value ops.")}),Ng=e.object({block_content_type:e.literal("text"),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),alignment:e.enum(["LEFT","RIGHT","CENTER"]).optional(),direction:e.enum(["LTR","RTL"]).optional()}),Ag=e.object({block_content_type:e.literal("code"),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),language:e.string().optional().describe('Programming language (e.g. "javascript", "python").')}),kg=e.object({block_content_type:e.literal("list_item"),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),checked:e.boolean().optional().describe("Check state for CHECK_LIST items."),indentation:e.number().int().min(0).optional().describe("Nesting level (0 = no indent).")}),Og=e.discriminatedUnion("block_content_type",[Ng,Ag,kg]),$g=e.object({block_type:e.literal("text"),text_block_type:e.enum(["NORMAL_TEXT","LARGE_TITLE","MEDIUM_TITLE","SMALL_TITLE","QUOTE"]).optional().describe("Block subtype. LARGE_TITLE=H1, MEDIUM_TITLE=H2, SMALL_TITLE=H3."),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),alignment:e.enum(["LEFT","RIGHT","CENTER"]).optional(),direction:e.enum(["LTR","RTL"]).optional()}),Rg=e.object({block_type:e.literal("list_item"),list_block_type:e.enum(["BULLETED_LIST","NUMBERED_LIST","CHECK_LIST"]).optional().describe("List type. Defaults to BULLETED_LIST."),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),indentation:e.number().int().min(0).optional().describe("Nesting level (0 = no indent).")}),Pg=e.object({block_type:e.literal("code"),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),language:e.string().optional().describe('Programming language (e.g. "javascript", "python").')}),Cg=e.object({block_type:e.literal("divider")}),xg=e.object({block_type:e.literal("page_break")}),Fg=e.object({block_type:e.literal("image"),public_url:e.string().url().optional().describe("Publicly accessible image URL. Provide either public_url or asset_id."),asset_id:e.union([e.number().int(),e.string().regex(/^\d+$/).transform(Number)]).optional().describe("monday.com asset ID for the image. The image block will reference the asset directly. Provide either public_url or asset_id."),width:e.number().int().min(1).optional().describe("Width in pixels.")}),Lg=e.object({block_type:e.literal("video"),raw_url:e.string().url().describe("Video URL (YouTube, Vimeo, or direct video URL)."),width:e.number().int().min(1).optional().describe("Width in pixels.")}),Vg=e.object({block_type:e.literal("notice_box"),theme:e.enum(["INFO","TIPS","WARNING","GENERAL"]).describe("Visual style of the notice box.")}),jg=e.object({block_type:e.literal("table"),row_count:e.number().int().min(1).max(25).describe("Number of rows (1–25)."),column_count:e.number().int().min(1).max(10).describe("Number of columns (1–10)."),width:e.number().int().optional().describe("Table width in pixels."),column_style:e.array(e.object({width:e.number().int()})).optional().describe("Column widths. Array length must match column_count. Widths must sum to 100.")}),Ug=e.object({block_type:e.literal("layout"),column_count:e.number().int().min(2).max(6).describe("Number of columns (2–6)."),column_style:e.array(e.object({width:e.number().int()})).optional().describe("Column widths. Array length must match column_count. Widths must sum to 100.")}),Mg=e.discriminatedUnion("block_type",[$g,Rg,Pg,Cg,xg,Fg,Lg,Vg,jg,Ug]),Bg=e.object({operation_type:e.literal("set_name"),name:e.string().min(1).describe("New document name.")}),qg=e.object({operation_type:e.literal("add_markdown_content"),markdown:e.string().describe("Markdown content to convert and append (or insert) as blocks."),after_block_id:e.string().optional().describe("Insert after this block ID. Omit to append at end. Block IDs come from read_docs.")}),Hg=e.object({operation_type:e.literal("update_block"),block_id:e.string().describe("ID of the block to update. Get block IDs from read_docs."),content:Og.describe("New content for the block. Use block_content_type to select: text (updates text/heading/quote content), code (updates code content), list_item (updates bullets/numbered/todo content). Cannot change block subtype — use replace_block for that.")}),Gg=e.object({operation_type:e.literal("create_block"),after_block_id:e.string().optional().describe("Insert after this block ID. Omit to append at end. Block IDs come from read_docs."),parent_block_id:e.string().optional().describe("Parent block ID for nested blocks. Only works for notice_box containers — use the notice_box block ID directly. Table/layout cell nesting is NOT supported by the API. IMPORTANT: A notice_box created in the same call cannot be referenced — use a separate call first to create it, then a second call to nest content inside it."),block:Mg.describe("The block to create. Use block_type to select the block type.")}),Wg=e.object({operation_type:e.literal("delete_block"),block_id:e.string().describe("ID of the block to permanently delete. Works for all block types including BOARD, WIDGET, DOC embed, GIPHY.")}),Qg=e.object({operation_type:e.literal("replace_block"),block_id:e.string().describe("ID of the block to delete."),after_block_id:e.string().optional().describe("Insert replacement after this block ID. Provide the ID of the block that precedes the deleted block."),parent_block_id:e.string().optional().describe("Parent block ID for the replacement block."),block:Mg.describe("The new block to create in place of the deleted one.")}),zg=e.object({operation_type:e.literal("add_comment"),body:e.string().min(1).describe("The comment text. Use HTML tags for formatting (not markdown). Do not use @ to mention users — use mentions_list instead."),parent_update_id:e.number().optional().describe("The ID of an existing comment (update) to reply to. Omit to create a new top-level comment. Get comment IDs from read_docs with include_comments: true."),mentions_list:e.string().optional().describe('Optional JSON array of mentions: [{"id": "123", "type": "User"}, {"id": "456", "type": "Team"}]. Valid types: User, Team, Board, Project.'),block_id:e.union([e.string(),e.array(e.string()).min(1)]).optional().describe("Block ID (string) or array of block IDs to anchor the comment to. When an array is provided, the same comment highlights all specified blocks. Only works on text-content blocks (text, code, list_item, title, quote) — not on divider, table, layout, notice_box, image, video, or giphy. Get block IDs from read_docs with include_blocks: true. Omit to create a general doc-level comment. Pair with selection_from + selection_length (single block_id only) to comment on a specific text range."),selection_from:e.number().int().min(0).optional().describe("Start character offset (0-indexed) of the selected text within the block. Requires block_id. Omit to comment on the entire block."),selection_length:e.number().int().min(1).optional().describe("Number of characters in the text selection. Requires block_id and selection_from. Only works for text, code, and list_item blocks that have a delta format.")}),Yg=e.discriminatedUnion("operation_type",[Bg,qg,Hg,Gg,Wg,Qg,zg]),Kg={doc_id:e.string().min(1).optional().describe("The document ID (the id field from read_docs). Takes priority over object_id if both are provided."),object_id:e.string().min(1).optional().describe("The document object ID (the object_id field from read_docs, visible in the document URL). Resolved to doc_id."),operations:e.array(Yg).min(1).max(25).describe('Ordered list of operations to perform. Executed sequentially. Stops at first failure.\n\nOperation types:\n- set_name: Rename the document.\n- add_markdown_content: Append markdown as blocks (simplest for text/lists/tables).\n- update_block: Change content of an existing text/code/list/divider block.\n- create_block: Create a new block at a specific position (supports text, list_item, code, divider, page_break, image, video, notice_box, table, layout).\n- delete_block: Permanently remove a block. Works for ALL block types including BOARD, WIDGET, DOC embed, GIPHY.\n- replace_block: Delete a block and create a new one in its place. Use for: changing image/video source, table restructure, notice_box theme change.\n- add_comment: Create a new comment or reply on the document. Use parent_update_id to reply to an existing comment. Format text with HTML. Uses the doc\'s backing board item.\n\nWHEN TO USE WHICH:\n- Adding new text sections → add_markdown_content\n- Adding asset-based images → create_block with block_type "image" and asset_id (add_markdown_content does NOT support asset images)\n- Mixed content with asset images → alternate add_markdown_content (for text) and create_block (for each image) in sequence\n- Editing existing text block → update_block\n- Changing an image URL → replace_block (image URL is immutable after creation)\n- Changing video URL → replace_block\n- Restructuring a table → replace_block\n- BOARD/WIDGET/DOC/GIPHY blocks → delete_block only (no public API to create these)\n\nNESTING CONTENT IN CONTAINERS:\n- notice_box: Fully supported. Create the notice_box first, then in a separate call create child blocks with parent_block_id set to the notice_box ID. You cannot reference a block ID created in the same call.\n- table: Cell-level API nesting is NOT supported. To create a table with content, use add_markdown_content with a markdown table (e.g. "| H1 | H2 |\\n| --- | --- |\\n| A | B |"). This creates a pre-populated table in one shot. Empty tables created via create_block cannot have their cells populated through the API.\n- layout: Cell-level API nesting is NOT supported and there is no markdown equivalent. Layouts can only be created empty via create_block. No workaround exists to populate layout columns through the API.\nDeleting a container does NOT delete its children — delete children first for clean removal.\n\nBlock IDs are available in the blocks array returned by read_docs.')};const Jg=Em`
|
|
1748
|
+
`,zv="content",Yv="version_history",Kv=e.enum(["ids","object_ids","workspace_ids"]),Jv={mode:e.enum([zv,Yv]).optional().default(zv).describe('The operation mode. "content" (default) fetches documents with their markdown content. "version_history" fetches the edit history of a single document.'),type:Kv.optional().describe('Query type for content mode: "ids", "object_ids", or "workspace_ids". Required when mode is "content".'),ids:e.array(e.string()).optional().describe('Array of ID values. In content mode: matches the query type (ids/object_ids/workspace_ids). In version_history mode: provide the single document object_id here (e.g., ids: ["5001466606"]).'),limit:e.number().optional().describe("Number of docs per page (default: 25). Only used in content mode."),order_by:e.nativeEnum(Ep).optional().describe("Order in which to retrieve docs. Only used in content mode."),page:e.number().optional().describe("Page number to return (starts at 1). Only used in content mode."),include_blocks:e.boolean().optional().default(!1).describe("If true, includes the blocks array (block IDs, types, positions, content) in the response. Required when you plan to call update_doc. Defaults to false to reduce response size. Only used in content mode."),blocks_limit:e.number().optional().describe("Maximum number of blocks to return per document (default: 25). Only used in content mode when include_blocks is true."),blocks_page:e.number().optional().describe("Page number for block pagination, starting at 1. Omit to use the API default. Use with blocks_limit to page through documents with more than 25 blocks. Only used in content mode when include_blocks is true."),include_comments:e.boolean().optional().default(!1).describe("If true, fetches all comments and replies on the document. Comments are stored at the item level within the doc backing board. Defaults to false. Only used in content mode."),comments_limit:e.number().optional().default(50).describe("Maximum number of comments (updates) to fetch per item when include_comments is true. Defaults to 50. Only used in content mode."),version_history_limit:e.number().optional().describe('Maximum number of restoring points to return. Use this when the user asks for "last N changes". Only used in version_history mode.'),since:e.string().optional().describe('ISO 8601 date string to filter version history from (e.g., "2026-03-15T00:00:00Z"). If omitted, returns the full history. Only used in version_history mode.'),until:e.string().optional().describe('ISO 8601 date string to filter version history until (e.g., "2026-03-16T23:59:59Z"). Defaults to now. Only used in version_history mode.'),include_diff:e.boolean().optional().default(!1).describe("If true, fetches content diffs between consecutive restoring points. May be slower due to additional API calls. Only used in version_history mode.")};const Xv={workspace_id:e.number().describe("The ID of the workspace to get information for")};const Zv=Em`
|
|
1749
|
+
query listWorkspaces($limit: Int!, $page: Int!, $membershipKind: WorkspaceMembershipKind!) {
|
|
1750
|
+
workspaces(limit: $limit, page: $page, membership_kind: $membershipKind) {
|
|
1751
|
+
id
|
|
1752
|
+
name
|
|
1753
|
+
description
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
`,eg=100,tg=e=>e.toLocaleLowerCase().replace(/[^\p{L}\d]/gu,"");function ag(e){const t=e.workspaces?.filter((e=>null!==e));return t||[]}function ig(e){return Array.isArray(e)&&e.length>0}const rg={searchTerm:e.string().optional().describe("Optional search term used to filter workspaces. [IMPORTANT] Only alphanumeric characters are supported."),limit:e.number().min(1).max(eg).default(eg).describe("Number of workspaces to return. Default is (100), lower for a smaller response size"),page:e.number().min(1).default(1).describe("Page number to return. Default is 1.")};const og=Em`
|
|
1757
|
+
query getItemBoard($itemId: ID!) {
|
|
1758
|
+
items(ids: [$itemId]) {
|
|
1759
|
+
id
|
|
1760
|
+
board {
|
|
1761
|
+
id
|
|
1762
|
+
columns {
|
|
1763
|
+
id
|
|
1764
|
+
type
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
`,ng=Em`
|
|
1770
|
+
mutation createDoc($location: CreateDocInput!, $docOwnerIds: [ID!]) {
|
|
1771
|
+
create_doc(location: $location, doc_owner_ids: $docOwnerIds) {
|
|
1772
|
+
id
|
|
1773
|
+
object_id
|
|
1774
|
+
url
|
|
1775
|
+
name
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
`,sg=Em`
|
|
1779
|
+
mutation addContentToDocFromMarkdown($docId: ID!, $markdown: String!, $afterBlockId: String) {
|
|
1780
|
+
add_content_to_doc_from_markdown(docId: $docId, markdown: $markdown, afterBlockId: $afterBlockId) {
|
|
1781
|
+
success
|
|
1782
|
+
block_ids
|
|
1783
|
+
error
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
`,dg=Em`
|
|
1787
|
+
mutation updateDocName($docId: ID!, $name: String!) {
|
|
1788
|
+
update_doc_name(docId: $docId, name: $name)
|
|
1789
|
+
}
|
|
1790
|
+
`,pg=e.enum(["workspace","item"]),lg=e.discriminatedUnion("type",[e.object({type:e.literal(pg.enum.workspace).describe("Create document in workspace"),workspace_id:e.number().describe("Workspace ID under which to create the new document"),doc_kind:e.nativeEnum(Yd).optional().describe("Document kind (public/private/share). Defaults to public."),folder_id:e.number().optional().describe("Optional folder ID to place the document inside a specific folder")}),e.object({type:e.literal(pg.enum.item).describe("Create document attached to item"),item_id:e.number().describe("Item ID to attach the new document to"),column_id:e.string().optional().describe("ID of an existing 'doc' column on the board which contains the item. If not provided, the tool will create a new doc column automatically when creating a doc on an item.")})]),cg={doc_name:e.string().describe("Name for the new document."),markdown:e.string().describe("Markdown content that will be imported into the newly created document as blocks."),location:e.enum(["workspace","item"]).describe("Location where the document should be created - either in a workspace or attached to an item"),docOwnerIds:e.array(e.string()).min(1).optional().describe("Optional list of user IDs to set as document owners at creation time. Use this to add the agent owner so they retain access to the document. Ownership is set inside the creation mutation itself, bypassing the permission checks that would block a subsequent add_subscribers_to_object call."),workspace_id:e.number().optional().describe('[REQUIRED - use only when location="workspace"] Workspace ID under which to create the new document'),doc_kind:e.nativeEnum(Yd).optional().describe('[OPTIONAL - use only when location="workspace"] Document kind (public/private/share). Defaults to public.'),folder_id:e.number().optional().describe('[OPTIONAL - use only when location="workspace"] Optional folder ID to place the document inside a specific folder'),item_id:e.number().optional().describe('[REQUIRED - use only when location="item"] Item ID to attach the new document to'),column_id:e.string().optional().describe('[OPTIONAL - use only when location="item"] ID of an existing "doc" column on the board which contains the item. If not provided, the tool will create a new doc column automatically when creating a doc on an item.')};const mg=Em`
|
|
1791
|
+
mutation addContentToDocFromMarkdown($docId: ID!, $markdown: String!, $afterBlockId: String) {
|
|
1792
|
+
add_content_to_doc_from_markdown(docId: $docId, markdown: $markdown, afterBlockId: $afterBlockId) {
|
|
1793
|
+
success
|
|
1794
|
+
block_ids
|
|
1795
|
+
error
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
`,ug=Em`
|
|
1799
|
+
query getDocByObjectId($objectId: [ID!]) {
|
|
1800
|
+
docs(object_ids: $objectId) {
|
|
1801
|
+
id
|
|
1802
|
+
name
|
|
1803
|
+
url
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
`,hg=Em`
|
|
1807
|
+
query getDocById($docId: [ID!]) {
|
|
1808
|
+
docs(ids: $docId) {
|
|
1809
|
+
id
|
|
1810
|
+
name
|
|
1811
|
+
url
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
`,fg={doc_id:e.string().min(1).optional().describe("The document ID (the id field returned by read_docs). Provide this OR object_id. Takes priority if both are provided."),object_id:e.string().min(1).optional().describe("The document object ID (the object_id field from read_docs, also visible in the document URL). Will be resolved to a doc_id. Provide this OR doc_id."),markdown:e.string().describe("Markdown content to add to the document."),after_block_id:e.string().optional().describe("Block ID after which to insert the new content. If omitted, content is appended at the end. To insert at the beginning, pass the first block ID from read_docs. Block IDs can be obtained from read_docs or from a previous add_content_to_doc response.")};function vg(e){if(e)return e}function gg(e){if(e)return e}function _g(e){if(e)return{bold:e.bold,italic:e.italic,underline:e.underline,strike:e.strike,code:e.code,link:e.link,color:e.color,background:e.background}}function bg(e){return e.map((e=>{if("mention"in e.insert){const t=Number(e.insert.mention.id);if(Number.isNaN(t))throw new Error(`Invalid mention id: "${e.insert.mention.id}" is not a valid numeric ID`);return{insert:{blot:{mention:{id:String(t),type:e.insert.mention.type}}}}}return"column_value"in e.insert?{insert:{blot:{column_value:{item_id:String(e.insert.column_value.item_id),column_id:e.insert.column_value.column_id}}}}:{insert:{text:e.insert.text},attributes:_g(e.attributes)}}))}function yg(e){return e.map((e=>{if("mention"in e.insert){const t=Number(e.insert.mention.id);if(Number.isNaN(t))throw new Error(`Invalid mention id: "${e.insert.mention.id}" is not a valid numeric ID`);return{insert:{mention:{id:t,type:e.insert.mention.type}}}}return"column_value"in e.insert?{insert:{macro:{type:"COLUMN_VALUE",macroId:n(),macroData:{itemId:Number(e.insert.column_value.item_id),columnId:e.insert.column_value.column_id}}}}:{insert:e.insert.text,attributes:_g(e.attributes)}}))}function wg(e,t){const a=e.attributes||{},i=a.comments||[];return{...e,attributes:{...a,comments:[...i,t]}}}function Ig(e,t,a,i){const r=a+i;let o=0;const n=[];for(const i of e){const e=i.insert;if(null==e)throw new Error(`Unexpected delta op at position ${o}: op has no 'insert' field. Block content may be from an unsupported block type.`);const s=o,d=s+("string"==typeof e?e.length:1),p=Math.max(s,a),l=Math.min(d,r);p>=l?n.push(i):"string"!=typeof e?n.push(wg(i,t)):(p>s&&n.push({...i,insert:e.slice(0,p-s)}),n.push(wg({...i,insert:e.slice(p-s,l-s)},t)),l<d&&n.push({...i,insert:e.slice(l-s)})),o=d}return n}const Tg=e.object({bold:e.boolean().optional(),italic:e.boolean().optional(),underline:e.boolean().optional(),strike:e.boolean().optional(),code:e.boolean().optional(),link:e.string().optional(),color:e.string().optional(),background:e.string().optional()}).optional(),Eg=e.object({mention:e.object({id:e.union([e.string(),e.number()]).describe("User, doc, or board ID. Get user IDs from list_users_and_teams."),type:e.enum(["USER","DOC","BOARD"]).default("USER").describe("Mention type. USER is most common.")}).describe("Mention blot — tags a user, doc, or board inline. Do not set attributes on mention ops.")}),Sg=e.object({column_value:e.object({item_id:e.union([e.string(),e.number()]).describe("The board item ID."),column_id:e.string().describe('The column ID (e.g. "status", "date4"). Get column IDs from get_board_schema.')}).describe("Column value blot — embeds a live board column value inline in the doc.")}),Dg=e.object({insert:e.union([e.string().transform((e=>({text:e}))),e.object({text:e.string()}),Eg,Sg]).describe('Content to insert. Use {text: "..."} for plain text, {mention: {id, type}} to tag a user/doc/board, or {column_value: {item_id, column_id}} to embed a live column value. The last operation in the array must be {text: "\\n"}.'),attributes:Tg.describe("Optional formatting: bold, italic, underline, strike, code, link, color, background. Not applicable to mention or column_value ops.")}),Ng=e.object({block_content_type:e.literal("text"),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),alignment:e.enum(["LEFT","RIGHT","CENTER"]).optional(),direction:e.enum(["LTR","RTL"]).optional()}),Ag=e.object({block_content_type:e.literal("code"),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),language:e.string().optional().describe('Programming language (e.g. "javascript", "python").')}),kg=e.object({block_content_type:e.literal("list_item"),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),checked:e.boolean().optional().describe("Check state for CHECK_LIST items."),indentation:e.number().int().min(0).optional().describe("Nesting level (0 = no indent).")}),Og=e.discriminatedUnion("block_content_type",[Ng,Ag,kg]),$g=e.object({block_type:e.literal("text"),text_block_type:e.enum(["NORMAL_TEXT","LARGE_TITLE","MEDIUM_TITLE","SMALL_TITLE","QUOTE"]).optional().describe("Block subtype. LARGE_TITLE=H1, MEDIUM_TITLE=H2, SMALL_TITLE=H3."),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),alignment:e.enum(["LEFT","RIGHT","CENTER"]).optional(),direction:e.enum(["LTR","RTL"]).optional()}),Rg=e.object({block_type:e.literal("list_item"),list_block_type:e.enum(["BULLETED_LIST","NUMBERED_LIST","CHECK_LIST"]).optional().describe("List type. Defaults to BULLETED_LIST."),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),indentation:e.number().int().min(0).optional().describe("Nesting level (0 = no indent).")}),Pg=e.object({block_type:e.literal("code"),delta_format:e.array(Dg).min(1).describe('Array of delta operations. Last op must be {insert: {text: "\\n"}}.'),language:e.string().optional().describe('Programming language (e.g. "javascript", "python").')}),Cg=e.object({block_type:e.literal("divider")}),xg=e.object({block_type:e.literal("page_break")}),Fg=e.object({block_type:e.literal("image"),public_url:e.string().url().optional().describe("Publicly accessible image URL. Provide either public_url or asset_id."),asset_id:e.union([e.number().int(),e.string().regex(/^\d+$/).transform(Number)]).optional().describe("monday.com asset ID for the image. The image block will reference the asset directly. Provide either public_url or asset_id."),width:e.number().int().min(1).optional().describe("Width in pixels.")}),Lg=e.object({block_type:e.literal("video"),raw_url:e.string().url().describe("Video URL (YouTube, Vimeo, or direct video URL)."),width:e.number().int().min(1).optional().describe("Width in pixels.")}),Vg=e.object({block_type:e.literal("notice_box"),theme:e.enum(["INFO","TIPS","WARNING","GENERAL"]).describe("Visual style of the notice box.")}),jg=e.object({block_type:e.literal("table"),row_count:e.number().int().min(1).max(25).describe("Number of rows (1–25)."),column_count:e.number().int().min(1).max(10).describe("Number of columns (1–10)."),width:e.number().int().optional().describe("Table width in pixels."),column_style:e.array(e.object({width:e.number().int()})).optional().describe("Column widths. Array length must match column_count. Widths must sum to 100.")}),Ug=e.object({block_type:e.literal("layout"),column_count:e.number().int().min(2).max(6).describe("Number of columns (2–6)."),column_style:e.array(e.object({width:e.number().int()})).optional().describe("Column widths. Array length must match column_count. Widths must sum to 100.")}),Mg=e.discriminatedUnion("block_type",[$g,Rg,Pg,Cg,xg,Fg,Lg,Vg,jg,Ug]),Bg=e.object({operation_type:e.literal("set_name"),name:e.string().min(1).describe("New document name.")}),qg=e.object({operation_type:e.literal("add_markdown_content"),markdown:e.string().describe("Markdown content to convert and append (or insert) as blocks."),after_block_id:e.string().optional().describe("Insert after this block ID. Omit to append at end. Block IDs come from read_docs.")}),Hg=e.object({operation_type:e.literal("update_block"),block_id:e.string().describe("ID of the block to update. Get block IDs from read_docs."),content:Og.describe("New content for the block. Use block_content_type to select: text (updates text/heading/quote content), code (updates code content), list_item (updates bullets/numbered/todo content). Cannot change block subtype — use replace_block for that.")}),Gg=e.object({operation_type:e.literal("create_block"),after_block_id:e.string().optional().describe("Insert after this block ID. Omit to append at end. Block IDs come from read_docs."),parent_block_id:e.string().optional().describe("Parent block ID for nested blocks. Only works for notice_box containers — use the notice_box block ID directly. Table/layout cell nesting is NOT supported by the API. IMPORTANT: A notice_box created in the same call cannot be referenced — use a separate call first to create it, then a second call to nest content inside it."),block:Mg.describe("The block to create. Use block_type to select the block type.")}),Wg=e.object({operation_type:e.literal("delete_block"),block_id:e.string().describe("ID of the block to permanently delete. Works for all block types including BOARD, WIDGET, DOC embed, GIPHY.")}),Qg=e.object({operation_type:e.literal("replace_block"),block_id:e.string().describe("ID of the block to delete."),after_block_id:e.string().optional().describe("Insert replacement after this block ID. Provide the ID of the block that precedes the deleted block."),parent_block_id:e.string().optional().describe("Parent block ID for the replacement block."),block:Mg.describe("The new block to create in place of the deleted one.")}),zg=e.object({operation_type:e.literal("add_comment"),body:e.string().min(1).describe("The comment text. Use HTML tags for formatting (not markdown). Do not use @ to mention users — use mentions_list instead."),parent_update_id:e.number().optional().describe("The ID of an existing comment (update) to reply to. Omit to create a new top-level comment. Get comment IDs from read_docs with include_comments: true."),mentions_list:e.string().optional().describe('Optional JSON array of mentions: [{"id": "123", "type": "User"}, {"id": "456", "type": "Team"}]. Valid types: User, Team, Board, Project.'),block_id:e.union([e.string(),e.array(e.string()).min(1)]).optional().describe("Block ID (string) or array of block IDs to anchor the comment to. When an array is provided, the same comment highlights all specified blocks. Only works on text-content blocks (text, code, list_item, title, quote) — not on divider, table, layout, notice_box, image, video, or giphy. Get block IDs from read_docs with include_blocks: true. Omit to create a general doc-level comment. Pair with selection_from + selection_length (single block_id only) to comment on a specific text range."),selection_from:e.number().int().min(0).optional().describe("Start character offset (0-indexed) of the selected text within the block. Requires block_id. Omit to comment on the entire block."),selection_length:e.number().int().min(1).optional().describe("Number of characters in the text selection. Requires block_id and selection_from. Only works for text, code, and list_item blocks that have a delta format.")}),Yg=e.discriminatedUnion("operation_type",[Bg,qg,Hg,Gg,Wg,Qg,zg]),Kg={doc_id:e.string().min(1).optional().describe("The document ID (the id field from read_docs). Takes priority over object_id if both are provided."),object_id:e.string().min(1).optional().describe("The document object ID (the object_id field from read_docs, visible in the document URL). Resolved to doc_id."),operations:e.array(Yg).min(1).max(25).describe('Ordered list of operations to perform. Executed sequentially. Stops at first failure.\n\nOperation types:\n- set_name: Rename the document.\n- add_markdown_content: Append markdown as blocks (simplest for text/lists/tables).\n- update_block: Change content of an existing text/code/list/divider block.\n- create_block: Create a new block at a specific position (supports text, list_item, code, divider, page_break, image, video, notice_box, table, layout).\n- delete_block: Permanently remove a block. Works for ALL block types including BOARD, WIDGET, DOC embed, GIPHY.\n- replace_block: Delete a block and create a new one in its place. Use for: changing image/video source, table restructure, notice_box theme change.\n- add_comment: Create a new comment or reply on the document. Use parent_update_id to reply to an existing comment. Format text with HTML. Uses the doc\'s backing board item.\n\nWHEN TO USE WHICH:\n- Adding new text sections → add_markdown_content\n- Adding asset-based images → create_block with block_type "image" and asset_id (add_markdown_content does NOT support asset images)\n- Mixed content with asset images → alternate add_markdown_content (for text) and create_block (for each image) in sequence\n- Editing existing text block → update_block\n- Changing an image URL → replace_block (image URL is immutable after creation)\n- Changing video URL → replace_block\n- Restructuring a table → replace_block\n- BOARD/WIDGET/DOC/GIPHY blocks → delete_block only (no public API to create these)\n\nNESTING CONTENT IN CONTAINERS:\n- notice_box: Fully supported. Create the notice_box first, then in a separate call create child blocks with parent_block_id set to the notice_box ID. You cannot reference a block ID created in the same call.\n- table: Cell-level API nesting is NOT supported. To create a table with content, use add_markdown_content with a markdown table (e.g. "| H1 | H2 |\\n| --- | --- |\\n| A | B |"). This creates a pre-populated table in one shot. Empty tables created via create_block cannot have their cells populated through the API.\n- layout: Cell-level API nesting is NOT supported and there is no markdown equivalent. Layouts can only be created empty via create_block. No workaround exists to populate layout columns through the API.\nDeleting a container does NOT delete its children — delete children first for clean removal.\n\nBlock IDs are available in the blocks array returned by read_docs.')};const Jg=Em`
|
|
1815
1815
|
mutation CreateDashboard(
|
|
1816
1816
|
$name: String!
|
|
1817
1817
|
$workspace_id: ID!
|
|
@@ -2491,5 +2491,5 @@ import{z as e,ZodType as t}from"zod";import{zodToJsonSchema as a}from"zod-to-jso
|
|
|
2491
2491
|
}
|
|
2492
2492
|
}
|
|
2493
2493
|
}
|
|
2494
|
-
`),i=await this.mondayApi.request(a);return i.__type?{content:{message:"Type details retrieved",data:{name:i.__type.name,kind:i.__type.kind,description:i.__type.description??null,fields:i.__type.fields??[],inputFields:i.__type.inputFields??[],interfaces:i.__type.interfaces??[],enumValues:i.__type.enumValues??[],possibleTypes:i.__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 Er{constructor(){super(...arguments),this.name="create_custom_activity",this.type=ji.WRITE,this.annotations=Tr({title:"Create Custom Activity",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new custom activity in the E&A app"}getInputSchema(){return yf}async executeInternal(e){const t={color:e.color,icon_id:e.icon_id,name:e.name};return await this.mondayApi.request(Um,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 Er{constructor(){super(...arguments),this.name="create_notification",this.type=ji.WRITE,this.annotations=Tr({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 If}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(wf,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 Er{constructor(){super(...arguments),this.name="create_timeline_item",this.type=ji.WRITE,this.annotations=Tr({title:"Create Timeline Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new timeline item in the E&A app"}getInputSchema(){return Of}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(Mm,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 Er{constructor(){super(...arguments),this.name="fetch_custom_activity",this.type=ji.READ,this.annotations=Tr({title:"Fetch Custom Activities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get custom activities from the E&A app"}getInputSchema(){return qf}async executeInternal(e){const t=await this.mondayApi.request(Bm);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 Er{constructor(){super(...arguments),this.name="read_docs",this.type=ji.READ,this.annotations=Tr({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- Blocks default to 25 per page. Use blocks_limit and blocks_page to paginate through long documents.\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 Mv}async executeInternal(e){return e.mode===jv?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,i;switch(this.sessionContext.metadata={...this.sessionContext.metadata,mode:e.mode??Vv,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":i=e.ids}const r=e.include_blocks??!1,o=r?{blocksLimit:e.blocks_limit,blocksPage:e.blocks_page}:{},n={ids:t,object_ids:a,limit:e.limit||25,order_by:e.order_by,page:e.page,workspace_ids:i,includeBlocks:r,...o};let s=await this.mondayApi.request(Sm,n);if((!s.docs||0===s.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:i,includeBlocks:r,...o};s=await this.mondayApi.request(Sm,a)}if(!s.docs||0===s.docs.length){return{content:`No documents found matching the specified criteria${e.page?` (page ${e.page})`:""}.`}}const d=e.include_comments??!1,p=e.comments_limit??50;return this.sessionContext.metadata={...this.sessionContext.metadata,doc_ids:s.docs.flatMap((e=>e?[e.id]:[])),object_ids:s.docs.flatMap((e=>e?.object_id?[e.object_id]:[]))},this.enrichDocsWithMarkdown(s.docs,n,r,d,p,e.blocks_limit,e.blocks_page)}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:i,version_history_limit:r}=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:jv,object_ids:[o]};try{const e={docId:o,since:a,until:i},n=await this.mondayApi.request(Dm,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 r&&(s=s.slice(0,r)),{content:{doc_id:o,since:a,until:i,restoring_points:s}};const d=Math.min(r??10,10),p=s.slice(0,d+1),l=s.length>d,c=(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 i={docId:o,date:e.date,prevDate:a.date},r=await this.mondayApi.request(Am,i);return{...e,diff:r?.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:i,restoring_points:c,...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},i=await this.mondayApi.request(Nm,a),r=i.boards?.[0]?.items_page?.items;if(!r)return[];const o=[];for(const e of r)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,i=!1,r=50,o,n){const s=await Promise.all(e.filter((e=>null!==e)).map((async e=>{let t,s="";try{const t={docId:e.id},a=await this.mondayApi.request(qm,t);s=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){s=`Error getting markdown: ${e instanceof Error?e.message:"Unknown error"}`}return i&&e.object_id&&(t=await this.fetchDocComments(e.object_id,r)),{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}))),...void 0!==o||void 0!==n?{blocks_pagination:{current_page:n??1,limit:o??25,count:(e.blocks??[]).filter((e=>null!=e)).length,has_more_pages:(e.blocks??[]).length===(o??25)}}:{}},blocks_as_markdown:s,...i&&{comments:t}}}))),d=t.page||1,p=t.limit||25,l=s.length,c=l===p;return{content:{message:`Documents retrieved (${s.length})`,pagination:{current_page:d,limit:p,count:l,has_more_pages:c},data:s}}}},class extends Er{constructor(){super(...arguments),this.name="workspace_info",this.type=ji.READ,this.annotations=Tr({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 Bv}async executeInternal(e){const t={workspace_id:e.workspace_id},a=await this.mondayApi.request(Hm,t);if(!a.workspaces||0===a.workspaces.length)return{content:`No workspace found with ID ${e.workspace_id}`};const i=function(e,t){const{workspaces:a,boards:i,docs:r,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=[];(i||[]).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(r||[]).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?xv(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 Cv(this.mondayApi));return{content:{message:"Workspace info retrieved",data:i}}}},class extends Er{constructor(){super(...arguments),this.name="list_workspaces",this.type=ji.READ,this.annotations=Tr({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 zv}async executeInternal(e){const t=e.searchTerm?1e4:e.limit,a=e.searchTerm?1:e.page;let i=null;if(e.searchTerm&&(i=Gv(e.searchTerm),0===i.length))throw new Error("Search term did not include any alphanumeric characters. Please provide a valid search term.");const r=e=>({limit:t,page:a,membershipKind:e}),o=Wv(await this.mondayApi.request(qv,r(ac.Member))),n=!Qv(o)||i&&!function(e,t){return t.some((t=>Gv(t.name).includes(e)))}(i,o);let s=o;if(n){s=Wv(await this.mondayApi.request(qv,r(ac.All)))}if(!Qv(s))return{content:{message:"No workspaces found.",data:[]}};const d=i&&s?.length<=Hv,p=function(e,t,a,i){if(!e||t.length<=Hv)return t;const r=(a-1)*i,o=r+i;return t.filter((t=>Gv(t.name).includes(e))).slice(r,o)}(i,s,e.page,e.limit);if(!Qv(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,c=await Cv(this.mondayApi),m=p.map((e=>({id:e.id,name:e.name,description:e.description||void 0,url:c&&e.id?xv(c,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:m}}}},class extends Er{constructor(){super(...arguments),this.name="create_doc",this.type=ji.WRITE,this.annotations=Tr({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, optional docOwnerIds)\n- item: Creates a document attached to an item (requires item_id, optional column_id, optional docOwnerIds)\n\nUSAGE EXAMPLES:\n- Workspace doc: { location: "workspace", workspace_id: 123, doc_name: "My Doc", doc_kind: "private" , markdown: "..." }\n- Workspace doc in folder: { location: "workspace", workspace_id: 123, doc_name: "My Doc", folder_id: 17264196 , markdown: "..." }\n- Item doc: { location: "item", item_id: 456, doc_name: "My Doc", column_id: "doc_col_1" , markdown: "..." }\n- Workspace doc with agent owner: { location: "workspace", workspace_id: 123, doc_name: "My Doc", markdown: "...", docOwnerIds: ["<agent_owner_user_id>"] }'}getInputSchema(){return tg}async executeInternal(e){const t=eg.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,i,r;if(a.type===Zv.enum.workspace){const o={location:{workspace:{workspace_id:a.workspace_id.toString(),name:e.doc_name,kind:a.doc_kind||Yd.Public,folder_id:a.folder_id?.toString()}},...void 0!==e.docOwnerIds?{docOwnerIds:e.docOwnerIds}:{}},n=await this.mondayApi.request(Kv,o);t=n?.create_doc?.id??void 0,i=n?.create_doc?.object_id??void 0,r=n?.create_doc?.url??void 0}else if(a.type===Zv.enum.item){const o={itemId:a.item_id.toString()},n=await this.mondayApi.request(Yv,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===ff.Doc));let l=a.column_id;if(!l)if(p)l=p.id;else{const e={boardId:d.toString(),columnType:ff.Doc,columnTitle:"Doc"},t=await this.mondayApi.request(xm,e);if(l=t?.create_column?.id,!l)return{content:"Error: Failed to create doc column."}}const c={location:{board:{item_id:a.item_id.toString(),column_id:l}},...void 0!==e.docOwnerIds?{docOwnerIds:e.docOwnerIds}:{}},m=await this.mondayApi.request(Kv,c);if(t=m.create_doc?.id??void 0,i=m.create_doc?.object_id??void 0,r=m.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(Jv,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},...i&&{object_id:i}},{content:{message:"Document successfully created",doc_id:t,object_id:i,doc_url:r,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 Er{constructor(){super(...arguments),this.name="add_content_to_doc",this.type=ji.WRITE,this.annotations=Tr({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 og}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(rg,{docId:[e.doc_id]});t=a.docs?.[0]??null}else{const a=await this.mondayApi.request(ig,{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},i=await this.mondayApi.request(ag,a);if(!i?.add_content_to_doc_from_markdown)return{content:"Error: Failed to add content to document — no response from API."};const{success:r,block_ids:o,error:n}=i.add_content_to_doc_from_markdown;if(!r)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 Er{constructor(){super(...arguments),this.name="update_doc",this.type=ji.WRITE,this.annotations=Tr({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 Kg}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(dg,{objectId:[e.object_id]}),i=a.docs?.[0];if(!i)return{content:`Error: No document found for object_id ${e.object_id}.`};t=i.id}const a=[];let i=null;for(let r=0;r<e.operations.length;r++){const o=e.operations[r];try{const i=await this.executeOperation(t,o,e.object_id);a.push(`- [OK] ${o.operation_type}${i?`: ${i}`:""}`)}catch(e){const t=e instanceof Error?e.message:"Unknown error";a.push(`- [FAILED] ${o.operation_type}: ${t}`),i=r;break}}const r=null!==i?i:e.operations.length,o=e.operations.length,n=`Completed ${r}/${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},i=await this.mondayApi.request(ng,a);if(!i?.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 i={docId:e,markdown:t,afterBlockId:a},r=await this.mondayApi.request(sg,i),o=r?.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:yg(e.delta_format),alignment:e.alignment,direction:e.direction};case"code":return{deltaFormat:yg(e.delta_format),language:e.language};case"list_item":return{deltaFormat:yg(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),i={blockId:e,content:JSON.stringify(a)},r=await this.mondayApi.request(pg,i);if(!r?.update_doc_block)throw new Error("No response from update_doc_block");return`Block ${e} updated`}async executeCreateBlock(e,t,a,i){const r=function(e){switch(e.block_type){case"text":return{text_block:{delta_format:bg(e.delta_format),text_block_type:e.text_block_type?e.text_block_type:void 0,alignment:vg(e.alignment),direction:gg(e.direction)}};case"list_item":return{list_block:{delta_format:bg(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:bg(e.delta_format),text_block_type:Vl.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(i){const e=Object.keys(r);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=r[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=i}const o={docId:e,afterBlockId:a,blocksInput:[r]},n=await this.mondayApi.request(fg,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(lg,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(cg,{docId:[e]}),i=a.docs?.[0];if(!i?.object_id)throw new Error(`Could not resolve object_id for doc ${e}`);return i.object_id}async resolveDocItemId(e){const t=await this.mondayApi.request(mg,{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(ug,{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,i,r,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 c;if(r){const e=JSON.parse(r),t=Pf.safeParse(e);if(!t.success)throw new Error(`Invalid mentions_list format: ${t.error.message}`);c=t.data}const m={itemId:l,body:a,parentId:i?.toString(),mentionsList:c},u=await this.mondayApi.request(hg,m);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=i?`Reply to update ${i}`:"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 i=t.find((e=>e.id===a));if(!i)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: block ${a} not found in doc ${e}`);const r=i.content.deltaFormat;if(!r)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 r)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=Ig(r,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 c={...i.content,deltaFormat:l},m=await this.mondayApi.request(pg,{blockId:a,content:JSON.stringify(c)});if(!m?.update_doc_block)throw new Error(`${v} created (update ID: ${h}) but block annotation write returned no confirmation for block ${a}`)}}const g=d.length;return`${v} created${g>1?` across ${g} blocks`:1===g?" on block":""} (update ID: ${h})`}async executeReplaceBlock(e,t,a,i,r){await this.executeDeleteBlock(t);try{return`Block ${t} replaced. ${await this.executeCreateBlock(e,a,i,r)}`}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 Er{constructor(){super(...arguments),this.name="update_workspace",this.type=ji.WRITE,this.annotations=Tr({title:"Update Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing workspace in monday.com"}getInputSchema(){return i_}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(a_,t),i=await Cv(this.mondayApi),r=i?xv(i,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:r}}}},class extends Er{constructor(){super(...arguments),this.name="update_folder",this.type=ji.WRITE,this.annotations=Tr({title:"Update Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing folder in monday.com"}getInputSchema(){return o_}async executeInternal(e){const{position_object_id:t,position_object_type:a,position_is_after:i}=e;if(!!t!=!!a)throw new Error("position_object_id and position_object_type must be provided together");const r={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:i,position_object_id:t,position_object_type:a}:void 0},o=await this.mondayApi.request(r_,r);return{content:{message:`Folder ${o.update_folder?.id} updated`,folder_id:o.update_folder?.id,folder_name:o.update_folder?.name}}}},class extends Er{constructor(){super(...arguments),this.name="create_workspace",this.type=ji.WRITE,this.annotations=Tr({title:"Create Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new workspace in monday.com"}getInputSchema(){return s_}async executeInternal(e){const t={name:e.name,workspaceKind:e.workspaceKind,description:e.description,accountProductId:e.accountProductId},a=await this.mondayApi.request(n_,t),i=await Cv(this.mondayApi),r=i&&a.create_workspace?.id?xv(i,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:r}}}},class extends Er{constructor(){super(...arguments),this.name="create_folder",this.type=ji.WRITE,this.annotations=Tr({title:"Create Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new folder in a monday.com workspace"}getInputSchema(){return p_}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(d_,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 Er{constructor(){super(...arguments),this.name="move_object",this.type=ji.WRITE,this.annotations=Tr({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 m_}async executeUpdateFolder(e){const{id:t,position_object_id:a,position_object_type:i,position_is_after:r,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!i)throw new Error("position_object_id and position_object_type must be provided together");const d={folderId:t,position:a?{position_is_after:r,position_object_id:a,position_object_type:i}:void 0,parentFolderId:o,workspaceId:n,accountProductId:s},p=await this.mondayApi.request(r_,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:i,position_is_after:r,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!i)throw new Error("position_object_id and position_object_type must be provided together");const d={boardId:t,attributes:{position:a?{position_is_after:r,position_object_id:a,position_object_type:i}:void 0,folder_id:o,workspace_id:n,account_product_id:s}},p=await this.mondayApi.request(l_,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:i,position_is_after:r,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!i)throw new Error("position_object_id and position_object_type must be provided together");const d={overviewId:t,attributes:{position:a?{position_is_after:r,position_object_id:a,position_object_type:i}:void 0,folder_id:o,workspace_id:n,account_product_id:s}},p=await this.mondayApi.request(c_,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 ml.Folder:return this.executeUpdateFolder(e);case ml.Board:return this.executeUpdateBoardHierarchy(e);case ml.Overview:return this.executeUpdateOverviewHierarchy(e);default:throw new Error(`Unsupported object type: ${t}`)}}},class extends Er{constructor(){super(...arguments),this.name="create_dashboard",this.type=ji.WRITE,this.annotations=Tr({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 e_}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(Jg,t);if(!a.create_dashboard)throw new Error("Failed to create dashboard");const i=a.create_dashboard;return{content:{message:`Dashboard ${i.id} successfully created`,dashboard_id:i.id,dashboard_name:i.name}}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to create dashboard: ${t}`)}}},class extends Er{constructor(){super(...arguments),this.name="all_widgets_schema",this.type=ji.READ,this.annotations=Tr({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(Xg,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 i=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,r=t?.description||t?.title||`${e.widget_type} widget for data visualization`;a[e.widget_type]={type:e.widget_type,description:r,schema:e.schema},i++}if(0===i)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:nv}}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to fetch widget schemas: ${t}`)}}},class extends Er{constructor(){super(...arguments),this.name="create_widget",this.type=ji.WRITE,this.annotations=Tr({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 t_}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(Zg,t);if(!a.create_widget)throw new Error("Failed to create widget");const i=a.create_widget;i.parent?.kind===ec.Dashboard?i.parent.id:i.parent;return{content:{message:`Widget ${i.id} created`,widget_id:i.id,widget_name:i.name,dashboard_id:i.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 Er{constructor(){super(...arguments),this.name="board_insights",this.type=ji.READ,this.annotations=Tr({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 __}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})))||[],i=new Set(e.aggregations.filter((e=>e.function===Rd.Label)).map((e=>e.columnId))),r=e.groupBy?.filter((e=>!i.has(e))).map((e=>({function:Rd.Label,columnId:e})))??[],o=e.aggregations.concat(r).map((e=>{if(e.function){const o=`${e.function}_${e.columnId}`,n=t[o]||0;t[o]=n+1;const s=`${o}_${n}`;return v_.has(e.function)&&(a.some((e=>e.column_id===s))||a.push({column_id:s})),{type:$d.Function,function:(i=e.function,r=e.columnId,{function:i,params:i===Rd.CountItems?[]:[{type:$d.Column,column:g_(r),as:r}]}),as:s}}var i,r;const o={type:$d.Column,column:g_(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:$d.Column,column:g_(e.column_id),as:e.column_id})})),{selectElements:o,groupByElements:a}}(e),i=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),r=function(e){return{id:e.boardId.toString(),type:Od.Table}}(e),o={query:{from:r,query:i,select:t,group_by:a,limit:e.limit},boardId:String(e.boardId)},n=await this.mondayApi.request(u_,o),s=(n.aggregate?.results??[]).map((e=>{const t={};return(e.entries??[]).forEach((e=>{const a=e.alias??"";if(!a)return;const i=e.value;if(!i)return void(t[a]=null);const r=i.result??i.value??null;t[a]=r})),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 Er{constructor(){super(...arguments),this.name="search",this.type=ji.READ,this.annotations=Tr({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 D_}async executeInternal(e){if(e.searchType!==S_.FOLDERS&&e.searchTerm)try{return{content:{message:"Search results",data:(await this.searchWithDevEndpointAsync(e)).items}}}catch(e){of(e)}const t={[S_.BOARD]:this.searchBoardsAsync.bind(this),[S_.DOCUMENTS]:this.searchDocsAsync.bind(this),[S_.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===S_.BOARD)return this.searchBoardsWithDevEndpointAsync(e.searchTerm,e.limit,t);if(e.searchType===S_.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 i={query:e,limit:t,workspaceIds:a};return{items:(await this.mondayApi.request(I_,i,{versionOverride:"dev",timeout:af})).search.boards.results.map((e=>({id:E_.BOARD+e.indexed_data.id,title:e.indexed_data.name,url:e.indexed_data.url}))),wasFiltered:!0}}async searchDocsWithDevEndpointAsync(e,t,a){const i={query:e,limit:t,workspaceIds:a};return{items:(await this.mondayApi.request(T_,i,{versionOverride:"dev",timeout:af})).search.docs.results.map((e=>({id:E_.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&&rf(new Error("Searching for folders require specifying workspace ids"),"search folders");const a=await this.mondayApi.request(w_,t),i=this.searchAndVirtuallyPaginate(e,a.folders||[],(e=>e.name));return{items:i.items.map((e=>({id:E_.FOLDER+e.id,title:e.name}))),wasFiltered:i.wasFiltered}}async searchDocsAsync(e){const t={...this.getPagingParamsForSearch(e),workspace_ids:e.workspaceIds?.map((e=>e.toString()))},a=await this.mondayApi.request(y_,t),i=this.searchAndVirtuallyPaginate(e,a.docs||[],(e=>e.name));return{items:i.items.map((e=>({id:E_.DOCUMENT+e.id,title:e.name,url:e.url||void 0}))),wasFiltered:i.wasFiltered}}async searchBoardsAsync(e){const t={...this.getPagingParamsForSearch(e),workspace_ids:e.workspaceIds?.map((e=>e.toString()))},a=await this.mondayApi.request(b_,t),i=this.searchAndVirtuallyPaginate(e,a.boards||[],(e=>e.name));return{items:i.items.map((e=>({id:E_.BOARD+e.id,title:e.name,url:e.url}))),wasFiltered:i.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 i=Gv(e.searchTerm??""),r=(e.page-1)*e.limit,o=r+e.limit;return{items:t.filter((e=>Gv(a(e)).includes(i))).slice(r,o),wasFiltered:!0}}},class extends Er{constructor(){super(...arguments),this.name="get_user_context",this.type=ji.READ,this.annotations=Tr({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(x_,{},{versionOverride:"dev"});if(!e)return{content:"AUTHENTICATION_ERROR: Unable to fetch current user. Verify API token and user permissions."};const i=await this.fetchFavorites(t||[]),r=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:i,relevantBoards:r,relevantPeople:o}}}}async fetchFavorites(e){const t=this.groupByType(e),a=Object.keys(t);if(0===a.length)return[];const i={};for(const e of a)i[L_[e]]=t[e];const r=await this.mondayApi.request(F_,i),o=[];for(const e of a){const t=V_[e];for(const a of r[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 Er{constructor(){super(...arguments),this.name="update_assets_on_item",this.type=ji.WRITE,this.annotations=Tr({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 R_}async executeInternal(e){const t={boardId:e.boardId,itemId:e.itemId,columnId:e.columnId,files:e.files},a=await this.mondayApi.request(O_,t);return{content:`Item ${a.update_assets_on_item?.id} (${a.update_assets_on_item?.name}) assets successfully updated`}}},class extends Er{constructor(){super(...arguments),this.name="get_assets",this.type=ji.READ,this.annotations=Tr({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 C_}async executeInternal(e){const t=await this.mondayApi.request(P_,{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 Er{constructor(){super(...arguments),this.name="get_notetaker_meetings",this.type=ji.READ,this.annotations=Tr({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 U_}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},i=await this.mondayApi.request(j_,a,{versionOverride:"2026-04"}),r=i.notetaker?.meetings;if(!r?.meetings||0===r.meetings.length)return{content:"No notetaker meetings found matching the specified criteria."};return{content:{message:"Meetings retrieved",data:{meetings:r.meetings,pagination:{has_next_page:r.page_info?.has_next_page??!1,cursor:r.page_info?.cursor??null,count:r.meetings.length}}}}}},class extends Er{constructor(){super(...arguments),this.name="create_view",this.type=ji.WRITE,this.annotations=Tr({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 yu}async executeInternal(e){const t={boardId:e.boardId,type:e.type,name:e.name,filter:e.filter,sort:e.sort,settings:e.settings},a=await this.mondayApi.request(bu,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 Er{constructor(){super(...arguments),this.name="update_view",this.type=ji.WRITE,this.annotations=Tr({title:"Update View",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Update an existing board view (tab) — change its name, filter rules, or sort order. Provide only the fields you want to change. Omitted fields are left unchanged.\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 Iu}async executeInternal(e){const t={viewId:e.viewId,boardId:e.boardId,type:e.type,name:e.name,filter:e.filter,sort:e.sort,settings:e.settings},a=await this.mondayApi.request(wu,t);return a.update_view?{content:`View "${a.update_view.name}" (ID: ${a.update_view.id}, type: ${a.update_view.type}) successfully updated`}:{content:"Failed to update view - no response from API"}}},class extends Er{constructor(){super(...arguments),this.name="create_view_table",this.type=ji.WRITE,this.annotations=Tr({title:"Create Table View",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a new table-type board view with optional filters, sort, tags, and table-specific settings (column visibility/order and group-by). Use this instead of create_view when you need to configure table-specific settings. For a simple table view, create_view also works.\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 settings.columns: { "column_properties": [{ "column_id": "status", "visible": true }], "column_order": ["name", "status", "date"] }\nExample settings.group_by: { "conditions": [{ "columnId": "status" }], "hideEmptyGroups": true }'}getInputSchema(){return Du}async executeInternal(e){const t={boardId:e.boardId,name:e.name,filter:e.filter,sort:e.sort,tags:e.tags,settings:e.settings},a=await this.mondayApi.request(Tu,t);return a.create_view_table?{content:`Table view "${a.create_view_table.name}" (ID: ${a.create_view_table.id}, type: ${a.create_view_table.type}) successfully created`}:{content:"Failed to create table view - no response from API"}}},class extends Er{constructor(){super(...arguments),this.name="update_view_table",this.type=ji.WRITE,this.annotations=Tr({title:"Update Table View",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Update an existing table-type board view — change its name, filters, sort, tags, or table-specific settings (column visibility/order and group-by). Provide only the fields you want to change. Omitted fields are left unchanged.\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 settings.columns: { "column_properties": [{ "column_id": "status", "visible": true }], "column_order": ["name", "status", "date"] }\nExample settings.group_by: { "conditions": [{ "columnId": "status" }], "hideEmptyGroups": true }'}getInputSchema(){return Ou}async executeInternal(e){const t={viewId:e.viewId,boardId:e.boardId,name:e.name,filter:e.filter,sort:e.sort,tags:e.tags,settings:e.settings},a=await this.mondayApi.request(Nu,t);return a.update_view_table?{content:`Table view "${a.update_view_table.name}" (ID: ${a.update_view_table.id}, type: ${a.update_view_table.type}) successfully updated`}:{content:"Failed to update table view - no response from API"}}},class extends Er{constructor(){super(...arguments),this.name="undo_action",this.type=ji.WRITE,this.annotations=Tr({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 B_}async executeInternal(e){return await this.mondayApi.request(M_,{boardId:e.boardId.toString(),undoRecordId:e.undoRecordId},{versionOverride:"dev"}),{content:`Successfully undid action "${e.undoRecordId}" on board ${e.boardId}.`}}},class extends Er{constructor(){super(...arguments),this.name="get_object_schemas",this.type=ji.READ,this.annotations=Tr({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 Jm}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(Km,t)).get_object_schemas??[];return{content:{message:`Retrieved ${a.length} object schema(s)`,schemas:a}}}},class extends Er{constructor(){super(...arguments),this.name="create_object_schema",this.type=ji.WRITE,this.annotations=Tr({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 Zm}async executeInternal(e){const t={name:e.name,parentId:e.parentId,description:e.description},a=await this.mondayApi.request(Xm,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 Er{constructor(){super(...arguments),this.name="update_object_schema",this.type=ji.WRITE,this.annotations=Tr({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 tu}async executeInternal(e){const t={id:e.id,revision:e.revision,parentId:e.parentId,description:e.description},a=await this.mondayApi.request(eu,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 Er{constructor(){super(...arguments),this.name="delete_object_schema",this.type=ji.WRITE,this.annotations=Tr({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 iu}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(au,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 Er{constructor(){super(...arguments),this.name="delete_object_schema_columns",this.type=ji.WRITE,this.annotations=Tr({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 ou}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(ru,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 Er{constructor(){super(...arguments),this.name="manage_object_schema_board_connection",this.type=ji.WRITE,this.annotations=Tr({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 du}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(nu,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(su,t)).detach_boards_from_object_schema??[],i=a.filter((e=>e.success)).length,r=a.filter((e=>!e.success));return{content:{message:`${i} board(s) successfully detached`,results:a,...r.length>0&&{failures:r}}}}}},class extends Er{constructor(){super(...arguments),this.name="manage_object_schema_columns",this.type=ji.WRITE,this.annotations=Tr({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 with fetchMode "${pu.Schema}" 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 fu}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},i=await this.mondayApi.request(lu,a);return{content:{message:`Columns successfully added to object schema "${i.create_object_schema_columns?.name}"`,schema_id:i.create_object_schema_columns?.id,schema_name:i.create_object_schema_columns?.name,revision:i.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(cu,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 Er{constructor(){super(...arguments),this.name="set_object_schema_column_active_state",this.type=ji.WRITE,this.annotations=Tr({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 gu}async executeInternal(e){if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided");const t={deactivate:dp.Deactivate,reactivate:dp.Reactivate},a={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columnId:e.columnId,action:t[e.action]},i=await this.mondayApi.request(vu,a);return{content:{message:`Column successfully ${e.action}d on object schema "${i.set_object_schema_column_active_state?.name}"`,schema_id:i.set_object_schema_column_active_state?.id,schema_name:i.set_object_schema_column_active_state?.name,revision:i.set_object_schema_column_active_state?.revision}}}},class extends Er{constructor(){super(...arguments),this.name="get_asset_upload_url",this.type=ji.WRITE,this.annotations=Tr({title:"Get Asset Upload URL",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Get a presigned URL to upload a file to monday.com. Returns an upload_id and upload_url.\n\nAfter calling this tool, upload the file to the returned URL using an HTTP PUT request and capture the ETag header from the response:\n\ncurl -i -X PUT "<upload_url>" \\\n -H "Content-Type: <the contentType you provided>" \\\n --data-binary @<local_file_path>\n\nThe response includes an ETag header (e.g. ETag: "abc123...") — save this value.\n\nThen call finalize_asset_upload with the upload_id, etag, board_id, item_id, and column_id to complete the upload and attach the file to an item\'s file column.\n\nMax file size: 500MB.'}getInputSchema(){return H_}async executeInternal(e){const t=(await this.mondayApi.request(q_,{input:{file_name:e.fileName,content_type:e.contentType,file_size:e.fileSize,source:"mcp",multipart:!1}},{versionOverride:"dev"})).create_upload,a=t.parts[0]?.url;if(!a)throw new Error("create_upload returned no upload URL — parts array was empty");return{content:{upload_id:t.upload_id,upload_url:a,url_expires_at:t.expires_at}}}},class extends Er{constructor(){super(...arguments),this.name="finalize_asset_upload",this.type=ji.WRITE,this.annotations=Tr({title:"Finalize Asset Upload",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Finalize a file upload and create the asset on monday.com. Call this after uploading the file to the presigned URL from get_asset_upload_url. Requires the etag value from the PUT response headers. Automatically attaches the uploaded asset to the specified file column on the item. Returns the created asset_id."}getInputSchema(){return Q_}async executeInternal(e){const t=(await this.mondayApi.request(G_,{input:{upload_id:e.uploadId,holder:{type:"ITEM",id:e.itemId},board_id:e.boardId,parts:[{part_number:1,etag:e.etag}]}},{versionOverride:"dev"})).complete_upload,a=JSON.stringify({added_file:{fileType:"ASSET",name:t.filename,assetId:String(t.id)}});return await this.mondayApi.request(W_,{boardId:e.boardId,itemId:e.itemId,columnId:e.columnId,value:a}),{content:{asset_id:t.id,filename:t.filename,content_type:t.content_type,file_size:t.file_size,url:t.url,filelink:t.filelink}}}},class extends Er{constructor(){super(...arguments),this.name="link_board_items_workflow",this.type=ji.READ,this.annotations=Tr({title:"Link Board Items Workflow",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'When to use: any board-relation / cross-board linking task. **Hard gate — you MUST call this BEFORE get_board_items_page, or change_item_column_values in the same turn. No discovery, matching, or write happens first.** Triggers: **link** or **connect** items **across boards** (board-relation / "connect boards" / pairs) — also vague phrasings where only one side is named ("link this to **an** item on another board", "**the matching** row"). This tool is read-only (no API).'}getInputSchema(){return Y_}async executeInternal(e){return{content:z_}}},class extends Er{constructor(){super(...arguments),this.name="fetch_file_content",this.type=ji.READ,this.annotations=Tr({title:"Fetch File Content",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch and extract the text content from a file stored in a monday.com files column.\n\nUse this tool when you need to read, summarize, or analyze the content of files attached to board items. Provide the item ID and column ID from the get_board_items_page response — the column value will be a URL like \"https://monday.com/protected_static/...\" indicating a file is present (null means no file).\n\nPROACTIVE USE: If you retrieve board items and notice a files column with a non-null value (a URL), consider fetching its content if it could help answer the user's question — don't wait to be explicitly asked.\n\nSupported file types and what is returned:\n- Text files (.txt, .md, .csv, .json): raw text content\n- Word documents (.docx): extracted text content\n- PDF files (.pdf): extracted text content\n- Excel files (.xlsx, .xls): extracted text content per sheet\n- Images (.png, .jpg, .gif, .webp, .svg, .bmp, .ico): returns the public URL so you can view or analyze the image directly\n\nText responses include a total_length field. If has_more is true, the content was truncated — you can call this tool again with next_offset if you need the remaining content.\n\nWhen to use:\n- User asks to summarize, read, or analyze the content of a file in a files column\n- User asks questions about what is inside a file (e.g., \"what does the PDF say?\")\n- User wants to extract data from a CSV or Excel file attached to a board item\n- A board item has a files column with a non-null value and the user's question may be answered by its content — even if the user didn't explicitly ask to read the file\n\nWhen NOT to use:\n- The files column value is null (no file uploaded for that item)"}getInputSchema(){return ob}async executeInternal(e){const{item_id:t,column_id:a,file_name:i,offset:r=0}=e,o=await this.mondayApi.request(K_,{itemId:[t],columnId:[a]}),n=o?.items?.[0]?.assets;if(!n||0===n.length)return{content:{message:`No file found for item ${t} in column ${a}. The column may be empty or the column ID may be incorrect.`}};return{content:{files:await Promise.all(n.map((e=>db(e,r,i))))}}}},class extends Er{constructor(){super(...arguments),this.name="get_agent",this.type=ji.READ,this.annotations=Tr({title:"Get monday Platform Agent(s)",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Fetch one or more personal/custom agents on the monday.com platform.\n\nmonday platform agents are user-built work orchestrators and executors that live on the monday.com platform — each has a profile (name, role, avatar), a goal, and an execution plan in markdown describing capabilities and operating principles. Agents in state ACTIVE can be triggered to perform automated work on monday boards. They are NOT local LangChain or MCP agents — they are managed entities on the monday.com platform owned by a specific user.\n\nTerminology note: users might ask for "agent" in natural language (for example: "create me an agent"), but in this API context this refers to monday personal/custom agents.\n\nAgent state in get_agent results is one of ACTIVE, INACTIVE, ARCHIVED, or FAILED. DELETED agents are filtered from these queries — DELETED only appears as the return value of delete_agent. Agent kind is one of PERSONAL, ACCOUNT_LEVEL, or EXTERNAL.\n\nPass id to fetch one specific agent by its unique identifier. Omit id to list agents owned by the authenticated user (capped at 100 — ask the user for a higher limit if needed). An empty list means the user owns no agents, which is not an error.\n\nUSAGE EXAMPLES:\n- Fetch one agent: { "id": "42" }\n- List my agents: {}'}getInputSchema(){return hb}async executeInternal(e){if(void 0!==e.id)try{const{agents:t}=await this.mondayApi.request(lb,{ids:[e.id]},{versionOverride:"dev"}),a=t?.[0];return a?{content:{message:"monday platform agent",agent:a}}:{content:`monday platform agent ${e.id} not found, or the authenticated user does not have access to it.`}}catch(e){rf(e,"get monday platform agent")}try{const{agents:e}=await this.mondayApi.request(lb,{limit:100},{versionOverride:"dev"}),t=e??[];return{content:{message:"monday platform agents owned by the authenticated user (limited to 100 — ask the user if they need more)",count:t.length,agents:t}}}catch(e){rf(e,"list monday platform agents")}}},class extends Er{constructor(){super(...arguments),this.name="create_agent",this.type=ji.WRITE,this.annotations=Tr({title:"Create monday Platform Agent",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a personal/custom agent on the monday.com platform. See get_agent for what a monday platform agent is.\n\nTerminology note: users might ask for "agent" in natural language (for example: "create me an agent"), but in this API context this refers to monday personal/custom agents.\n\nTwo modes:\n- Prompt mode (recommended): pass prompt (and optional agent_model) and the platform generates profile + goal + plan via AI.\n- Manual mode: omit prompt and pass any of name/role/role_description/user_prompt to create a blank agent profile quickly.\n\nDo not mix prompt with manual profile fields in one request.\n\nCreated agents start in state INACTIVE and must be activated before they can be triggered. Instruct the user to activate from the monday.com agent settings UI.\n\ncreated_at and updated_at are null in the response — call get_agent with the returned id afterward to fetch them.\n\nUSAGE EXAMPLES:\n- AI-generated: { "prompt": "Run my daily standup — collect status updates, summarize blockers, and post recap every weekday at 9am." }\n- Blank/manual: { "name": "Standup Bot", "role": "Project Manager", "gender": "female" }\n- Blank/defaults: {}'}getInputSchema(){return fb}async executeInternal(e){const t=void 0!==e.prompt,a=void 0!==e.name||void 0!==e.role||void 0!==e.role_description||void 0!==e.avatar_url||void 0!==e.gender||void 0!==e.background_color||void 0!==e.user_prompt;if(t&&a)throw new Error("create_agent accepts either prompt mode or manual mode. Do not pass prompt together with manual profile fields.");if(!t&&void 0!==e.agent_model)throw new Error("agent_model can only be used when prompt is provided.");if(!t)try{const t={};void 0!==e.name&&(t.name=e.name),void 0!==e.role&&(t.role=e.role),void 0!==e.role_description&&(t.role_description=e.role_description),void 0!==e.avatar_url&&(t.avatar_url=e.avatar_url),void 0!==e.gender&&(t.gender=e.gender),void 0!==e.background_color&&(t.background_color=e.background_color),void 0!==e.user_prompt&&(t.user_prompt=e.user_prompt);const a={input:t},i=await this.mondayApi.request(mb,a,{versionOverride:"dev"});if(!i.create_blank_agent?.id)throw new Error("monday platform agent creation returned no id");return{content:{message:`monday platform agent ${i.create_blank_agent.id} created in state INACTIVE — user must activate it from the monday.com UI before it can be triggered`,agent:i.create_blank_agent}}}catch(e){rf(e,"create blank monday platform agent")}try{const t={input:{prompt:e.prompt,agent_model:e.agent_model}},a=await this.mondayApi.request(cb,t,{versionOverride:"dev"});if(!a.create_agent?.id)throw new Error("monday platform agent creation returned no id");return{content:{message:`monday platform agent ${a.create_agent.id} created in state INACTIVE — user must activate it from the monday.com UI before it can be triggered`,agent:a.create_agent}}}catch(e){rf(e,"create monday platform agent")}}},class extends Er{constructor(){super(...arguments),this.name="delete_agent",this.type=ji.WRITE,this.annotations=Tr({title:"Delete monday Platform Agent",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return'Permanently delete a personal/custom agent on the monday.com platform. Removes the agent and all of its versions. The agent stops appearing in get_agent results and can no longer be triggered. This action cannot be undone. Only the agent owner can delete it.\n\nTerminology note: users might ask for "agent" in natural language (for example: "delete my standup agent"), but in this API context this refers to monday personal/custom agents.\n\nVERIFY BEFORE DELETING: When the user refers to an agent by name or description (e.g. "delete my standup bot"), call get_agent (no id) first to list all the user\'s agents and confirm the correct id. Do not infer ids — pick the matching agent by inspecting profile.name / role / goal.\n\nUSAGE EXAMPLE:\n{ "id": "42" }'}getInputSchema(){return vb}async executeInternal(e){try{const t={id:e.id},a=await this.mondayApi.request(ub,t,{versionOverride:"dev"});if(!a.delete_agent?.id)throw new Error("monday platform agent delete returned no id");return{content:{message:`monday platform agent ${a.delete_agent.id} deleted`,agent:a.delete_agent}}}catch(e){rf(e,"delete monday platform agent")}}},class extends Er{constructor(){super(...arguments),this.name="list_automations",this.type=ji.READ,this.annotations=Tr({title:"List Board Automations",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"List all automations on a specific monday.com board, including their ids, titles, active state, and configuration.\n\nWhen NOT to use: Do not call this tool to get general board information unrelated to automations."}getInputSchema(){return yb}async executeInternal(e){try{const t={boardIds:[e.boardId],limit:e.limit??100,...e.cursor?{cursor:e.cursor}:{}},a=await this.mondayApi.request(gb,t,{versionOverride:"2026-10"}),i=(a.board_automations?.items??[]).map(bb),r=a.board_automations?.cursor??null;return{content:{message:`Found ${i.length} live workflow(s) on board ${e.boardId}`,workflows:i,pagination:{nextCursor:r,hasMore:null!==r}}}}catch(e){rf(e,"list live workflows")}}},class extends Er{constructor(){super(...arguments),this.name="manage_workflows",this.type=ji.WRITE,this.annotations=Tr({title:"Manage Workflows",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return'Activate, deactivate, or delete an existing monday.com automation/workflow.\n\nRequires a workflow id. When the user refers to an automation by name, always call list_automations first to resolve the id — never guess or infer ids.\n\nActions:\n- activate: enables a paused workflow so it starts responding to its trigger.\n- deactivate: pauses a workflow while preserving its definition.\n- delete: permanently removes a workflow — irreversible.\n\nWhen intent is ambiguous ("stop", "turn off", "pause"), prefer deactivate over delete.\n\nTerminology: "workflows" and "automations" are the same thing.'}getInputSchema(){return Eb}async executeInternal(e){const t=e;switch(t.action){case"activate":return this.activateWorkflow(t);case"deactivate":return this.deactivateWorkflow(t);case"delete":return this.deleteWorkflow(t)}}async activateWorkflow(e){try{const t={id:e.workflowId},a=await this.mondayApi.request(wb,t,{versionOverride:"dev"});if(!a.activate_live_workflow?.is_success)throw new Error(`Workflow ${e.workflowId} activation did not report success`);return{content:{message:`Workflow ${e.workflowId} activated`,workflowId:e.workflowId,isActive:!0}}}catch(e){rf(e,"activate workflow")}}async deactivateWorkflow(e){try{const t={id:e.workflowId},a=await this.mondayApi.request(Ib,t,{versionOverride:"dev"});if(!a.deactivate_live_workflow?.is_success)throw new Error(`Workflow ${e.workflowId} deactivation did not report success`);return{content:{message:`Workflow ${e.workflowId} deactivated`,workflowId:e.workflowId,isActive:!1}}}catch(e){rf(e,"deactivate workflow")}}async deleteWorkflow(e){try{const t={id:e.workflowId},a=await this.mondayApi.request(Tb,t,{versionOverride:"dev"});if(!a.delete_live_workflow?.is_success)throw new Error(`Workflow ${e.workflowId} deletion did not report success`);return{content:{message:`Workflow ${e.workflowId} deleted`,workflowId:e.workflowId}}}catch(e){rf(e,"delete workflow")}}},class extends Er{constructor(e,t,a){super(e,a),this.apiToken=t,this.name="create_automation",this.type=ji.WRITE,this.annotations=Tr({title:"Create Automation",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Creates an automation on a monday board from a natural-language description (e.g. "notify me when status changes to Done").\n\nUse when the user has clearly described what to automate — both the trigger (what kicks it off) and the action (what should happen), and you know which board to create it on. If basic details are missing (including boardId), ask the user first instead of calling with a vague prompt.\n\nIf the prompt is still ambiguous, the tool returns status: "needs_clarification" with the unresolved fields — present them to the user, gather answers, then call again.\n\nTerminology:\n - Trigger: When the automation should run (e.g. "when a new item is created").\n - Conditions: additional conditions that must be met for the automation to run.\n - Actions: what the automation should do when it runs (can have multiple actions).\n'}getInputSchema(){return Sb}async executeInternal(e){try{const t=await fetch("https://api.monday.com/platform-ai-gateway/agents/lite-builder",{method:"POST",headers:{Authorization:this.apiToken,"Content-Type":"application/json"},body:JSON.stringify({userPrompt:e.userPrompt,boardId:e.boardId}),signal:AbortSignal.timeout(18e4)});if(!t.ok){const e=await t.text().catch((()=>""));throw new Error(`lite-builder responded with HTTP ${t.status}${e?`: ${e}`:""}`)}return{content:await t.json()}}catch(e){rf(e,"create automation")}}},class extends Er{constructor(){super(...arguments),this.name="create_workflow_builder",this.type=ji.WRITE,this.annotations=Tr({title:"Create Workflow Builder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Creates a new empty Workflow Builder workflow in a monday.com workspace.\n\nUse this when the user wants to build a new standalone workflow from scratch. Workflow Builder workflows are cross-board, workspace-level automations — distinct from board automations (use create_automation for those). You only need a workspaceId to get started — all other fields are optional.\n\nReturns:\n- workflowObjectId: the workflow object ID\n- workflowDraftId: the current draft version ID — workflows start as drafts and must be published before they run\n\nTerminology:\n- Workflow Builder vs. board automations: Workflow Builder workflows are standalone objects scoped to a workspace. Board automations (create_automation) are per-board trigger/action rules. They are different products.\n- Draft: the editable, inactive version of a workflow. Changes are made on the draft version until it is published as the live version.\n- Privacy: PUBLIC — visible to all workspace members (default). PRIVATE — restricted access. SHAREABLE — accessible to guests outside the account.\n"}getInputSchema(){return Nb}async executeInternal(e){try{const t={workspace_id:e.workspaceId,...void 0!==e.title?{title:e.title}:{},...void 0!==e.privacyKind?{privacy_kind:e.privacyKind}:{},...void 0!==e.description?{description:e.description}:{},...void 0!==e.folderId?{folder_id:e.folderId}:{},...void 0!==e.ownerIds?{owner_ids:e.ownerIds}:{}},a=await this.mondayApi.request(Db,t,{versionOverride:"dev"});if(!a.create_workflow)throw new Error("create_workflow returned null");const{workflow_object_id:i,workflow_draft_id:r}=a.create_workflow;if(!i||!r)throw new Error("create_workflow returned missing identifiers");return{content:{message:`Workflow Builder workflow created in workspace ${e.workspaceId}`,workflowObjectId:i,workflowDraftId:r}}}catch(e){rf(e,"create Workflow Builder workflow")}}}];var dy;!function(e){e.API="api",e.APPS="apps",e.ATP="atp"}(dy||(dy={}));const py=(e,t)=>{let a=[];t?.mode===dy.APPS?a=[...Ir]:t?.mode!==dy.API&&t?.mode||(a=[...sy,...ny]);const i=a.map((t=>((e,t)=>e.prototype instanceof Er?new e(t.apiClient,t.apiToken,t.context):e.prototype instanceof er?new e(t.apiToken):new e)(t,e)));return i.filter((e=>{if(!t)return e.type!==ji.ALL_API;if(t.mode===dy.API&&"only"===t.enableDynamicApiTools)return e.type===ji.ALL_API;let a=!1;return t.mode===dy.API&&!1===t.enableDynamicApiTools&&(a=a||e.type===ji.ALL_API),t.readOnlyMode&&(a=a||e.type!==ji.READ),t.include?a=a||!t.include?.includes(e.name):t.exclude&&(a=a||t.exclude?.includes(e.name)),!a}))};class ly{constructor(){this.dynamicTools=new Map}registerTool(e,t){const a=e.enabledByDefault??!0,i=a;this.dynamicTools.set(e.name,{instance:e,mcpTool:t,enabled:i,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 cy extends Pi{constructor(e){super({name:"monday.com",version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),this.dynamicToolManager=new ly,this.toolInstances=[],this.managementTool=null,this.mondayApiClient=this.createApiClient(e),this.mondayApiToken=e.mondayApiToken,this.context={...e.context,apiVersion:e.mondayApiVersion??Xi},this.registerTools(e)}createApiClient(e){return new i({token:e.mondayApiToken,apiVersion:e.mondayApiVersion??Xi,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 kb;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 py(t,e.toolsConfiguration)}registerSingleTool(t){const a=t.getInputSchema(),i=this.registerTool(t.name,{...t,title:t.annotations?.title,description:t.getDescription(),inputSchema:a,annotations:t.annotations},(async(i,r)=>{try{let r;if(a){const o=e.object(a).safeParse(i);if(!o.success)throw new Error(`Invalid arguments: ${o.error.message}`);r=await t.execute(o.data)}else r=await t.execute();return this.formatToolResult(r.content)}catch(e){return this.handleToolError(e,t.name)}}));this.dynamicToolManager.registerTool(t,i)}enableTool(e){return this.dynamicToolManager.enableTool(e)}disableTool(e){return this.dynamicToolManager.disableTool(e)}isToolEnabled(e){return this.dynamicToolManager.isToolEnabled(e)}getToolsStatus(){return this.dynamicToolManager.getToolsStatus()}getDynamicToolNames(){return this.dynamicToolManager.getDynamicToolNames()}getServer(){return this}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 i=t.getInputSchema();if(i){const r=e.object(i).safeParse(a);if(!r.success)throw new Error(`Invalid arguments: ${r.error.message}`);return(await t.execute(r.data)).content}return(await t.execute()).content}}createMcpToolHandler(t){return async(a,i)=>{try{const r=t.getInputSchema();if(r){const o=e.object(r).safeParse(a);if(!o.success)throw new Error(`Invalid arguments: ${o.error.message}`);const n=await t.execute(o.data,i);return this.formatToolResult(n.content)}{const e=await t.execute(void 0,i);return this.formatToolResult(e.content)}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}}}getSchemaForTool(t,i){const r=t.getInputSchema();if(r)return"json"===i?.schemaFormat?a(e.object(r)):r}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{ly as DynamicToolManager,cy as MondayAgentToolkit};
|
|
2494
|
+
`),i=await this.mondayApi.request(a);return i.__type?{content:{message:"Type details retrieved",data:{name:i.__type.name,kind:i.__type.kind,description:i.__type.description??null,fields:i.__type.fields??[],inputFields:i.__type.inputFields??[],interfaces:i.__type.interfaces??[],enumValues:i.__type.enumValues??[],possibleTypes:i.__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 Er{constructor(){super(...arguments),this.name="create_custom_activity",this.type=ji.WRITE,this.annotations=Tr({title:"Create Custom Activity",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new custom activity in the E&A app"}getInputSchema(){return yf}async executeInternal(e){const t={color:e.color,icon_id:e.icon_id,name:e.name};return await this.mondayApi.request(Um,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 Er{constructor(){super(...arguments),this.name="create_notification",this.type=ji.WRITE,this.annotations=Tr({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 If}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(wf,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 Er{constructor(){super(...arguments),this.name="create_timeline_item",this.type=ji.WRITE,this.annotations=Tr({title:"Create Timeline Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new timeline item in the E&A app"}getInputSchema(){return Of}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(Mm,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 Er{constructor(){super(...arguments),this.name="fetch_custom_activity",this.type=ji.READ,this.annotations=Tr({title:"Fetch Custom Activities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get custom activities from the E&A app"}getInputSchema(){return qf}async executeInternal(e){const t=await this.mondayApi.request(Bm);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 Er{constructor(){super(...arguments),this.name="read_docs",this.type=ji.READ,this.annotations=Tr({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- Blocks default to 25 per page. Use blocks_limit and blocks_page to paginate through long documents.\n- Set include_comments: true to fetch all comments and replies on the document. Each comment is enriched with anchor info (block_id, selection_from, selection_length) indicating which block and text range it\'s attached to. 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 Jv}async executeInternal(e){return e.mode===Yv?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,i;switch(this.sessionContext.metadata={...this.sessionContext.metadata,mode:e.mode??zv,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":i=e.ids}const r=e.include_blocks??!1,o=r?{blocksLimit:e.blocks_limit,blocksPage:e.blocks_page}:{},n={ids:t,object_ids:a,limit:e.limit||25,order_by:e.order_by,page:e.page,workspace_ids:i,includeBlocks:r,...o};let s=await this.mondayApi.request(Sm,n);if((!s.docs||0===s.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:i,includeBlocks:r,...o};s=await this.mondayApi.request(Sm,a)}if(!s.docs||0===s.docs.length){return{content:`No documents found matching the specified criteria${e.page?` (page ${e.page})`:""}.`}}const d=e.include_comments??!1,p=e.comments_limit??50;return this.sessionContext.metadata={...this.sessionContext.metadata,doc_ids:s.docs.flatMap((e=>e?[e.id]:[])),object_ids:s.docs.flatMap((e=>e?.object_id?[e.object_id]:[]))},this.enrichDocsWithMarkdown(s.docs,n,r,d,p,e.blocks_limit,e.blocks_page)}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:i,version_history_limit:r}=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:Yv,object_ids:[o]};try{const e={docId:o,since:a,until:i},n=await this.mondayApi.request(Dm,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 r&&(s=s.slice(0,r)),{content:{doc_id:o,since:a,until:i,restoring_points:s}};const d=Math.min(r??10,10),p=s.slice(0,d+1),l=s.length>d,c=(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 i={docId:o,date:e.date,prevDate:a.date},r=await this.mondayApi.request(Am,i);return{...e,diff:r?.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:i,restoring_points:c,...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"}`}}}buildCommentAnchorMap(e){const t=new Map;for(const a of e){const e=a.content?.deltaFormat;if(!e||!Array.isArray(e))continue;let i=0;for(const r of e){const e=r.insert,o="string"==typeof e?e.length:1,n=r.attributes,s=n?.comments;if(s&&Array.isArray(s))for(const e of s){const r=String(e),n=t.get(r);if(n&&n.block_id===a.id){const e=Math.max(n.selection_from+n.selection_length,i+o);n.selection_length=e-n.selection_from}else n||t.set(r,{block_id:a.id,selection_from:i,selection_length:o})}i+=o}}return t}async fetchDocComments(e,t,a){try{const i={boardId:e,itemsLimit:100,updatesLimit:a},[r,o]=await Promise.all([this.mondayApi.request(Nm,i),this.mondayApi.request(Gv,{docId:[t]}).catch((()=>null))]),n=r.boards?.[0]?.items_page?.items;if(!n)return[];let s=new Map;if(o){const e=(o.docs?.[0]?.blocks??[]).filter((e=>null!=e)).map((e=>{let t;if("string"==typeof e.content)try{t=JSON.parse(e.content)}catch{t={}}else t=e.content??{};return{id:e.id??"",type:e.type??"",content:t}}));s=this.buildCommentAnchorMap(e)}const d=[];for(const e of n)if(e.updates&&0!==e.updates.length)for(const t of e.updates)d.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,anchor:s.get(t.id)??null,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 d}catch(e){return`Error fetching comments: ${e instanceof Error?e.message:"Unknown error"}`}}async enrichDocsWithMarkdown(e,t,a,i=!1,r=50,o,n){const s=await Promise.all(e.filter((e=>null!==e)).map((async e=>{let t,s="";try{const t={docId:e.id},a=await this.mondayApi.request(qm,t);s=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){s=`Error getting markdown: ${e instanceof Error?e.message:"Unknown error"}`}return i&&e.object_id&&(t=await this.fetchDocComments(e.object_id,e.id,r)),{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}))),...void 0!==o||void 0!==n?{blocks_pagination:{current_page:n??1,limit:o??25,count:(e.blocks??[]).filter((e=>null!=e)).length,has_more_pages:(e.blocks??[]).length===(o??25)}}:{}},blocks_as_markdown:s,...i&&{comments:t}}}))),d=t.page||1,p=t.limit||25,l=s.length,c=l===p;return{content:{message:`Documents retrieved (${s.length})`,pagination:{current_page:d,limit:p,count:l,has_more_pages:c},data:s}}}},class extends Er{constructor(){super(...arguments),this.name="workspace_info",this.type=ji.READ,this.annotations=Tr({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 Xv}async executeInternal(e){const t={workspace_id:e.workspace_id},a=await this.mondayApi.request(Hm,t);if(!a.workspaces||0===a.workspaces.length)return{content:`No workspace found with ID ${e.workspace_id}`};const i=function(e,t){const{workspaces:a,boards:i,docs:r,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=[];(i||[]).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(r||[]).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?xv(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 Cv(this.mondayApi));return{content:{message:"Workspace info retrieved",data:i}}}},class extends Er{constructor(){super(...arguments),this.name="list_workspaces",this.type=ji.READ,this.annotations=Tr({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 rg}async executeInternal(e){const t=e.searchTerm?1e4:e.limit,a=e.searchTerm?1:e.page;let i=null;if(e.searchTerm&&(i=tg(e.searchTerm),0===i.length))throw new Error("Search term did not include any alphanumeric characters. Please provide a valid search term.");const r=e=>({limit:t,page:a,membershipKind:e}),o=ag(await this.mondayApi.request(Zv,r(ac.Member))),n=!ig(o)||i&&!function(e,t){return t.some((t=>tg(t.name).includes(e)))}(i,o);let s=o;if(n){s=ag(await this.mondayApi.request(Zv,r(ac.All)))}if(!ig(s))return{content:{message:"No workspaces found.",data:[]}};const d=i&&s?.length<=eg,p=function(e,t,a,i){if(!e||t.length<=eg)return t;const r=(a-1)*i,o=r+i;return t.filter((t=>tg(t.name).includes(e))).slice(r,o)}(i,s,e.page,e.limit);if(!ig(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,c=await Cv(this.mondayApi),m=p.map((e=>({id:e.id,name:e.name,description:e.description||void 0,url:c&&e.id?xv(c,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:m}}}},class extends Er{constructor(){super(...arguments),this.name="create_doc",this.type=ji.WRITE,this.annotations=Tr({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, optional docOwnerIds)\n- item: Creates a document attached to an item (requires item_id, optional column_id, optional docOwnerIds)\n\nUSAGE EXAMPLES:\n- Workspace doc: { location: "workspace", workspace_id: 123, doc_name: "My Doc", doc_kind: "private" , markdown: "..." }\n- Workspace doc in folder: { location: "workspace", workspace_id: 123, doc_name: "My Doc", folder_id: 17264196 , markdown: "..." }\n- Item doc: { location: "item", item_id: 456, doc_name: "My Doc", column_id: "doc_col_1" , markdown: "..." }\n- Workspace doc with agent owner: { location: "workspace", workspace_id: 123, doc_name: "My Doc", markdown: "...", docOwnerIds: ["<agent_owner_user_id>"] }'}getInputSchema(){return cg}async executeInternal(e){const t=lg.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,i,r;if(a.type===pg.enum.workspace){const o={location:{workspace:{workspace_id:a.workspace_id.toString(),name:e.doc_name,kind:a.doc_kind||Yd.Public,folder_id:a.folder_id?.toString()}},...void 0!==e.docOwnerIds?{docOwnerIds:e.docOwnerIds}:{}},n=await this.mondayApi.request(ng,o);t=n?.create_doc?.id??void 0,i=n?.create_doc?.object_id??void 0,r=n?.create_doc?.url??void 0}else if(a.type===pg.enum.item){const o={itemId:a.item_id.toString()},n=await this.mondayApi.request(og,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===ff.Doc));let l=a.column_id;if(!l)if(p)l=p.id;else{const e={boardId:d.toString(),columnType:ff.Doc,columnTitle:"Doc"},t=await this.mondayApi.request(xm,e);if(l=t?.create_column?.id,!l)return{content:"Error: Failed to create doc column."}}const c={location:{board:{item_id:a.item_id.toString(),column_id:l}},...void 0!==e.docOwnerIds?{docOwnerIds:e.docOwnerIds}:{}},m=await this.mondayApi.request(ng,c);if(t=m.create_doc?.id??void 0,i=m.create_doc?.object_id??void 0,r=m.create_doc?.url??void 0,e.doc_name&&t)try{const a={docId:t,name:e.doc_name};await this.mondayApi.request(dg,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(sg,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},...i&&{object_id:i}},{content:{message:"Document successfully created",doc_id:t,object_id:i,doc_url:r,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 Er{constructor(){super(...arguments),this.name="add_content_to_doc",this.type=ji.WRITE,this.annotations=Tr({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 fg}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(hg,{docId:[e.doc_id]});t=a.docs?.[0]??null}else{const a=await this.mondayApi.request(ug,{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},i=await this.mondayApi.request(mg,a);if(!i?.add_content_to_doc_from_markdown)return{content:"Error: Failed to add content to document — no response from API."};const{success:r,block_ids:o,error:n}=i.add_content_to_doc_from_markdown;if(!r)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 Er{constructor(){super(...arguments),this.name="update_doc",this.type=ji.WRITE,this.annotations=Tr({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 Kg}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(Uv,{objectId:[e.object_id]}),i=a.docs?.[0];if(!i)return{content:`Error: No document found for object_id ${e.object_id}.`};t=i.id}const a=[];let i=null;for(let r=0;r<e.operations.length;r++){const o=e.operations[r];try{const i=await this.executeOperation(t,o,e.object_id);a.push(`- [OK] ${o.operation_type}${i?`: ${i}`:""}`)}catch(e){const t=e instanceof Error?e.message:"Unknown error";a.push(`- [FAILED] ${o.operation_type}: ${t}`),i=r;break}}const r=null!==i?i:e.operations.length,o=e.operations.length,n=`Completed ${r}/${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},i=await this.mondayApi.request(Vv,a);if(!i?.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 i={docId:e,markdown:t,afterBlockId:a},r=await this.mondayApi.request(jv,i),o=r?.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:yg(e.delta_format),alignment:e.alignment,direction:e.direction};case"code":return{deltaFormat:yg(e.delta_format),language:e.language};case"list_item":return{deltaFormat:yg(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),i={blockId:e,content:JSON.stringify(a)},r=await this.mondayApi.request(Mv,i);if(!r?.update_doc_block)throw new Error("No response from update_doc_block");return`Block ${e} updated`}async executeCreateBlock(e,t,a,i){const r=function(e){switch(e.block_type){case"text":return{text_block:{delta_format:bg(e.delta_format),text_block_type:e.text_block_type?e.text_block_type:void 0,alignment:vg(e.alignment),direction:gg(e.direction)}};case"list_item":return{list_block:{delta_format:bg(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:bg(e.delta_format),text_block_type:Vl.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(i){const e=Object.keys(r);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=r[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=i}const o={docId:e,afterBlockId:a,blocksInput:[r]},n=await this.mondayApi.request(Qv,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(Bv,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(qv,{docId:[e]}),i=a.docs?.[0];if(!i?.object_id)throw new Error(`Could not resolve object_id for doc ${e}`);return i.object_id}async resolveDocItemId(e){const t=await this.mondayApi.request(Hv,{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(Gv,{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,i,r,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 c;if(r){const e=JSON.parse(r),t=Pf.safeParse(e);if(!t.success)throw new Error(`Invalid mentions_list format: ${t.error.message}`);c=t.data}const m={itemId:l,body:a,parentId:i?.toString(),mentionsList:c},u=await this.mondayApi.request(Wv,m);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=i?`Reply to update ${i}`:"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 i=t.find((e=>e.id===a));if(!i)throw new Error(`${v} created (update ID: ${h}) but block annotation failed: block ${a} not found in doc ${e}`);const r=i.content.deltaFormat;if(!r)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 r)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=Ig(r,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 c={...i.content,deltaFormat:l},m=await this.mondayApi.request(Mv,{blockId:a,content:JSON.stringify(c)});if(!m?.update_doc_block)throw new Error(`${v} created (update ID: ${h}) but block annotation write returned no confirmation for block ${a}`)}}const g=d.length;return`${v} created${g>1?` across ${g} blocks`:1===g?" on block":""} (update ID: ${h})`}async executeReplaceBlock(e,t,a,i,r){await this.executeDeleteBlock(t);try{return`Block ${t} replaced. ${await this.executeCreateBlock(e,a,i,r)}`}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 Er{constructor(){super(...arguments),this.name="update_workspace",this.type=ji.WRITE,this.annotations=Tr({title:"Update Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing workspace in monday.com"}getInputSchema(){return i_}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(a_,t),i=await Cv(this.mondayApi),r=i?xv(i,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:r}}}},class extends Er{constructor(){super(...arguments),this.name="update_folder",this.type=ji.WRITE,this.annotations=Tr({title:"Update Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing folder in monday.com"}getInputSchema(){return o_}async executeInternal(e){const{position_object_id:t,position_object_type:a,position_is_after:i}=e;if(!!t!=!!a)throw new Error("position_object_id and position_object_type must be provided together");const r={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:i,position_object_id:t,position_object_type:a}:void 0},o=await this.mondayApi.request(r_,r);return{content:{message:`Folder ${o.update_folder?.id} updated`,folder_id:o.update_folder?.id,folder_name:o.update_folder?.name}}}},class extends Er{constructor(){super(...arguments),this.name="create_workspace",this.type=ji.WRITE,this.annotations=Tr({title:"Create Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new workspace in monday.com"}getInputSchema(){return s_}async executeInternal(e){const t={name:e.name,workspaceKind:e.workspaceKind,description:e.description,accountProductId:e.accountProductId},a=await this.mondayApi.request(n_,t),i=await Cv(this.mondayApi),r=i&&a.create_workspace?.id?xv(i,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:r}}}},class extends Er{constructor(){super(...arguments),this.name="create_folder",this.type=ji.WRITE,this.annotations=Tr({title:"Create Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new folder in a monday.com workspace"}getInputSchema(){return p_}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(d_,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 Er{constructor(){super(...arguments),this.name="move_object",this.type=ji.WRITE,this.annotations=Tr({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 m_}async executeUpdateFolder(e){const{id:t,position_object_id:a,position_object_type:i,position_is_after:r,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!i)throw new Error("position_object_id and position_object_type must be provided together");const d={folderId:t,position:a?{position_is_after:r,position_object_id:a,position_object_type:i}:void 0,parentFolderId:o,workspaceId:n,accountProductId:s},p=await this.mondayApi.request(r_,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:i,position_is_after:r,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!i)throw new Error("position_object_id and position_object_type must be provided together");const d={boardId:t,attributes:{position:a?{position_is_after:r,position_object_id:a,position_object_type:i}:void 0,folder_id:o,workspace_id:n,account_product_id:s}},p=await this.mondayApi.request(l_,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:i,position_is_after:r,parentFolderId:o,workspaceId:n,accountProductId:s}=e;if(!!a!=!!i)throw new Error("position_object_id and position_object_type must be provided together");const d={overviewId:t,attributes:{position:a?{position_is_after:r,position_object_id:a,position_object_type:i}:void 0,folder_id:o,workspace_id:n,account_product_id:s}},p=await this.mondayApi.request(c_,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 ml.Folder:return this.executeUpdateFolder(e);case ml.Board:return this.executeUpdateBoardHierarchy(e);case ml.Overview:return this.executeUpdateOverviewHierarchy(e);default:throw new Error(`Unsupported object type: ${t}`)}}},class extends Er{constructor(){super(...arguments),this.name="create_dashboard",this.type=ji.WRITE,this.annotations=Tr({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 e_}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(Jg,t);if(!a.create_dashboard)throw new Error("Failed to create dashboard");const i=a.create_dashboard;return{content:{message:`Dashboard ${i.id} successfully created`,dashboard_id:i.id,dashboard_name:i.name}}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to create dashboard: ${t}`)}}},class extends Er{constructor(){super(...arguments),this.name="all_widgets_schema",this.type=ji.READ,this.annotations=Tr({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(Xg,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 i=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,r=t?.description||t?.title||`${e.widget_type} widget for data visualization`;a[e.widget_type]={type:e.widget_type,description:r,schema:e.schema},i++}if(0===i)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:nv}}}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to fetch widget schemas: ${t}`)}}},class extends Er{constructor(){super(...arguments),this.name="create_widget",this.type=ji.WRITE,this.annotations=Tr({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 t_}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(Zg,t);if(!a.create_widget)throw new Error("Failed to create widget");const i=a.create_widget;i.parent?.kind===ec.Dashboard?i.parent.id:i.parent;return{content:{message:`Widget ${i.id} created`,widget_id:i.id,widget_name:i.name,dashboard_id:i.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 Er{constructor(){super(...arguments),this.name="board_insights",this.type=ji.READ,this.annotations=Tr({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 __}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})))||[],i=new Set(e.aggregations.filter((e=>e.function===Rd.Label)).map((e=>e.columnId))),r=e.groupBy?.filter((e=>!i.has(e))).map((e=>({function:Rd.Label,columnId:e})))??[],o=e.aggregations.concat(r).map((e=>{if(e.function){const o=`${e.function}_${e.columnId}`,n=t[o]||0;t[o]=n+1;const s=`${o}_${n}`;return v_.has(e.function)&&(a.some((e=>e.column_id===s))||a.push({column_id:s})),{type:$d.Function,function:(i=e.function,r=e.columnId,{function:i,params:i===Rd.CountItems?[]:[{type:$d.Column,column:g_(r),as:r}]}),as:s}}var i,r;const o={type:$d.Column,column:g_(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:$d.Column,column:g_(e.column_id),as:e.column_id})})),{selectElements:o,groupByElements:a}}(e),i=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),r=function(e){return{id:e.boardId.toString(),type:Od.Table}}(e),o={query:{from:r,query:i,select:t,group_by:a,limit:e.limit},boardId:String(e.boardId)},n=await this.mondayApi.request(u_,o),s=(n.aggregate?.results??[]).map((e=>{const t={};return(e.entries??[]).forEach((e=>{const a=e.alias??"";if(!a)return;const i=e.value;if(!i)return void(t[a]=null);const r=i.result??i.value??null;t[a]=r})),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 Er{constructor(){super(...arguments),this.name="search",this.type=ji.READ,this.annotations=Tr({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 D_}async executeInternal(e){if(e.searchType!==S_.FOLDERS&&e.searchTerm)try{return{content:{message:"Search results",data:(await this.searchWithDevEndpointAsync(e)).items}}}catch(e){of(e)}const t={[S_.BOARD]:this.searchBoardsAsync.bind(this),[S_.DOCUMENTS]:this.searchDocsAsync.bind(this),[S_.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===S_.BOARD)return this.searchBoardsWithDevEndpointAsync(e.searchTerm,e.limit,t);if(e.searchType===S_.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 i={query:e,limit:t,workspaceIds:a};return{items:(await this.mondayApi.request(I_,i,{versionOverride:"dev",timeout:af})).search.boards.results.map((e=>({id:E_.BOARD+e.indexed_data.id,title:e.indexed_data.name,url:e.indexed_data.url}))),wasFiltered:!0}}async searchDocsWithDevEndpointAsync(e,t,a){const i={query:e,limit:t,workspaceIds:a};return{items:(await this.mondayApi.request(T_,i,{versionOverride:"dev",timeout:af})).search.docs.results.map((e=>({id:E_.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&&rf(new Error("Searching for folders require specifying workspace ids"),"search folders");const a=await this.mondayApi.request(w_,t),i=this.searchAndVirtuallyPaginate(e,a.folders||[],(e=>e.name));return{items:i.items.map((e=>({id:E_.FOLDER+e.id,title:e.name}))),wasFiltered:i.wasFiltered}}async searchDocsAsync(e){const t={...this.getPagingParamsForSearch(e),workspace_ids:e.workspaceIds?.map((e=>e.toString()))},a=await this.mondayApi.request(y_,t),i=this.searchAndVirtuallyPaginate(e,a.docs||[],(e=>e.name));return{items:i.items.map((e=>({id:E_.DOCUMENT+e.id,title:e.name,url:e.url||void 0}))),wasFiltered:i.wasFiltered}}async searchBoardsAsync(e){const t={...this.getPagingParamsForSearch(e),workspace_ids:e.workspaceIds?.map((e=>e.toString()))},a=await this.mondayApi.request(b_,t),i=this.searchAndVirtuallyPaginate(e,a.boards||[],(e=>e.name));return{items:i.items.map((e=>({id:E_.BOARD+e.id,title:e.name,url:e.url}))),wasFiltered:i.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 i=tg(e.searchTerm??""),r=(e.page-1)*e.limit,o=r+e.limit;return{items:t.filter((e=>tg(a(e)).includes(i))).slice(r,o),wasFiltered:!0}}},class extends Er{constructor(){super(...arguments),this.name="get_user_context",this.type=ji.READ,this.annotations=Tr({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(x_,{},{versionOverride:"dev"});if(!e)return{content:"AUTHENTICATION_ERROR: Unable to fetch current user. Verify API token and user permissions."};const i=await this.fetchFavorites(t||[]),r=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:i,relevantBoards:r,relevantPeople:o}}}}async fetchFavorites(e){const t=this.groupByType(e),a=Object.keys(t);if(0===a.length)return[];const i={};for(const e of a)i[L_[e]]=t[e];const r=await this.mondayApi.request(F_,i),o=[];for(const e of a){const t=V_[e];for(const a of r[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 Er{constructor(){super(...arguments),this.name="update_assets_on_item",this.type=ji.WRITE,this.annotations=Tr({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 R_}async executeInternal(e){const t={boardId:e.boardId,itemId:e.itemId,columnId:e.columnId,files:e.files},a=await this.mondayApi.request(O_,t);return{content:`Item ${a.update_assets_on_item?.id} (${a.update_assets_on_item?.name}) assets successfully updated`}}},class extends Er{constructor(){super(...arguments),this.name="get_assets",this.type=ji.READ,this.annotations=Tr({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 C_}async executeInternal(e){const t=await this.mondayApi.request(P_,{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 Er{constructor(){super(...arguments),this.name="get_notetaker_meetings",this.type=ji.READ,this.annotations=Tr({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 U_}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},i=await this.mondayApi.request(j_,a,{versionOverride:"2026-04"}),r=i.notetaker?.meetings;if(!r?.meetings||0===r.meetings.length)return{content:"No notetaker meetings found matching the specified criteria."};return{content:{message:"Meetings retrieved",data:{meetings:r.meetings,pagination:{has_next_page:r.page_info?.has_next_page??!1,cursor:r.page_info?.cursor??null,count:r.meetings.length}}}}}},class extends Er{constructor(){super(...arguments),this.name="create_view",this.type=ji.WRITE,this.annotations=Tr({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 yu}async executeInternal(e){const t={boardId:e.boardId,type:e.type,name:e.name,filter:e.filter,sort:e.sort,settings:e.settings},a=await this.mondayApi.request(bu,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 Er{constructor(){super(...arguments),this.name="update_view",this.type=ji.WRITE,this.annotations=Tr({title:"Update View",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Update an existing board view (tab) — change its name, filter rules, or sort order. Provide only the fields you want to change. Omitted fields are left unchanged.\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 Iu}async executeInternal(e){const t={viewId:e.viewId,boardId:e.boardId,type:e.type,name:e.name,filter:e.filter,sort:e.sort,settings:e.settings},a=await this.mondayApi.request(wu,t);return a.update_view?{content:`View "${a.update_view.name}" (ID: ${a.update_view.id}, type: ${a.update_view.type}) successfully updated`}:{content:"Failed to update view - no response from API"}}},class extends Er{constructor(){super(...arguments),this.name="create_view_table",this.type=ji.WRITE,this.annotations=Tr({title:"Create Table View",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a new table-type board view with optional filters, sort, tags, and table-specific settings (column visibility/order and group-by). Use this instead of create_view when you need to configure table-specific settings. For a simple table view, create_view also works.\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 settings.columns: { "column_properties": [{ "column_id": "status", "visible": true }], "column_order": ["name", "status", "date"] }\nExample settings.group_by: { "conditions": [{ "columnId": "status" }], "hideEmptyGroups": true }'}getInputSchema(){return Du}async executeInternal(e){const t={boardId:e.boardId,name:e.name,filter:e.filter,sort:e.sort,tags:e.tags,settings:e.settings},a=await this.mondayApi.request(Tu,t);return a.create_view_table?{content:`Table view "${a.create_view_table.name}" (ID: ${a.create_view_table.id}, type: ${a.create_view_table.type}) successfully created`}:{content:"Failed to create table view - no response from API"}}},class extends Er{constructor(){super(...arguments),this.name="update_view_table",this.type=ji.WRITE,this.annotations=Tr({title:"Update Table View",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Update an existing table-type board view — change its name, filters, sort, tags, or table-specific settings (column visibility/order and group-by). Provide only the fields you want to change. Omitted fields are left unchanged.\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 settings.columns: { "column_properties": [{ "column_id": "status", "visible": true }], "column_order": ["name", "status", "date"] }\nExample settings.group_by: { "conditions": [{ "columnId": "status" }], "hideEmptyGroups": true }'}getInputSchema(){return Ou}async executeInternal(e){const t={viewId:e.viewId,boardId:e.boardId,name:e.name,filter:e.filter,sort:e.sort,tags:e.tags,settings:e.settings},a=await this.mondayApi.request(Nu,t);return a.update_view_table?{content:`Table view "${a.update_view_table.name}" (ID: ${a.update_view_table.id}, type: ${a.update_view_table.type}) successfully updated`}:{content:"Failed to update table view - no response from API"}}},class extends Er{constructor(){super(...arguments),this.name="undo_action",this.type=ji.WRITE,this.annotations=Tr({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 B_}async executeInternal(e){return await this.mondayApi.request(M_,{boardId:e.boardId.toString(),undoRecordId:e.undoRecordId},{versionOverride:"dev"}),{content:`Successfully undid action "${e.undoRecordId}" on board ${e.boardId}.`}}},class extends Er{constructor(){super(...arguments),this.name="get_object_schemas",this.type=ji.READ,this.annotations=Tr({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 Jm}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(Km,t)).get_object_schemas??[];return{content:{message:`Retrieved ${a.length} object schema(s)`,schemas:a}}}},class extends Er{constructor(){super(...arguments),this.name="create_object_schema",this.type=ji.WRITE,this.annotations=Tr({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 Zm}async executeInternal(e){const t={name:e.name,parentId:e.parentId,description:e.description},a=await this.mondayApi.request(Xm,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 Er{constructor(){super(...arguments),this.name="update_object_schema",this.type=ji.WRITE,this.annotations=Tr({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 tu}async executeInternal(e){const t={id:e.id,revision:e.revision,parentId:e.parentId,description:e.description},a=await this.mondayApi.request(eu,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 Er{constructor(){super(...arguments),this.name="delete_object_schema",this.type=ji.WRITE,this.annotations=Tr({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 iu}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(au,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 Er{constructor(){super(...arguments),this.name="delete_object_schema_columns",this.type=ji.WRITE,this.annotations=Tr({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 ou}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(ru,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 Er{constructor(){super(...arguments),this.name="manage_object_schema_board_connection",this.type=ji.WRITE,this.annotations=Tr({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 du}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(nu,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(su,t)).detach_boards_from_object_schema??[],i=a.filter((e=>e.success)).length,r=a.filter((e=>!e.success));return{content:{message:`${i} board(s) successfully detached`,results:a,...r.length>0&&{failures:r}}}}}},class extends Er{constructor(){super(...arguments),this.name="manage_object_schema_columns",this.type=ji.WRITE,this.annotations=Tr({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 with fetchMode "${pu.Schema}" 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 fu}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},i=await this.mondayApi.request(lu,a);return{content:{message:`Columns successfully added to object schema "${i.create_object_schema_columns?.name}"`,schema_id:i.create_object_schema_columns?.id,schema_name:i.create_object_schema_columns?.name,revision:i.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(cu,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 Er{constructor(){super(...arguments),this.name="set_object_schema_column_active_state",this.type=ji.WRITE,this.annotations=Tr({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 gu}async executeInternal(e){if(!e.objectSchemaId&&!e.objectSchemaName)throw new Error("Either objectSchemaId or objectSchemaName must be provided");const t={deactivate:dp.Deactivate,reactivate:dp.Reactivate},a={objectSchemaId:e.objectSchemaId,objectSchemaName:e.objectSchemaName,columnId:e.columnId,action:t[e.action]},i=await this.mondayApi.request(vu,a);return{content:{message:`Column successfully ${e.action}d on object schema "${i.set_object_schema_column_active_state?.name}"`,schema_id:i.set_object_schema_column_active_state?.id,schema_name:i.set_object_schema_column_active_state?.name,revision:i.set_object_schema_column_active_state?.revision}}}},class extends Er{constructor(){super(...arguments),this.name="get_asset_upload_url",this.type=ji.WRITE,this.annotations=Tr({title:"Get Asset Upload URL",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Get a presigned URL to upload a file to monday.com. Returns an upload_id and upload_url.\n\nAfter calling this tool, upload the file to the returned URL using an HTTP PUT request and capture the ETag header from the response:\n\ncurl -i -X PUT "<upload_url>" \\\n -H "Content-Type: <the contentType you provided>" \\\n --data-binary @<local_file_path>\n\nThe response includes an ETag header (e.g. ETag: "abc123...") — save this value.\n\nThen call finalize_asset_upload with the upload_id, etag, board_id, item_id, and column_id to complete the upload and attach the file to an item\'s file column.\n\nMax file size: 500MB.'}getInputSchema(){return H_}async executeInternal(e){const t=(await this.mondayApi.request(q_,{input:{file_name:e.fileName,content_type:e.contentType,file_size:e.fileSize,source:"mcp",multipart:!1}},{versionOverride:"dev"})).create_upload,a=t.parts[0]?.url;if(!a)throw new Error("create_upload returned no upload URL — parts array was empty");return{content:{upload_id:t.upload_id,upload_url:a,url_expires_at:t.expires_at}}}},class extends Er{constructor(){super(...arguments),this.name="finalize_asset_upload",this.type=ji.WRITE,this.annotations=Tr({title:"Finalize Asset Upload",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Finalize a file upload and create the asset on monday.com. Call this after uploading the file to the presigned URL from get_asset_upload_url. Requires the etag value from the PUT response headers. Automatically attaches the uploaded asset to the specified file column on the item. Returns the created asset_id."}getInputSchema(){return Q_}async executeInternal(e){const t=(await this.mondayApi.request(G_,{input:{upload_id:e.uploadId,holder:{type:"ITEM",id:e.itemId},board_id:e.boardId,parts:[{part_number:1,etag:e.etag}]}},{versionOverride:"dev"})).complete_upload,a=JSON.stringify({added_file:{fileType:"ASSET",name:t.filename,assetId:String(t.id)}});return await this.mondayApi.request(W_,{boardId:e.boardId,itemId:e.itemId,columnId:e.columnId,value:a}),{content:{asset_id:t.id,filename:t.filename,content_type:t.content_type,file_size:t.file_size,url:t.url,filelink:t.filelink}}}},class extends Er{constructor(){super(...arguments),this.name="link_board_items_workflow",this.type=ji.READ,this.annotations=Tr({title:"Link Board Items Workflow",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'When to use: any board-relation / cross-board linking task. **Hard gate — you MUST call this BEFORE get_board_items_page, or change_item_column_values in the same turn. No discovery, matching, or write happens first.** Triggers: **link** or **connect** items **across boards** (board-relation / "connect boards" / pairs) — also vague phrasings where only one side is named ("link this to **an** item on another board", "**the matching** row"). This tool is read-only (no API).'}getInputSchema(){return Y_}async executeInternal(e){return{content:z_}}},class extends Er{constructor(){super(...arguments),this.name="fetch_file_content",this.type=ji.READ,this.annotations=Tr({title:"Fetch File Content",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch and extract the text content from a file stored in a monday.com files column.\n\nUse this tool when you need to read, summarize, or analyze the content of files attached to board items. Provide the item ID and column ID from the get_board_items_page response — the column value will be a URL like \"https://monday.com/protected_static/...\" indicating a file is present (null means no file).\n\nPROACTIVE USE: If you retrieve board items and notice a files column with a non-null value (a URL), consider fetching its content if it could help answer the user's question — don't wait to be explicitly asked.\n\nSupported file types and what is returned:\n- Text files (.txt, .md, .csv, .json): raw text content\n- Word documents (.docx): extracted text content\n- PDF files (.pdf): extracted text content\n- Excel files (.xlsx, .xls): extracted text content per sheet\n- Images (.png, .jpg, .gif, .webp, .svg, .bmp, .ico): returns the public URL so you can view or analyze the image directly\n\nText responses include a total_length field. If has_more is true, the content was truncated — you can call this tool again with next_offset if you need the remaining content.\n\nWhen to use:\n- User asks to summarize, read, or analyze the content of a file in a files column\n- User asks questions about what is inside a file (e.g., \"what does the PDF say?\")\n- User wants to extract data from a CSV or Excel file attached to a board item\n- A board item has a files column with a non-null value and the user's question may be answered by its content — even if the user didn't explicitly ask to read the file\n\nWhen NOT to use:\n- The files column value is null (no file uploaded for that item)"}getInputSchema(){return ob}async executeInternal(e){const{item_id:t,column_id:a,file_name:i,offset:r=0}=e,o=await this.mondayApi.request(K_,{itemId:[t],columnId:[a]}),n=o?.items?.[0]?.assets;if(!n||0===n.length)return{content:{message:`No file found for item ${t} in column ${a}. The column may be empty or the column ID may be incorrect.`}};return{content:{files:await Promise.all(n.map((e=>db(e,r,i))))}}}},class extends Er{constructor(){super(...arguments),this.name="get_agent",this.type=ji.READ,this.annotations=Tr({title:"Get monday Platform Agent(s)",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'Fetch one or more personal/custom agents on the monday.com platform.\n\nmonday platform agents are user-built work orchestrators and executors that live on the monday.com platform — each has a profile (name, role, avatar), a goal, and an execution plan in markdown describing capabilities and operating principles. Agents in state ACTIVE can be triggered to perform automated work on monday boards. They are NOT local LangChain or MCP agents — they are managed entities on the monday.com platform owned by a specific user.\n\nTerminology note: users might ask for "agent" in natural language (for example: "create me an agent"), but in this API context this refers to monday personal/custom agents.\n\nAgent state in get_agent results is one of ACTIVE, INACTIVE, ARCHIVED, or FAILED. DELETED agents are filtered from these queries — DELETED only appears as the return value of delete_agent. Agent kind is one of PERSONAL, ACCOUNT_LEVEL, or EXTERNAL.\n\nPass id to fetch one specific agent by its unique identifier. Omit id to list agents owned by the authenticated user (capped at 100 — ask the user for a higher limit if needed). An empty list means the user owns no agents, which is not an error.\n\nUSAGE EXAMPLES:\n- Fetch one agent: { "id": "42" }\n- List my agents: {}'}getInputSchema(){return hb}async executeInternal(e){if(void 0!==e.id)try{const{agents:t}=await this.mondayApi.request(lb,{ids:[e.id]},{versionOverride:"dev"}),a=t?.[0];return a?{content:{message:"monday platform agent",agent:a}}:{content:`monday platform agent ${e.id} not found, or the authenticated user does not have access to it.`}}catch(e){rf(e,"get monday platform agent")}try{const{agents:e}=await this.mondayApi.request(lb,{limit:100},{versionOverride:"dev"}),t=e??[];return{content:{message:"monday platform agents owned by the authenticated user (limited to 100 — ask the user if they need more)",count:t.length,agents:t}}}catch(e){rf(e,"list monday platform agents")}}},class extends Er{constructor(){super(...arguments),this.name="create_agent",this.type=ji.WRITE,this.annotations=Tr({title:"Create monday Platform Agent",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a personal/custom agent on the monday.com platform. See get_agent for what a monday platform agent is.\n\nTerminology note: users might ask for "agent" in natural language (for example: "create me an agent"), but in this API context this refers to monday personal/custom agents.\n\nTwo modes:\n- Prompt mode (recommended): pass prompt (and optional agent_model) and the platform generates profile + goal + plan via AI.\n- Manual mode: omit prompt and pass any of name/role/role_description/user_prompt to create a blank agent profile quickly.\n\nDo not mix prompt with manual profile fields in one request.\n\nCreated agents start in state INACTIVE and must be activated before they can be triggered. Instruct the user to activate from the monday.com agent settings UI.\n\ncreated_at and updated_at are null in the response — call get_agent with the returned id afterward to fetch them.\n\nUSAGE EXAMPLES:\n- AI-generated: { "prompt": "Run my daily standup — collect status updates, summarize blockers, and post recap every weekday at 9am." }\n- Blank/manual: { "name": "Standup Bot", "role": "Project Manager", "gender": "female" }\n- Blank/defaults: {}'}getInputSchema(){return fb}async executeInternal(e){const t=void 0!==e.prompt,a=void 0!==e.name||void 0!==e.role||void 0!==e.role_description||void 0!==e.avatar_url||void 0!==e.gender||void 0!==e.background_color||void 0!==e.user_prompt;if(t&&a)throw new Error("create_agent accepts either prompt mode or manual mode. Do not pass prompt together with manual profile fields.");if(!t&&void 0!==e.agent_model)throw new Error("agent_model can only be used when prompt is provided.");if(!t)try{const t={};void 0!==e.name&&(t.name=e.name),void 0!==e.role&&(t.role=e.role),void 0!==e.role_description&&(t.role_description=e.role_description),void 0!==e.avatar_url&&(t.avatar_url=e.avatar_url),void 0!==e.gender&&(t.gender=e.gender),void 0!==e.background_color&&(t.background_color=e.background_color),void 0!==e.user_prompt&&(t.user_prompt=e.user_prompt);const a={input:t},i=await this.mondayApi.request(mb,a,{versionOverride:"dev"});if(!i.create_blank_agent?.id)throw new Error("monday platform agent creation returned no id");return{content:{message:`monday platform agent ${i.create_blank_agent.id} created in state INACTIVE — user must activate it from the monday.com UI before it can be triggered`,agent:i.create_blank_agent}}}catch(e){rf(e,"create blank monday platform agent")}try{const t={input:{prompt:e.prompt,agent_model:e.agent_model}},a=await this.mondayApi.request(cb,t,{versionOverride:"dev"});if(!a.create_agent?.id)throw new Error("monday platform agent creation returned no id");return{content:{message:`monday platform agent ${a.create_agent.id} created in state INACTIVE — user must activate it from the monday.com UI before it can be triggered`,agent:a.create_agent}}}catch(e){rf(e,"create monday platform agent")}}},class extends Er{constructor(){super(...arguments),this.name="delete_agent",this.type=ji.WRITE,this.annotations=Tr({title:"Delete monday Platform Agent",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return'Permanently delete a personal/custom agent on the monday.com platform. Removes the agent and all of its versions. The agent stops appearing in get_agent results and can no longer be triggered. This action cannot be undone. Only the agent owner can delete it.\n\nTerminology note: users might ask for "agent" in natural language (for example: "delete my standup agent"), but in this API context this refers to monday personal/custom agents.\n\nVERIFY BEFORE DELETING: When the user refers to an agent by name or description (e.g. "delete my standup bot"), call get_agent (no id) first to list all the user\'s agents and confirm the correct id. Do not infer ids — pick the matching agent by inspecting profile.name / role / goal.\n\nUSAGE EXAMPLE:\n{ "id": "42" }'}getInputSchema(){return vb}async executeInternal(e){try{const t={id:e.id},a=await this.mondayApi.request(ub,t,{versionOverride:"dev"});if(!a.delete_agent?.id)throw new Error("monday platform agent delete returned no id");return{content:{message:`monday platform agent ${a.delete_agent.id} deleted`,agent:a.delete_agent}}}catch(e){rf(e,"delete monday platform agent")}}},class extends Er{constructor(){super(...arguments),this.name="list_automations",this.type=ji.READ,this.annotations=Tr({title:"List Board Automations",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"List all automations on a specific monday.com board, including their ids, titles, active state, and configuration.\n\nWhen NOT to use: Do not call this tool to get general board information unrelated to automations."}getInputSchema(){return yb}async executeInternal(e){try{const t={boardIds:[e.boardId],limit:e.limit??100,...e.cursor?{cursor:e.cursor}:{}},a=await this.mondayApi.request(gb,t,{versionOverride:"2026-10"}),i=(a.board_automations?.items??[]).map(bb),r=a.board_automations?.cursor??null;return{content:{message:`Found ${i.length} live workflow(s) on board ${e.boardId}`,workflows:i,pagination:{nextCursor:r,hasMore:null!==r}}}}catch(e){rf(e,"list live workflows")}}},class extends Er{constructor(){super(...arguments),this.name="manage_workflows",this.type=ji.WRITE,this.annotations=Tr({title:"Manage Workflows",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return'Activate, deactivate, or delete an existing monday.com automation/workflow.\n\nRequires a workflow id. When the user refers to an automation by name, always call list_automations first to resolve the id — never guess or infer ids.\n\nActions:\n- activate: enables a paused workflow so it starts responding to its trigger.\n- deactivate: pauses a workflow while preserving its definition.\n- delete: permanently removes a workflow — irreversible.\n\nWhen intent is ambiguous ("stop", "turn off", "pause"), prefer deactivate over delete.\n\nTerminology: "workflows" and "automations" are the same thing.'}getInputSchema(){return Eb}async executeInternal(e){const t=e;switch(t.action){case"activate":return this.activateWorkflow(t);case"deactivate":return this.deactivateWorkflow(t);case"delete":return this.deleteWorkflow(t)}}async activateWorkflow(e){try{const t={id:e.workflowId},a=await this.mondayApi.request(wb,t,{versionOverride:"dev"});if(!a.activate_live_workflow?.is_success)throw new Error(`Workflow ${e.workflowId} activation did not report success`);return{content:{message:`Workflow ${e.workflowId} activated`,workflowId:e.workflowId,isActive:!0}}}catch(e){rf(e,"activate workflow")}}async deactivateWorkflow(e){try{const t={id:e.workflowId},a=await this.mondayApi.request(Ib,t,{versionOverride:"dev"});if(!a.deactivate_live_workflow?.is_success)throw new Error(`Workflow ${e.workflowId} deactivation did not report success`);return{content:{message:`Workflow ${e.workflowId} deactivated`,workflowId:e.workflowId,isActive:!1}}}catch(e){rf(e,"deactivate workflow")}}async deleteWorkflow(e){try{const t={id:e.workflowId},a=await this.mondayApi.request(Tb,t,{versionOverride:"dev"});if(!a.delete_live_workflow?.is_success)throw new Error(`Workflow ${e.workflowId} deletion did not report success`);return{content:{message:`Workflow ${e.workflowId} deleted`,workflowId:e.workflowId}}}catch(e){rf(e,"delete workflow")}}},class extends Er{constructor(e,t,a){super(e,a),this.apiToken=t,this.name="create_automation",this.type=ji.WRITE,this.annotations=Tr({title:"Create Automation",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Creates an automation on a monday board from a natural-language description (e.g. "notify me when status changes to Done").\n\nUse when the user has clearly described what to automate — both the trigger (what kicks it off) and the action (what should happen), and you know which board to create it on. If basic details are missing (including boardId), ask the user first instead of calling with a vague prompt.\n\nIf the prompt is still ambiguous, the tool returns status: "needs_clarification" with the unresolved fields — present them to the user, gather answers, then call again.\n\nTerminology:\n - Trigger: When the automation should run (e.g. "when a new item is created").\n - Conditions: additional conditions that must be met for the automation to run.\n - Actions: what the automation should do when it runs (can have multiple actions).\n'}getInputSchema(){return Sb}async executeInternal(e){try{const t=await fetch("https://api.monday.com/platform-ai-gateway/agents/lite-builder",{method:"POST",headers:{Authorization:this.apiToken,"Content-Type":"application/json"},body:JSON.stringify({userPrompt:e.userPrompt,boardId:e.boardId}),signal:AbortSignal.timeout(18e4)});if(!t.ok){const e=await t.text().catch((()=>""));throw new Error(`lite-builder responded with HTTP ${t.status}${e?`: ${e}`:""}`)}return{content:await t.json()}}catch(e){rf(e,"create automation")}}},class extends Er{constructor(){super(...arguments),this.name="create_workflow",this.type=ji.WRITE,this.annotations=Tr({title:"Create Workflow",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Creates a new empty workflow in a monday.com workspace.\n\nUse this when the user wants to build a new standalone workflow from scratch. Workflows are cross-board, workspace-level — distinct from automations (use create_automation for those). You only need a workspaceId to get started — all other fields are optional.\n\nReturns:\n- workflowObjectId: the workflow object ID\n- workflowDraftId: the current draft version ID — workflows start as drafts and must be published before they run\n\nTerminology:\n- Workflows vs. automations: workflows are standalone objects scoped to a workspace. Automations (create_automation) are per-board trigger/action rules. They are different products.\n- Draft: the editable, inactive version of a workflow. Changes are made on the draft version until it is published as the live version.\n- Privacy: PUBLIC — visible to all workspace members (default). PRIVATE — restricted access. SHAREABLE — accessible to guests outside the account.\n"}getInputSchema(){return Nb}async executeInternal(e){try{const t={workspace_id:e.workspaceId,...void 0!==e.title?{title:e.title}:{},...void 0!==e.privacyKind?{privacy_kind:e.privacyKind}:{},...void 0!==e.description?{description:e.description}:{},...void 0!==e.folderId?{folder_id:e.folderId}:{},...void 0!==e.ownerIds?{owner_ids:e.ownerIds}:{}},a=await this.mondayApi.request(Db,t,{versionOverride:"dev"});if(!a.create_workflow)throw new Error("create_workflow returned null");const{workflow_object_id:i,workflow_draft_id:r}=a.create_workflow;if(!i||!r)throw new Error("create_workflow returned missing identifiers");return{content:{message:`Workflow Builder workflow created in workspace ${e.workspaceId}`,workflowObjectId:i,workflowDraftId:r}}}catch(e){rf(e,"create Workflow Builder workflow")}}}];var dy;!function(e){e.API="api",e.APPS="apps",e.ATP="atp"}(dy||(dy={}));const py=(e,t)=>{let a=[];t?.mode===dy.APPS?a=[...Ir]:t?.mode!==dy.API&&t?.mode||(a=[...sy,...ny]);const i=a.map((t=>((e,t)=>e.prototype instanceof Er?new e(t.apiClient,t.apiToken,t.context):e.prototype instanceof er?new e(t.apiToken):new e)(t,e)));return i.filter((e=>{if(!t)return e.type!==ji.ALL_API;if(t.mode===dy.API&&"only"===t.enableDynamicApiTools)return e.type===ji.ALL_API;let a=!1;return t.mode===dy.API&&!1===t.enableDynamicApiTools&&(a=a||e.type===ji.ALL_API),t.readOnlyMode&&(a=a||e.type!==ji.READ),t.include?a=a||!t.include?.includes(e.name):t.exclude&&(a=a||t.exclude?.includes(e.name)),!a}))};class ly{constructor(){this.dynamicTools=new Map}registerTool(e,t){const a=e.enabledByDefault??!0,i=a;this.dynamicTools.set(e.name,{instance:e,mcpTool:t,enabled:i,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 cy extends Pi{constructor(e){super({name:"monday.com",version:"1.0.0"},{capabilities:{tools:{listChanged:!0}}}),this.dynamicToolManager=new ly,this.toolInstances=[],this.managementTool=null,this.mondayApiClient=this.createApiClient(e),this.mondayApiToken=e.mondayApiToken,this.context={...e.context,apiVersion:e.mondayApiVersion??Xi},this.registerTools(e)}createApiClient(e){return new i({token:e.mondayApiToken,apiVersion:e.mondayApiVersion??Xi,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 kb;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 py(t,e.toolsConfiguration)}registerSingleTool(t){const a=t.getInputSchema(),i=this.registerTool(t.name,{...t,title:t.annotations?.title,description:t.getDescription(),inputSchema:a,annotations:t.annotations},(async(i,r)=>{try{let r;if(a){const o=e.object(a).safeParse(i);if(!o.success)throw new Error(`Invalid arguments: ${o.error.message}`);r=await t.execute(o.data)}else r=await t.execute();return this.formatToolResult(r.content)}catch(e){return this.handleToolError(e,t.name)}}));this.dynamicToolManager.registerTool(t,i)}enableTool(e){return this.dynamicToolManager.enableTool(e)}disableTool(e){return this.dynamicToolManager.disableTool(e)}isToolEnabled(e){return this.dynamicToolManager.isToolEnabled(e)}getToolsStatus(){return this.dynamicToolManager.getToolsStatus()}getDynamicToolNames(){return this.dynamicToolManager.getDynamicToolNames()}getServer(){return this}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 i=t.getInputSchema();if(i){const r=e.object(i).safeParse(a);if(!r.success)throw new Error(`Invalid arguments: ${r.error.message}`);return(await t.execute(r.data)).content}return(await t.execute()).content}}createMcpToolHandler(t){return async(a,i)=>{try{const r=t.getInputSchema();if(r){const o=e.object(r).safeParse(a);if(!o.success)throw new Error(`Invalid arguments: ${o.error.message}`);const n=await t.execute(o.data,i);return this.formatToolResult(n.content)}{const e=await t.execute(void 0,i);return this.formatToolResult(e.content)}}catch(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}}}getSchemaForTool(t,i){const r=t.getInputSchema();if(r)return"json"===i?.schemaFormat?a(e.object(r)):r}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{ly as DynamicToolManager,cy as MondayAgentToolkit};
|
|
2495
2495
|
//# sourceMappingURL=index.js.map
|