@mondaydotcomorg/agent-toolkit 2.15.0 → 2.16.1
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 +29 -9
- package/dist/cjs/core/index.js.map +1 -1
- package/dist/cjs/mcp/index.js +33 -13
- package/dist/cjs/mcp/index.js.map +1 -1
- package/dist/cjs/openai/index.js +22 -2
- package/dist/cjs/openai/index.js.map +1 -1
- package/dist/esm/core/index.js +36 -16
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/mcp/index.js +36 -16
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/openai/index.js +28 -8
- package/dist/esm/openai/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/openai/index.js
CHANGED
|
@@ -1189,7 +1189,27 @@
|
|
|
1189
1189
|
id
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
|
-
`,OT={workspaceId:a.z.string().describe("The ID of the workspace where the folder will be created"),name:a.z.string().describe("The name of the folder to be created"),color:a.z.nativeEnum(Jb).optional().describe("The color of the folder"),fontWeight:a.z.nativeEnum(Xb).optional().describe("The font weight of the folder"),customIcon:a.z.nativeEnum(Qb).optional().describe("The custom icon of the folder"),parentFolderId:a.z.string().optional().describe("The ID of the parent folder")};a.z.enum(["enable","disable","status","list","detailed","reset"]).describe('Action to perform: "list" or "detailed" to discover available tools, "status" to check current states, "enable" to activate needed tools, "disable" to deactivate tools, "reset" to restore defaults'),a.z.string().optional().describe("Name of the tool to manage (required for enable/disable/status/reset)");const kT=[class extends eu{constructor(){super(...arguments),this.name="delete_item",this.type=y.WRITE,this.annotations=Zm({title:"Delete Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete an item"}getInputSchema(){return A_}async executeInternal(e){const a={id:e.itemId.toString()},t=await this.mondayApi.request(xw,a);return{content:`Item ${t.delete_item?.id} successfully deleted`}}},class extends eu{constructor(){super(...arguments),this.name="get_board_items_by_name",this.type=y.READ,this.annotations=Zm({title:"Get Board Items",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get items by board id and term"}getInputSchema(){return this.context?.boardId?L_:F_}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),term:e.term},t=await this.mondayApi.request(_w,a);return{content:`Items ${t.boards?.[0]?.items_page?.items?.map((e=>`name: ${e.name}, id: ${e.id}`)).join(", ")} successfully fetched`}}},class extends eu{constructor(){super(...arguments),this.name="create_item",this.type=y.WRITE,this.annotations=Zm({title:"Create Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new item in a monday.com board"}getInputSchema(){return this.context?.boardId?__:T_}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),itemName:e.name,groupId:e.groupId,columnValues:e.columnValues},t=await this.mondayApi.request(Tw,a);return{content:`Item ${t.create_item?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_update",this.type=y.WRITE,this.annotations=Zm({title:"Create Update",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new update in a monday.com board"}getInputSchema(){return N_}async executeInternal(e){const a={itemId:e.itemId.toString(),body:e.body},t=await this.mondayApi.request(Ew,a);return{content:`Update ${t.create_update?.id} successfully created on item ${e.itemId}`}}},class extends eu{constructor(){super(...arguments),this.name="get_board_schema",this.type=y.READ,this.annotations=Zm({title:"Get Board Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get board schema (columns and groups) by board id"}getInputSchema(){if(!this.context?.boardId)return j_}async executeInternal(e){const a=this.context?.boardId??e.boardId,t={boardId:a.toString()},i=await this.mondayApi.request(Nw,t);return{content:`The current schema of the board ${a} is: \n \n\nColumns:\n ${i.boards?.[0]?.columns?.map((e=>`Id - ${e?.id}\n Title - ${e?.title}\n Type - ${e?.type}`)).join("\n")}\n \n\nGroups:\n ${i.boards?.[0]?.groups?.map((e=>`Id - ${e?.id}\n Title - ${e?.title}`)).join("\n")}`}}},class extends eu{constructor(){super(...arguments),this.name="get_board_activity",this.type=y.READ,this.annotations=Zm({title:"Get Board Activity",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}),this.defaultLimit=1e3}getDescription(){return"Get board activity logs for a specified time range (defaults to last 30 days)"}getInputSchema(){return k_}async executeInternal(e){const a=new Date,t=new Date(a.getTime()-Xm.MONTH30Days),i=e?.fromDate||t.toISOString(),n=e?.toDate||a.toISOString(),o={boardId:e.boardId.toString(),fromDate:i,toDate:n,limit:this.defaultLimit,page:1},s=await this.mondayApi.request(O_,o),p=s.boards?.[0]?.activity_logs;if(!p||0===p.length)return{content:`No activity found for board ${e.boardId} in the specified time range (${i} to ${n}).`};const r=p.filter((e=>null!=e)).map((e=>`• ${e.created_at}: ${e.event} on ${e.entity} by user ${e.user_id}${e.data?` - Data: ${e.data}`:""}`)).join("\n");return{content:`Activity logs for board ${e.boardId} from ${i} to ${n} (${p.length} entries):\n\n${r}`}}},class extends eu{constructor(){super(...arguments),this.name="get_board_info",this.type=y.READ,this.annotations=Zm({title:"Get Board Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get comprehensive board information including metadata, structure, owners, and configuration"}getInputSchema(){return $_}async executeInternal(e){const a={boardId:e.boardId.toString()},t=await this.mondayApi.request(R_,a),i=t.boards?.[0];return i?{content:C_(i)}:{content:`Board with id ${e.boardId} not found or you don't have access to it.`}}},class extends eu{constructor(){super(...arguments),this.name="get_users_by_name",this.type=y.READ,this.annotations=Zm({title:"Get Users",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get users, can be filtered by name or partial name"}getInputSchema(){return q_}async executeInternal(e){const a={name:e.name},t=await this.mondayApi.request(Iw,a);return{content:`Relevant users:\n ${t.users?.map((e=>` id: ${e?.id}, name: ${e?.name}, title: ${e?.title}`)).join("\n")}`}}},class extends eu{constructor(){super(...arguments),this.name="list_users_and_teams",this.type=y.READ,this.annotations=Zm({title:"List Users and Teams",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'PRECISION-FIRST user and team retrieval tool. AI agents MUST prioritize specific queries over broad searches.\n\n MANDATORY BEST PRACTICES:\n 1. ALWAYS use specific IDs when available (userIds, teamIds) - highest precision and performance\n 2. ALWAYS use name search when you have user names but no IDs \n 3. ALWAYS use boolean getMe: true when requesting current user information\n 4. AVOID broad queries (no parameters) - use only as absolute last resort\n 5. COMBINE parameters strategically to minimize API calls\n\n REQUIRED PARAMETER PRIORITY (use in this order):\n 1. getMe: true (when requesting current user) - STANDALONE ONLY\n 2. name="exact_name" (when searching by name) - STANDALONE ONLY \n 3. userIds=["id1","id2"] (when you have specific user IDs)\n 4. teamIds=["id1","id2"] + teamsOnly: true (when you have specific team IDs)\n 5. No parameters (LAST RESORT - fetches up to 1000 users, avoid unless absolutely necessary)\n\n CRITICAL USAGE RULES:\n • getMe and name parameters CANNOT be combined with any other parameters\n • userIds + teamIds requires explicit includeTeams: true flag\n • teamsOnly: true prevents user data fetching (teams-only queries)\n • includeTeamMembers: true adds detailed member data to teams\n • includeTeams: true fetches both users and teams, do not use this to fetch a specific user\'s teams rather fetch that user by id and you will get their team memberships.\n\n OPTIMIZATION DIRECTIVES:\n • NEVER fetch all users when specific IDs are available\n • NEVER use broad queries for single user/team lookups \n • ALWAYS prefer name search over ID-less queries for individual users\n • SET includeTeamMembers: false for team lists, true only for member analysis \n • AVOID includeTeams: true unless you specifically need both users AND teams\n • AVOID broad queries for single user/team, if you have specific IDs, use them. For example getting a user\'s teams, use that user\'s ID and fetch their team using the includeTeams flag.\n\n RESPONSE CONTENT:\n • Users: id, name, email, title, permissions, contact details, team memberships\n • Teams: id, name, owners, members (when includeTeamMembers: true)\n • Current user: id, name, title, enabled, is_admin, is_guest (basic profile only)'}getInputSchema(){return dT}async executeInternal(e){const a=e.userIds&&e.userIds.length>0,t=e.teamIds&&e.teamIds.length>0,i=e.includeTeams||!1,n=e.teamsOnly||!1,o=e.includeTeamMembers||!1,s=!!e.name;if(e.getMe||!1){if(a||t||i||n||o||s)return{content:"PARAMETER_CONFLICT: getMe is STANDALONE only. Remove all other parameters when using getMe: true for current user lookup."};const e=await this.mondayApi.request(nT);if(!e.me)return{content:"AUTHENTICATION_ERROR: Current user fetch failed. Verify API token and user permissions."};const p={users:[e.me]};return{content:oT(p)}}if(s){if(a||t||i||n||o)return{content:"PARAMETER_CONFLICT: name is STANDALONE only. Remove userIds, teamIds, includeTeams, teamsOnly, and includeTeamMembers when using name search."};const s={name:e.name},p=await this.mondayApi.request(iT,s);if(!p.users||0===p.users.length)return{content:`NAME_SEARCH_EMPTY: No users found matching "${e.name}". Try broader search terms or verify user exists in account.`};const r=p.users.filter((e=>null!==e)).map((e=>`• **${e.name}** (ID: ${e.id})${e.title?` - ${e.title}`:""}`)).join("\n");return{content:`Found ${p.users.length} user(s) matching "${e.name}":\n\n${r}`}}if(n&&i)return{content:"PARAMETER_CONFLICT: Cannot use teamsOnly: true with includeTeams: true. Use teamsOnly for teams-only queries or includeTeams for combined data."};if(a&&e.userIds&&e.userIds.length>sT)return{content:`LIMIT_EXCEEDED: userIds array too large (${e.userIds.length}/500). Split into batches of max 500 IDs and make multiple calls.`};if(t&&e.teamIds&&e.teamIds.length>pT)return{content:`LIMIT_EXCEEDED: teamIds array too large (${e.teamIds.length}/500). Split into batches of max 500 IDs and make multiple calls.`};let p;if(n||!a&&t&&!i)if(o){const a={teamIds:e.teamIds};p=await this.mondayApi.request(tT,a)}else{const a={teamIds:e.teamIds};p=await this.mondayApi.request(aT,a)}else if(i){const a={userIds:e.userIds,teamIds:e.teamIds,limit:rT};p=await this.mondayApi.request(eT,a)}else if(a){const a={userIds:e.userIds,limit:rT};p=await this.mondayApi.request(X_,a)}else{const e={userIds:void 0,limit:rT};p=await this.mondayApi.request(Z_,e)}return{content:oT(p)}}},class extends eu{constructor(){super(...arguments),this.name="change_item_column_values",this.type=y.WRITE,this.annotations=Zm({title:"Change Item Column Values",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Change the column values of an item in a monday.com board"}getInputSchema(){return this.context?.boardId?Hw:Ww}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),itemId:e.itemId.toString(),columnValues:e.columnValues},t=await this.mondayApi.request(Sw,a);return{content:`Item ${t.change_multiple_column_values?.id} successfully updated with the new column values`}}},class extends eu{constructor(){super(...arguments),this.name="move_item_to_group",this.type=y.WRITE,this.annotations=Zm({title:"Move Item to Group",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Move an item to a group in a monday.com board"}getInputSchema(){return lT}async executeInternal(e){const a={itemId:e.itemId.toString(),groupId:e.groupId},t=await this.mondayApi.request(Aw,a);return{content:`Item ${t.move_item_to_group?.id} successfully moved to group ${e.groupId}`}}},class extends eu{constructor(){super(...arguments),this.name="create_board",this.type=y.WRITE,this.annotations=Zm({title:"Create Board",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com board"}getInputSchema(){return Kw}async executeInternal(e){const a={boardName:e.boardName,boardKind:e.boardKind,boardDescription:e.boardDescription,workspaceId:e.workspaceId},t=await this.mondayApi.request(Dw,a);return{content:`Board ${t.create_board?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_form",this.type=y.WRITE,this.annotations=Zm({title:"Create Form",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com form. This will create a new form as well as a new board for which the form’s responses will be stored. The returned board_id is the ID of the board that was created while the returned formToken can be used for all future queries and mutations to continue editing the form."}getInputSchema(){return Nx}async executeInternal(e){const a={destination_workspace_id:e.destination_workspace_id,destination_folder_id:e.destination_folder_id,destination_folder_name:e.destination_folder_name,board_kind:e.board_kind,destination_name:e.destination_name,board_owner_ids:e.board_owner_ids,board_owner_team_ids:e.board_owner_team_ids,board_subscriber_ids:e.board_subscriber_ids,board_subscriber_teams_ids:e.board_subscriber_teams_ids},t=await this.mondayApi.request(ix,a);return{content:`Form created successfully. Board ID: ${t.create_form?.boardId}, Token: ${t.create_form?.token}`}}},class extends eu{constructor(){super(...arguments),this.name="update_form",this.type=y.WRITE,this.annotations=Zm({title:"Update Form",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}),this.helpers=new f_(this.mondayApi),this.actionHandlers=new Map([[Gx.setFormPassword,this.helpers.setFormPassword.bind(this.helpers)],[Gx.shortenFormUrl,this.helpers.shortenFormUrl.bind(this.helpers)],[Gx.deactivate,this.helpers.deactivateForm.bind(this.helpers)],[Gx.activate,this.helpers.activateForm.bind(this.helpers)],[Gx.createTag,this.helpers.createTag.bind(this.helpers)],[Gx.deleteTag,this.helpers.deleteTag.bind(this.helpers)],[Gx.updateTag,this.helpers.updateTag.bind(this.helpers)],[Gx.updateAppearance,this.helpers.updateAppearance.bind(this.helpers)],[Gx.updateAccessibility,this.helpers.updateAccessibility.bind(this.helpers)],[Gx.updateFeatures,this.helpers.updateFeatures.bind(this.helpers)],[Gx.updateQuestionOrder,this.helpers.updateQuestionOrder.bind(this.helpers)],[Gx.updateFormHeader,this.helpers.updateFormHeader.bind(this.helpers)]])}getDescription(){return'Update a monday.com form. Handles the following form update actions that can only be done one at a time using the correct "action" input: \n - update form\'s feature settings with the action "updateFeatures",\n - update form\'s appearance settings with the action "updateAppearance",\n - update form\'s accessibility settings with the action "updateAccessibility",\n - update form\'s title with the action "updateFormHeader",\n - update form\'s description with the action "updateFormHeader",\n - update form\'s question order with the action "updateQuestionOrder",\n - create a new form tag with the action "createTag",\n - delete a form tag with the action "deleteTag",\n - update a form tag with the action "updateTag",\n - set or update the form\'s password with the action "setFormPassword"\n - shorten form\'s url with the action "shortenFormUrl"\n - deactivate form with the action "deactivateForm"\n - reactivate form with the action "activateForm"'}getInputSchema(){return u_}async executeInternal(e){const a=this.actionHandlers.get(e.action);return a?await a(e):{content:"Received an invalid action for the update form tool."}}},class extends eu{constructor(){super(...arguments),this.name="get_form",this.type=y.READ,this.annotations=Zm({title:"Get Form",readOnlyHint:!0,destructiveHint:!1})}getDescription(){return"Get a monday.com form by its form token. Form tokens can be extracted from the form’s url. Given a form url, such as https://forms.monday.com/forms/abc123def456ghi789?r=use1, the token is the alphanumeric string that appears right after /forms/ and before the ?. In the example, the token is abc123def456ghi789."}getInputSchema(){return h_}async executeInternal(e){const a={formToken:e.formToken},t=await this.mondayApi.request(nx,a);return t.form?{content:`The form with the token ${e.formToken} is: ${JSON.stringify(t.form,null,2)}`}:{content:`Form with token ${e.formToken} not found or you don't have access to it.`}}},class extends eu{constructor(){super(...arguments),this.name="form_questions_editor",this.type=y.WRITE,this.annotations=Zm({title:"Form Questions Editor",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}),this.helpers=new zx(this.mondayApi),this.actionHandlers=new Map([[Bx.Delete,this.helpers.deleteQuestion.bind(this.helpers)],[Bx.Update,this.helpers.updateQuestion.bind(this.helpers)],[Bx.Create,this.helpers.createQuestion.bind(this.helpers)]])}getDescription(){return"Create, update, or delete a question in a monday.com form"}getInputSchema(){return qx}async executeInternal(e){const a=this.actionHandlers.get(e.action);return a?await a(e):{content:`Unknown action: ${e.action}`}}},class extends eu{constructor(){super(...arguments),this.name="create_column",this.type=y.WRITE,this.annotations=Zm({title:"Create Column",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new column in a monday.com board"}getInputSchema(){return this.context?.boardId?v_:b_}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),columnType:e.columnType,columnTitle:e.columnTitle,columnDescription:e.columnDescription,columnSettings:"string"==typeof e.columnSettings?JSON.parse(e.columnSettings):e.columnSettings},t=await this.mondayApi.request(Ow,a);return{content:`Column ${t.create_column?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_group",this.type=y.WRITE,this.annotations=Zm({title:"Create Group",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new group in a monday.com board. Groups are sections that organize related items. Use when users want to add structure, categorize items, or create workflow phases. Groups can be positioned relative to existing groups and assigned predefined colors. Items will always be created in the top group and so the top group should be the most relevant one for new item creation"}getInputSchema(){return x_}async executeInternal(e){const a={boardId:e.boardId,groupName:e.groupName,groupColor:e.groupColor,relativeTo:e.relativeTo,positionRelativeMethod:e.positionRelativeMethod},t=await this.mondayApi.request(y_,a);return{content:`Group "${t.create_group?.title}" (ID: ${t.create_group?.id}) successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="delete_column",this.type=y.WRITE,this.annotations=Zm({title:"Delete Column",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete a column from a monday.com board"}getInputSchema(){return this.context?.boardId?I_:S_}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),columnId:e.columnId},t=await this.mondayApi.request(kw,a);return{content:`Column ${t.delete_column?.id} successfully deleted`}}},Gw,class extends eu{constructor(){super(...arguments),this.name="get_graphql_schema",this.type=y.ALL_API,this.annotations=Zm({title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch the monday.com GraphQL schema structure including query and mutation definitions. This tool returns available query fields, mutation fields, and a list of GraphQL types in the schema. You can filter results by operation type (read/write) to focus on either queries or mutations."}getInputSchema(){return U_}async executeInternal(e){try{const a=await this.mondayApi.request(Rw),t=e?.operationType,i=a.queryType?.fields?.map((e=>`- ${e.name}${e.description?`: ${e.description}`:""}`)).join("\n")||"No query fields found",n=a.mutationType?.fields?.map((e=>`- ${e.name}${e.description?`: ${e.description}`:""}`)).join("\n")||"No mutation fields found",o=a.__schema,s=o?.types?.filter((e=>e.name&&!e.name.startsWith("__"))).map((e=>`- ${e.name} (${e.kind||"unknown"})`)).join("\n")||"No types found";let p="## GraphQL Schema\n";return t&&"read"!==t||(p+=`- Query Type: ${a.__schema?.queryType?.name}\n\n`,p+=`## Query Fields\n${i}\n\n`),t&&"write"!==t||(p+=`- Mutation Type: ${a.__schema?.mutationType?.name}\n\n`,p+=`## Mutation Fields\n${n}\n\n`),p+=`## Available Types\n${s}\n\n`,p+='To get detailed information about a specific type, use the get_type_details tool with the type name.\nFor example: get_type_details(typeName: "Board") to see Board type details.',{content:p}}catch(e){return{content:`Error fetching GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends eu{constructor(){super(...arguments),this.name="get_column_type_info",this.type=y.READ,this.annotations=Zm({title:"Get Column Type Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Retrieves comprehensive information about a specific column type, including JSON schema definition and other metadata. Use this before creating columns with the create_column tool to understand the structure, validation rules, and available properties for column settings."}getInputSchema(){return P_}async executeInternal(e){const a={type:e.columnType},t=await this.mondayApi.request(V_,a);if(!t?.get_column_type_schema)return{content:`Information for column type "${e.columnType}" not found or not available.`};const i={schema:t.get_column_type_schema};return{content:`Column Type Information for "${e.columnType}":\n\n${JSON.stringify(i,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="get_type_details",this.type=y.ALL_API,this.annotations=Zm({title:"Get Type Details",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get detailed information about a specific GraphQL type from the monday.com API schema"}getInputSchema(){return B_}async executeInternal(e){try{if(!e.typeName)return{content:"Error: typeName is required. Please provide a valid GraphQL type name."};const t=(a=e.typeName,ww`
|
|
1192
|
+
`,OT={workspaceId:a.z.string().describe("The ID of the workspace where the folder will be created"),name:a.z.string().describe("The name of the folder to be created"),color:a.z.nativeEnum(Jb).optional().describe("The color of the folder"),fontWeight:a.z.nativeEnum(Xb).optional().describe("The font weight of the folder"),customIcon:a.z.nativeEnum(Qb).optional().describe("The custom icon of the folder"),parentFolderId:a.z.string().optional().describe("The ID of the parent folder")};const kT=ww`
|
|
1193
|
+
mutation updateBoardHierarchy($boardId: ID!, $attributes: UpdateBoardHierarchyAttributesInput!) {
|
|
1194
|
+
update_board_hierarchy(board_id: $boardId, attributes: $attributes) {
|
|
1195
|
+
success
|
|
1196
|
+
message
|
|
1197
|
+
board {
|
|
1198
|
+
id
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
`,RT=ww`
|
|
1203
|
+
mutation updateOverviewHierarchy($overviewId: ID!, $attributes: UpdateOverviewHierarchyAttributesInput!) {
|
|
1204
|
+
update_overview_hierarchy(overview_id: $overviewId, attributes: $attributes) {
|
|
1205
|
+
success
|
|
1206
|
+
message
|
|
1207
|
+
overview {
|
|
1208
|
+
id
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
`,CT={objectType:a.z.nativeEnum(Ng).describe("The type of object to move"),id:a.z.string().describe("The ID of the object to move"),position:a.z.object({object_id:a.z.string().describe("The ID of the object to position the object relative to"),object_type:a.z.nativeEnum(Ng).describe("The type of object to position the object relative to"),is_after:a.z.boolean().optional().describe("Whether to position the object after the object")}).optional().describe("The new position of the object. Required if changing the position based on another object."),parentFolderId:a.z.string().optional().describe("The ID of the new parent folder. Required if moving to a different folder."),workspaceId:a.z.string().optional().describe("The ID of the workspace containing the object. Required if moving to a different workspace."),accountProductId:a.z.string().optional().describe("The ID of the account product containing the object. Required if moving to a different account product.")};a.z.enum(["enable","disable","status","list","detailed","reset"]).describe('Action to perform: "list" or "detailed" to discover available tools, "status" to check current states, "enable" to activate needed tools, "disable" to deactivate tools, "reset" to restore defaults'),a.z.string().optional().describe("Name of the tool to manage (required for enable/disable/status/reset)");const $T=[class extends eu{constructor(){super(...arguments),this.name="delete_item",this.type=y.WRITE,this.annotations=Zm({title:"Delete Item",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete an item"}getInputSchema(){return A_}async executeInternal(e){const a={id:e.itemId.toString()},t=await this.mondayApi.request(xw,a);return{content:`Item ${t.delete_item?.id} successfully deleted`}}},class extends eu{constructor(){super(...arguments),this.name="get_board_items_by_name",this.type=y.READ,this.annotations=Zm({title:"Get Board Items",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get items by board id and term"}getInputSchema(){return this.context?.boardId?L_:F_}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),term:e.term},t=await this.mondayApi.request(_w,a);return{content:`Items ${t.boards?.[0]?.items_page?.items?.map((e=>`name: ${e.name}, id: ${e.id}`)).join(", ")} successfully fetched`}}},class extends eu{constructor(){super(...arguments),this.name="create_item",this.type=y.WRITE,this.annotations=Zm({title:"Create Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new item in a monday.com board"}getInputSchema(){return this.context?.boardId?__:T_}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),itemName:e.name,groupId:e.groupId,columnValues:e.columnValues},t=await this.mondayApi.request(Tw,a);return{content:`Item ${t.create_item?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_update",this.type=y.WRITE,this.annotations=Zm({title:"Create Update",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new update in a monday.com board"}getInputSchema(){return N_}async executeInternal(e){const a={itemId:e.itemId.toString(),body:e.body},t=await this.mondayApi.request(Ew,a);return{content:`Update ${t.create_update?.id} successfully created on item ${e.itemId}`}}},class extends eu{constructor(){super(...arguments),this.name="get_board_schema",this.type=y.READ,this.annotations=Zm({title:"Get Board Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get board schema (columns and groups) by board id"}getInputSchema(){if(!this.context?.boardId)return j_}async executeInternal(e){const a=this.context?.boardId??e.boardId,t={boardId:a.toString()},i=await this.mondayApi.request(Nw,t);return{content:`The current schema of the board ${a} is: \n \n\nColumns:\n ${i.boards?.[0]?.columns?.map((e=>`Id - ${e?.id}\n Title - ${e?.title}\n Type - ${e?.type}`)).join("\n")}\n \n\nGroups:\n ${i.boards?.[0]?.groups?.map((e=>`Id - ${e?.id}\n Title - ${e?.title}`)).join("\n")}`}}},class extends eu{constructor(){super(...arguments),this.name="get_board_activity",this.type=y.READ,this.annotations=Zm({title:"Get Board Activity",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0}),this.defaultLimit=1e3}getDescription(){return"Get board activity logs for a specified time range (defaults to last 30 days)"}getInputSchema(){return k_}async executeInternal(e){const a=new Date,t=new Date(a.getTime()-Xm.MONTH30Days),i=e?.fromDate||t.toISOString(),n=e?.toDate||a.toISOString(),o={boardId:e.boardId.toString(),fromDate:i,toDate:n,limit:this.defaultLimit,page:1},s=await this.mondayApi.request(O_,o),p=s.boards?.[0]?.activity_logs;if(!p||0===p.length)return{content:`No activity found for board ${e.boardId} in the specified time range (${i} to ${n}).`};const r=p.filter((e=>null!=e)).map((e=>`• ${e.created_at}: ${e.event} on ${e.entity} by user ${e.user_id}${e.data?` - Data: ${e.data}`:""}`)).join("\n");return{content:`Activity logs for board ${e.boardId} from ${i} to ${n} (${p.length} entries):\n\n${r}`}}},class extends eu{constructor(){super(...arguments),this.name="get_board_info",this.type=y.READ,this.annotations=Zm({title:"Get Board Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get comprehensive board information including metadata, structure, owners, and configuration"}getInputSchema(){return $_}async executeInternal(e){const a={boardId:e.boardId.toString()},t=await this.mondayApi.request(R_,a),i=t.boards?.[0];return i?{content:C_(i)}:{content:`Board with id ${e.boardId} not found or you don't have access to it.`}}},class extends eu{constructor(){super(...arguments),this.name="get_users_by_name",this.type=y.READ,this.annotations=Zm({title:"Get Users",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get users, can be filtered by name or partial name"}getInputSchema(){return q_}async executeInternal(e){const a={name:e.name},t=await this.mondayApi.request(Iw,a);return{content:`Relevant users:\n ${t.users?.map((e=>` id: ${e?.id}, name: ${e?.name}, title: ${e?.title}`)).join("\n")}`}}},class extends eu{constructor(){super(...arguments),this.name="list_users_and_teams",this.type=y.READ,this.annotations=Zm({title:"List Users and Teams",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return'PRECISION-FIRST user and team retrieval tool. AI agents MUST prioritize specific queries over broad searches.\n\n MANDATORY BEST PRACTICES:\n 1. ALWAYS use specific IDs when available (userIds, teamIds) - highest precision and performance\n 2. ALWAYS use name search when you have user names but no IDs \n 3. ALWAYS use boolean getMe: true when requesting current user information\n 4. AVOID broad queries (no parameters) - use only as absolute last resort\n 5. COMBINE parameters strategically to minimize API calls\n\n REQUIRED PARAMETER PRIORITY (use in this order):\n 1. getMe: true (when requesting current user) - STANDALONE ONLY\n 2. name="exact_name" (when searching by name) - STANDALONE ONLY \n 3. userIds=["id1","id2"] (when you have specific user IDs)\n 4. teamIds=["id1","id2"] + teamsOnly: true (when you have specific team IDs)\n 5. No parameters (LAST RESORT - fetches up to 1000 users, avoid unless absolutely necessary)\n\n CRITICAL USAGE RULES:\n • getMe and name parameters CANNOT be combined with any other parameters\n • userIds + teamIds requires explicit includeTeams: true flag\n • teamsOnly: true prevents user data fetching (teams-only queries)\n • includeTeamMembers: true adds detailed member data to teams\n • includeTeams: true fetches both users and teams, do not use this to fetch a specific user\'s teams rather fetch that user by id and you will get their team memberships.\n\n OPTIMIZATION DIRECTIVES:\n • NEVER fetch all users when specific IDs are available\n • NEVER use broad queries for single user/team lookups \n • ALWAYS prefer name search over ID-less queries for individual users\n • SET includeTeamMembers: false for team lists, true only for member analysis \n • AVOID includeTeams: true unless you specifically need both users AND teams\n • AVOID broad queries for single user/team, if you have specific IDs, use them. For example getting a user\'s teams, use that user\'s ID and fetch their team using the includeTeams flag.\n\n RESPONSE CONTENT:\n • Users: id, name, email, title, permissions, contact details, team memberships\n • Teams: id, name, owners, members (when includeTeamMembers: true)\n • Current user: id, name, title, enabled, is_admin, is_guest (basic profile only)'}getInputSchema(){return dT}async executeInternal(e){const a=e.userIds&&e.userIds.length>0,t=e.teamIds&&e.teamIds.length>0,i=e.includeTeams||!1,n=e.teamsOnly||!1,o=e.includeTeamMembers||!1,s=!!e.name;if(e.getMe||!1){if(a||t||i||n||o||s)return{content:"PARAMETER_CONFLICT: getMe is STANDALONE only. Remove all other parameters when using getMe: true for current user lookup."};const e=await this.mondayApi.request(nT);if(!e.me)return{content:"AUTHENTICATION_ERROR: Current user fetch failed. Verify API token and user permissions."};const p={users:[e.me]};return{content:oT(p)}}if(s){if(a||t||i||n||o)return{content:"PARAMETER_CONFLICT: name is STANDALONE only. Remove userIds, teamIds, includeTeams, teamsOnly, and includeTeamMembers when using name search."};const s={name:e.name},p=await this.mondayApi.request(iT,s);if(!p.users||0===p.users.length)return{content:`NAME_SEARCH_EMPTY: No users found matching "${e.name}". Try broader search terms or verify user exists in account.`};const r=p.users.filter((e=>null!==e)).map((e=>`• **${e.name}** (ID: ${e.id})${e.title?` - ${e.title}`:""}`)).join("\n");return{content:`Found ${p.users.length} user(s) matching "${e.name}":\n\n${r}`}}if(n&&i)return{content:"PARAMETER_CONFLICT: Cannot use teamsOnly: true with includeTeams: true. Use teamsOnly for teams-only queries or includeTeams for combined data."};if(a&&e.userIds&&e.userIds.length>sT)return{content:`LIMIT_EXCEEDED: userIds array too large (${e.userIds.length}/500). Split into batches of max 500 IDs and make multiple calls.`};if(t&&e.teamIds&&e.teamIds.length>pT)return{content:`LIMIT_EXCEEDED: teamIds array too large (${e.teamIds.length}/500). Split into batches of max 500 IDs and make multiple calls.`};let p;if(n||!a&&t&&!i)if(o){const a={teamIds:e.teamIds};p=await this.mondayApi.request(tT,a)}else{const a={teamIds:e.teamIds};p=await this.mondayApi.request(aT,a)}else if(i){const a={userIds:e.userIds,teamIds:e.teamIds,limit:rT};p=await this.mondayApi.request(eT,a)}else if(a){const a={userIds:e.userIds,limit:rT};p=await this.mondayApi.request(X_,a)}else{const e={userIds:void 0,limit:rT};p=await this.mondayApi.request(Z_,e)}return{content:oT(p)}}},class extends eu{constructor(){super(...arguments),this.name="change_item_column_values",this.type=y.WRITE,this.annotations=Zm({title:"Change Item Column Values",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Change the column values of an item in a monday.com board"}getInputSchema(){return this.context?.boardId?Hw:Ww}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),itemId:e.itemId.toString(),columnValues:e.columnValues},t=await this.mondayApi.request(Sw,a);return{content:`Item ${t.change_multiple_column_values?.id} successfully updated with the new column values`}}},class extends eu{constructor(){super(...arguments),this.name="move_item_to_group",this.type=y.WRITE,this.annotations=Zm({title:"Move Item to Group",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Move an item to a group in a monday.com board"}getInputSchema(){return lT}async executeInternal(e){const a={itemId:e.itemId.toString(),groupId:e.groupId},t=await this.mondayApi.request(Aw,a);return{content:`Item ${t.move_item_to_group?.id} successfully moved to group ${e.groupId}`}}},class extends eu{constructor(){super(...arguments),this.name="create_board",this.type=y.WRITE,this.annotations=Zm({title:"Create Board",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com board"}getInputSchema(){return Kw}async executeInternal(e){const a={boardName:e.boardName,boardKind:e.boardKind,boardDescription:e.boardDescription,workspaceId:e.workspaceId},t=await this.mondayApi.request(Dw,a);return{content:`Board ${t.create_board?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_form",this.type=y.WRITE,this.annotations=Zm({title:"Create Form",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a monday.com form. This will create a new form as well as a new board for which the form’s responses will be stored. The returned board_id is the ID of the board that was created while the returned formToken can be used for all future queries and mutations to continue editing the form."}getInputSchema(){return Nx}async executeInternal(e){const a={destination_workspace_id:e.destination_workspace_id,destination_folder_id:e.destination_folder_id,destination_folder_name:e.destination_folder_name,board_kind:e.board_kind,destination_name:e.destination_name,board_owner_ids:e.board_owner_ids,board_owner_team_ids:e.board_owner_team_ids,board_subscriber_ids:e.board_subscriber_ids,board_subscriber_teams_ids:e.board_subscriber_teams_ids},t=await this.mondayApi.request(ix,a);return{content:`Form created successfully. Board ID: ${t.create_form?.boardId}, Token: ${t.create_form?.token}`}}},class extends eu{constructor(){super(...arguments),this.name="update_form",this.type=y.WRITE,this.annotations=Zm({title:"Update Form",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0}),this.helpers=new f_(this.mondayApi),this.actionHandlers=new Map([[Gx.setFormPassword,this.helpers.setFormPassword.bind(this.helpers)],[Gx.shortenFormUrl,this.helpers.shortenFormUrl.bind(this.helpers)],[Gx.deactivate,this.helpers.deactivateForm.bind(this.helpers)],[Gx.activate,this.helpers.activateForm.bind(this.helpers)],[Gx.createTag,this.helpers.createTag.bind(this.helpers)],[Gx.deleteTag,this.helpers.deleteTag.bind(this.helpers)],[Gx.updateTag,this.helpers.updateTag.bind(this.helpers)],[Gx.updateAppearance,this.helpers.updateAppearance.bind(this.helpers)],[Gx.updateAccessibility,this.helpers.updateAccessibility.bind(this.helpers)],[Gx.updateFeatures,this.helpers.updateFeatures.bind(this.helpers)],[Gx.updateQuestionOrder,this.helpers.updateQuestionOrder.bind(this.helpers)],[Gx.updateFormHeader,this.helpers.updateFormHeader.bind(this.helpers)]])}getDescription(){return'Update a monday.com form. Handles the following form update actions that can only be done one at a time using the correct "action" input: \n - update form\'s feature settings with the action "updateFeatures",\n - update form\'s appearance settings with the action "updateAppearance",\n - update form\'s accessibility settings with the action "updateAccessibility",\n - update form\'s title with the action "updateFormHeader",\n - update form\'s description with the action "updateFormHeader",\n - update form\'s question order with the action "updateQuestionOrder",\n - create a new form tag with the action "createTag",\n - delete a form tag with the action "deleteTag",\n - update a form tag with the action "updateTag",\n - set or update the form\'s password with the action "setFormPassword"\n - shorten form\'s url with the action "shortenFormUrl"\n - deactivate form with the action "deactivateForm"\n - reactivate form with the action "activateForm"'}getInputSchema(){return u_}async executeInternal(e){const a=this.actionHandlers.get(e.action);return a?await a(e):{content:"Received an invalid action for the update form tool."}}},class extends eu{constructor(){super(...arguments),this.name="get_form",this.type=y.READ,this.annotations=Zm({title:"Get Form",readOnlyHint:!0,destructiveHint:!1})}getDescription(){return"Get a monday.com form by its form token. Form tokens can be extracted from the form’s url. Given a form url, such as https://forms.monday.com/forms/abc123def456ghi789?r=use1, the token is the alphanumeric string that appears right after /forms/ and before the ?. In the example, the token is abc123def456ghi789."}getInputSchema(){return h_}async executeInternal(e){const a={formToken:e.formToken},t=await this.mondayApi.request(nx,a);return t.form?{content:`The form with the token ${e.formToken} is: ${JSON.stringify(t.form,null,2)}`}:{content:`Form with token ${e.formToken} not found or you don't have access to it.`}}},class extends eu{constructor(){super(...arguments),this.name="form_questions_editor",this.type=y.WRITE,this.annotations=Zm({title:"Form Questions Editor",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1}),this.helpers=new zx(this.mondayApi),this.actionHandlers=new Map([[Bx.Delete,this.helpers.deleteQuestion.bind(this.helpers)],[Bx.Update,this.helpers.updateQuestion.bind(this.helpers)],[Bx.Create,this.helpers.createQuestion.bind(this.helpers)]])}getDescription(){return"Create, update, or delete a question in a monday.com form"}getInputSchema(){return qx}async executeInternal(e){const a=this.actionHandlers.get(e.action);return a?await a(e):{content:`Unknown action: ${e.action}`}}},class extends eu{constructor(){super(...arguments),this.name="create_column",this.type=y.WRITE,this.annotations=Zm({title:"Create Column",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new column in a monday.com board"}getInputSchema(){return this.context?.boardId?v_:b_}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),columnType:e.columnType,columnTitle:e.columnTitle,columnDescription:e.columnDescription,columnSettings:"string"==typeof e.columnSettings?JSON.parse(e.columnSettings):e.columnSettings},t=await this.mondayApi.request(Ow,a);return{content:`Column ${t.create_column?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_group",this.type=y.WRITE,this.annotations=Zm({title:"Create Group",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new group in a monday.com board. Groups are sections that organize related items. Use when users want to add structure, categorize items, or create workflow phases. Groups can be positioned relative to existing groups and assigned predefined colors. Items will always be created in the top group and so the top group should be the most relevant one for new item creation"}getInputSchema(){return x_}async executeInternal(e){const a={boardId:e.boardId,groupName:e.groupName,groupColor:e.groupColor,relativeTo:e.relativeTo,positionRelativeMethod:e.positionRelativeMethod},t=await this.mondayApi.request(y_,a);return{content:`Group "${t.create_group?.title}" (ID: ${t.create_group?.id}) successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="delete_column",this.type=y.WRITE,this.annotations=Zm({title:"Delete Column",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Delete a column from a monday.com board"}getInputSchema(){return this.context?.boardId?I_:S_}async executeInternal(e){const a={boardId:(this.context?.boardId??e.boardId).toString(),columnId:e.columnId},t=await this.mondayApi.request(kw,a);return{content:`Column ${t.delete_column?.id} successfully deleted`}}},Gw,class extends eu{constructor(){super(...arguments),this.name="get_graphql_schema",this.type=y.ALL_API,this.annotations=Zm({title:"Get GraphQL Schema",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Fetch the monday.com GraphQL schema structure including query and mutation definitions. This tool returns available query fields, mutation fields, and a list of GraphQL types in the schema. You can filter results by operation type (read/write) to focus on either queries or mutations."}getInputSchema(){return U_}async executeInternal(e){try{const a=await this.mondayApi.request(Rw),t=e?.operationType,i=a.queryType?.fields?.map((e=>`- ${e.name}${e.description?`: ${e.description}`:""}`)).join("\n")||"No query fields found",n=a.mutationType?.fields?.map((e=>`- ${e.name}${e.description?`: ${e.description}`:""}`)).join("\n")||"No mutation fields found",o=a.__schema,s=o?.types?.filter((e=>e.name&&!e.name.startsWith("__"))).map((e=>`- ${e.name} (${e.kind||"unknown"})`)).join("\n")||"No types found";let p="## GraphQL Schema\n";return t&&"read"!==t||(p+=`- Query Type: ${a.__schema?.queryType?.name}\n\n`,p+=`## Query Fields\n${i}\n\n`),t&&"write"!==t||(p+=`- Mutation Type: ${a.__schema?.mutationType?.name}\n\n`,p+=`## Mutation Fields\n${n}\n\n`),p+=`## Available Types\n${s}\n\n`,p+='To get detailed information about a specific type, use the get_type_details tool with the type name.\nFor example: get_type_details(typeName: "Board") to see Board type details.',{content:p}}catch(e){return{content:`Error fetching GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends eu{constructor(){super(...arguments),this.name="get_column_type_info",this.type=y.READ,this.annotations=Zm({title:"Get Column Type Info",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Retrieves comprehensive information about a specific column type, including JSON schema definition and other metadata. Use this before creating columns with the create_column tool to understand the structure, validation rules, and available properties for column settings."}getInputSchema(){return P_}async executeInternal(e){const a={type:e.columnType},t=await this.mondayApi.request(V_,a);if(!t?.get_column_type_schema)return{content:`Information for column type "${e.columnType}" not found or not available.`};const i={schema:t.get_column_type_schema};return{content:`Column Type Information for "${e.columnType}":\n\n${JSON.stringify(i,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="get_type_details",this.type=y.ALL_API,this.annotations=Zm({title:"Get Type Details",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get detailed information about a specific GraphQL type from the monday.com API schema"}getInputSchema(){return B_}async executeInternal(e){try{if(!e.typeName)return{content:"Error: typeName is required. Please provide a valid GraphQL type name."};const t=(a=e.typeName,ww`
|
|
1193
1213
|
query getTypeDetails {
|
|
1194
1214
|
__type(name: "${a}") {
|
|
1195
1215
|
name
|
|
@@ -1277,5 +1297,5 @@
|
|
|
1277
1297
|
}
|
|
1278
1298
|
}
|
|
1279
1299
|
}
|
|
1280
|
-
`),i=await this.mondayApi.request(t);if(!i.__type)return{content:`Type '${e.typeName}' not found in the GraphQL schema. Please check the type name and try again.`};let n=`## Type: ${i.__type.name||"Unnamed"} ${e.typeName===i.__type.name?"":`(queried: ${e.typeName})`}\nKind: ${i.__type.kind}\n${i.__type.description?`Description: ${i.__type.description}`:""}\n\n`;return i.__type.fields&&i.__type.fields.length>0&&(n+="## Fields\n",i.__type.fields.forEach((e=>{const a=M_(e.type);n+=`- ${e.name}: ${a}${e.description?` - ${e.description}`:""}\n`,e.args&&e.args.length>0&&(n+=" Arguments:\n",e.args.forEach((e=>{const a=M_(e.type);n+=` - ${e.name}: ${a}${e.description?` - ${e.description}`:""}${e.defaultValue?` (default: ${e.defaultValue})`:""}\n`})))})),n+="\n"),i.__type.inputFields&&i.__type.inputFields.length>0&&(n+="## Input Fields\n",i.__type.inputFields.forEach((e=>{const a=M_(e.type);n+=`- ${e.name}: ${a}${e.description?` - ${e.description}`:""}${e.defaultValue?` (default: ${e.defaultValue})`:""}\n`})),n+="\n"),i.__type.interfaces&&i.__type.interfaces.length>0&&(n+="## Implements\n",i.__type.interfaces.forEach((e=>{n+=`- ${e.name}\n`})),n+="\n"),i.__type.enumValues&&i.__type.enumValues.length>0&&(n+="## Enum Values\n",i.__type.enumValues.forEach((e=>{n+=`- ${e.name}${e.description?` - ${e.description}`:""}\n`})),n+="\n"),i.__type.possibleTypes&&i.__type.possibleTypes.length>0&&(n+="## Possible Types\n",i.__type.possibleTypes.forEach((e=>{n+=`- ${e.name}\n`}))),n+=`\n## Usage Examples\nIf this is a Query or Mutation field, you can use it in the all_monday_api tool.\n\nExample for query:\nall_monday_api(operation: "query", name: "getTypeData", variables: "{\\"typeName\\": \\"${i.__type.name}\\"}")\n\nExample for object field access:\nWhen querying objects that have this type, include these fields in your query.\n`,{content:n}}catch(e){const a=e instanceof Error?e.message:"Unknown error",t=a.includes("JSON");return{content:`Error fetching type details: ${a}${t?"\n\nThis could be because the type name is incorrect or the GraphQL query format is invalid. Please check the type name and try again.":""}`}}var a}},class extends eu{constructor(){super(...arguments),this.name="create_custom_activity",this.type=y.WRITE,this.annotations=Zm({title:"Create Custom Activity",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new custom activity in the E&A app"}getInputSchema(){return g_}async executeInternal(e){const a={color:e.color,icon_id:e.icon_id,name:e.name};return await this.mondayApi.request($w,a),{content:`Custom activity '${e.name}' with color ${e.color} and icon ${e.icon_id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_timeline_item",this.type=y.WRITE,this.annotations=Zm({title:"Create Timeline Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new timeline item in the E&A app"}getInputSchema(){return E_}async executeInternal(e){const a={item_id:e.item_id.toString(),custom_activity_id:e.custom_activity_id,title:e.title,timestamp:e.timestamp,summary:e.summary,content:e.content,location:e.location,phone:e.phone,url:e.url};e.start_timestamp&&e.end_timestamp&&(a.time_range={start_timestamp:e.start_timestamp,end_timestamp:e.end_timestamp});const t=await this.mondayApi.request(Lw,a);return{content:`Timeline item '${e.title}' with ID ${t.create_timeline_item?.id} successfully created on item ${e.item_id}`}}},class extends eu{constructor(){super(...arguments),this.name="fetch_custom_activity",this.type=y.READ,this.annotations=Zm({title:"Fetch Custom Activities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get custom activities from the E&A app"}getInputSchema(){return D_}async executeInternal(e){const a=await this.mondayApi.request(Fw);if(!a.custom_activity||0===a.custom_activity.length)return{content:"No custom activities found"};const t=a.custom_activity.map((e=>({id:e.id,name:e.name,color:e.color,icon_id:e.icon_id,type:e.type})));return{content:`Found ${t.length} custom activities: ${JSON.stringify(t,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="create_workflow_instructions",this.type=y.READ,this.annotations=Zm({title:"Create Workflow Instructions"})}getDescription(){return'When the user asks to create a workflow or automation, you must use this tool, which provides instructions on how to create a workflow.\n This tool is very important and should be used when the user explicitly requests:\n - Workflow creation (e.g., "create a monday workflow", "create a new workflow").\n - Automation (e.g., "automate this process", "when item is created, set status to done")\n '}getInputSchema(){return{}}async executeInternal(){return{content:'\n# Instructions to Create a Live Workflow\n\n## General Explanation:\n- A workflow is a structured sequence of actions and conditions and triggers (blocks) designed to automate processes (for example, trigger -> action -> action -> ...).\n- A block is a reusable logic unit; it can be a trigger, condition or action. It has input fields and output fields.\n- A workflow block wraps a block (the underlying logic unit), providing the configuration for its input fields and defining how it connects to other blocks in the workflow graph.\n- A workflow variable presents a value that is used in the workflow block. It has a unique key, a value, and dependencies.\nIt can be a result of a previous block, a user config, a reference, or a host metadata.\nIf it is a user config, you have to get the possible values for the value from remote options query.\n\nTo create a live workflow in monday.com, follow these steps:\n\n## Step 0: Determine and Ensure Host Exists (CRITICAL FIRST STEP)\n\n**Every workflow MUST be attached to an existing host entity.** Before creating any workflow, you must:\n\n### 0.1 Identify the Host Type Based on User Request\n\n**IMPORTANT: The host type depends on what the user is asking for:**\n\n- **If user wants "monday workflows"** (e.g., "create a monday workflow") ALWAYS USE THIS HOST TYPE:\n - Host type: **APP_FEATURE_OBJECT** \n - This is the standalone Workflows product\n - User explicitly mentions "monday workflow" or "workflow" without board context\n \n- **If user wants "automation"** (e.g., "automate when item is created", "set status automatically"):\n - Host type: **BOARD**\n - The automation will run on a specific board\n - User typically mentions board-related triggers/actions and the workflow is pretty simple\n\n### 0.2 Check if Host Exists\n**Always check first before creating:**\n\n**For BOARD hosts (automations):**\n```\nquery {\n boards(ids: [BOARD_ID]) {\n id\n name\n }\n}\n```\nIf user didn\'t specify a board, you may need to ask which board or list available boards.\n\n**For APP_FEATURE_OBJECT hosts (monday workflows):**\nCheck if a workflows object exists for the user/workspace. The exact query depends on the API structure for workflows objects.\n\n### 0.3 Create Host if Missing\n**Only if the host doesn\'t exist, create it first:**\n\n**For BOARD hosts:**\n```\nmutation {\n create_board(\n board_name: "Board Name",\n board_kind: public\n ) {\n id\n }\n}\n```\n\n**For APP_FEATURE_OBJECT hosts:**\n```\nmutation {\n create_workflows_object(\n name: "Workflow Name"\n ) {\n id\n }\n}\n```\n\n### 0.4 Prepare workflowHostData\nOnce you have confirmed the host exists (or created it), prepare the `workflowHostData` object:\n\n**For automations (board host):**\n```\nworkflowHostData: {\n id: "BOARD_ID_HERE",\n type: BOARD\n}\n```\n\n**For monday workflows (app feature host):**\n```\nworkflowHostData: {\n id: "WORKFLOWS_OBJECT_ID_HERE",\n type: APP_FEATURE_OBJECT\n}\n```\n\n**⚠️ IMPORTANT: Do not proceed to the next steps until the host is confirmed to exist and you have its ID.**\n\n## Step 1: Fetch Available Blocks\n\nFetch the blocks including the input fields config using monday api:\nEach block represents a trigger, condition or action. Blocks can have input fields and output fields.\nIn general, you can understand what a block does by its description or name.\nThe "kind" field in the block represents the type of the block (trigger, condition or action).\nThere are some types of input fields: In the case of CustomInputField, it refers to a field type feature. \nIt has special functionality — for example, remote options. These are all the possible values for this type. \nFor example, if the field type is \'board\', then the options will include a list of all boardIds \nTheir identifier is the \'fieldTypeReferenceId\' (or \'id\' in the fieldTypeData).\nThere are dependencies that tell us what values we need to know to fetch the options for the custom input field\'s value.\nFor example, if the custom input field is a status column, the dependency is the board ID.\n\n**Example query to fetch the blocks:**\n```\nquery {\n blocks {\n blocks {\n id\n description\n name\n kind\n inputFieldsConfig {\n fieldTitle\n fieldKey\n ... on CustomInputFieldConfig {\n fieldTypeReferenceId\n fieldTypeUniqueKey\n fieldTypeData {\n id\n dependencyConfig{\n optionalFields{\n sourceFieldTypeReferenceId\n sourceFieldTypeUniqueKey\n targetFieldKey\n }\n orderedMandatoryFields{\n sourceFieldTypeReferenceId\n sourceFieldTypeUniqueKey\n targetFieldKey\n }\n }\n }\n }\n ... on PrimitiveInputFieldConfig {\n primitiveType\n }\n }\n }\n }\n}\n```\n\n## Step 2: Choose Blocks\n\nChoose the trigger block and action blocks that you want to use based on the user\'s automation requirements.\n\n## Step 3: Build Workflow Schema\n\nGet the input schema of the \'create_live_workflow\' mutation.\nPay attention that sometimes you need to run queries to fetch some schemas. Read the description of each field in the schema and follow the instructions if there are any.\n\n## Step 4: Build Workflow Block Schemas\n\nFor each block you choose to use, build the workflow block schema (start from the trigger block):\n- **4.a.** For each input field, build the workflow variable schema and use it in the workflow block.\n- **4.b.** For each output field, build the workflow variable schema and use it in the workflow block.\n\n## Step 5: Retrieve allowed constant values for input fields (remote_options)\n\nSometimes you need to configure an input field with a fixed (constant) value.\n\n1. Examine the block\'s inputFieldsConfig.\n • If the field type is PrimitiveInputFieldConfig – you can pass any literal that matches its primitiveType.\n • If the field type is CustomInputFieldConfig – its allowed values are dynamic. You **MUST** fetch them using the remote_options query.\n\n2. Build the remote_options query for every CustomInputFieldConfig you want to set as a constant:\n • Provide the field_type_unique_key of the field.\n • Fill the dependencies_values object with **all mandatory dependencies** listed in fieldTypeData.dependencyConfig.orderedMandatoryFields. You can supply each dependency as a literal value (value) or as a reference to an existing workflow variable (workflowVariableKey).\n\n3. Select the desired option from the query response (options.value / options.title) and store it in a USER_CONFIG workflow variable that will be referenced by the input field.\n\n**Example:**\n```graphql\nquery remote_options {\n remote_options(\n input: {\n field_type_unique_key: \'monday:status_column\'\n dependencies_values: {\n boardId: { value: 118607562 }\n }\n }\n ) {\n options {\n value\n title\n }\n }\n}\n```\n\n## ⚠️ Common Pitfalls\n\n### Pitfall #1: Skipping remote_options for Custom Fields\n- **Problem:** Using hardcoded values for groups, status columns, people columns\n- **Impact:** Workflow fails silently or uses wrong entities\n- **Solution:** Always call `remote_options` for CustomInputField types\n\n### Pitfall #2: Missing Dependency Values \n- **Problem:** Not providing all required `dependencyConfigValues`\n- **Impact:** API returns empty options or errors\n- **Solution:** Check `dependencyConfig.orderedMandatoryFields` and supply all\n\n### Pitfall #3: Wrong Host Type\n- **Problem:** Using BOARD host for "monday workflows" or APP_FEATURE_OBJECT for "automations"\n- **Impact:** Workflow created in wrong context\n- **Solution:** Follow Step 0.1 decision tree strictly\n\n### Pitfall #4: Hardcoded Field Type IDs\n**Common field types that REQUIRE remote_options:**\n- `10380085` → Groups (depends on boardId)\n- `10380084` → Status columns (depends on boardId) \n- `10380073` → People columns (depends on boardId)\n- `10380094` → Status values (depends on boardId + statusColumnId)\n\n**Never hardcode values for these field types!**\n\n### Pitfall #5: Missing appFeatureReferenceId in Workflow Variables\n- **Problem:** When a workflow variable references an app feature (e.g. a custom inbound field), forgetting to include `appFeatureReferenceId`\n- **Impact:** Can cause issues serializing the workflow variable\n- **Solution:** Always populate `appFeatureReferenceId` when the variable references an app feature, even if it has a primitiveType\n\n## Step 6: Fetch Complete Workflow Variable Schemas\n\nFetch the complete workflow variables schemas with the query \'get_workflow_variable_schemas\'. In general, there are 4 types of workflow variables:\nEach workflow variable has a workflowVariableKey (unique) that is used to identify the variable in the workflow block and a sourceKind (NODE_RESULT, USER_CONFIG, REFERENCE, HOST_METADATA).\n\n**Critical:** When the variable is of **USER_CONFIG** kind and its value was selected via the **remote_options** query (see Step 5), the **exact same dependency key-value pairs** you passed to remote_options **must be placed in** `sourceMetadata.configurationMetadata.dependencyConfigValues`. This guarantees the workflow engine can resolve the value at runtime.\n\n- **6.a. Node result:** A variable that has a value fetched from output fields of the previous block.\n **Example:**\n```\n{\n workflowVariableKey: 2,\n sourceKind: "node_results",\n appFeatureReferenceId: <item_field_type_appFeatureReferenceId>,\n sourceMetadata: {\n workflowNodeId: 1,\n outboundFieldKey: "itemId"\n }\n}\n```\n\n- **6.b. User config:** A variable that has a value fetched from the user config (if the user config is a remote option, you need to use the remote options query).\n **Very important:** You need to make sure that all the dependencies of the field type (dependencyConfigValues) are filled in the sourceMetadata (see the schema).\n **Example:**\n```\n{\n workflowVariableKey: 4,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n statusColumnId:{workflowVariableKey: 3},\n itemId:{workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "number",\n config: {\n value: 1,\n title: "Done"\n }\n }\n```\n\n- **6.c. Reference:** A variable that has a value fetched from a reference (if the reference is a remote option, you need to use the remote options query).\n\n- **6.d. Host metadata:** A variable that has a value fetched from the host metadata. For example: board ID when the host is a board.\n **Example:**\n```\n{\n workflowVariableKey: 1,\n sourceKind: "host_metadata",\n sourceMetadata: {\n hostMetadataKey: "hostInstanceId"\n }\n}\n```\n\n### 6.5: Validation Checklist for Workflow Variables\n\n**MANDATORY: Before proceeding to Step 7, validate each workflow variable:**\n\nFor every **user_config** workflow variable:\n- [ ] Does `fieldTypeReferenceId` exist?\n- [ ] If yes → Is this a CustomInputField with `dependencyConfig`?\n- [ ] If yes → Did you call `remote_options` query with ALL required dependencies?\n- [ ] Did you use an actual `value` from the `remote_options` response (not a hardcoded string)?\n- [ ] Are all `dependencyConfigValues` properly referenced by `workflowVariableKey`?\n\n## Step 7: Create the Live Workflow\n\nCreate the live workflow with the query \'create_live_workflow\', using the workflow variables and workflow blocks in the input.\n\n**Example for board automation:**\n```\nmutation {\n create_live_workflow(\n \n workflow: {\n title: "Auto set Status to Done on item creation",\n description: "When an item is created, automatically set its Status to Done.",\n\n workflowBlocks: [\n {\n workflowNodeId: 1,\n blockReferenceId: 10380130,\n title: "When item created",\n inputFields: [\n {\n fieldKey: "boardId",\n workflowVariableKey: 1\n }\n ],\n nextWorkflowBlocksConfig: {\n type: "directMapping",\n mapping: {\n nextWorkflowNode: {\n workflowNodeId: 2\n }\n }\n }\n },\n {\n workflowNodeId: 2,\n blockReferenceId: 10380126,\n title: "Change status",\n inputFields: [\n {\n fieldKey: "boardId",\n workflowVariableKey: 1\n },\n {\n fieldKey: "itemId",\n workflowVariableKey: 2\n },\n {\n fieldKey: "statusColumnId",\n workflowVariableKey: 3\n },\n {\n fieldKey: "statusColumnValue",\n workflowVariableKey: 4\n }\n ]\n }\n ],\n\n workflowVariables: [\n {\n workflowVariableKey: 1,\n sourceKind: "host_metadata",\n sourceMetadata: {\n hostMetadataKey: "hostInstanceId"\n }\n },\n {\n workflowVariableKey: 2,\n sourceKind: "node_results",\n appFeatureReferenceId: <item_field_type_appFeatureReferenceId>,\n sourceMetadata: {\n workflowNodeId: 1,\n outboundFieldKey: "itemId"\n }\n },\n {\n workflowVariableKey: 3,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n itemId: {workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "string",\n config: {\n value: "status",\n title: "Status"\n }\n },\n {\n workflowVariableKey: 4,\n sourceKind: "user_config",\n appFeatureReferenceId: <appFeatureReferenceId>,\n sourceMetadata: {\n configurationMetadata:{\n dependencyConfigValues:{\n boardId: {workflowVariableKey: 1},\n statusColumnId:{workflowVariableKey: 3},\n itemId:{workflowVariableKey: 2}\n }\n }\n },\n primitiveType: "number",\n config: {\n value: 1,\n title: "Done"\n }\n }\n ],\n\n workflowHostData: {\n id: "118607562",\n type: BOARD\n }\n }\n\n ) {\n id\n }\n}\n```\n\n## Summary Checklist:\n1. ✅ Determine if user wants automation (BOARD host) or monday workflows (APP_FEATURE_OBJECT host)\n2. ✅ Check if the appropriate host exists \n3. ✅ Create host if missing\n4. ✅ Prepare workflowHostData with correct host type and ID\n5. ✅ Fetch available blocks\n6. ✅ Choose appropriate blocks\n7. ✅ Build workflow schema\n8. ✅ Configure workflow variables\n9. ✅ Create the live workflow\n\n## Quick Reference:\n- **"Automate X"** → BOARD host\n- **"Create monday workflow"** → APP_FEATURE_OBJECT host\n'.trim()}}},class extends eu{constructor(){super(...arguments),this.name="read_docs",this.type=y.READ,this.annotations=Zm({title:"Read Documents",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get a collection of monday.com documents with their content as markdown. \n\nPAGINATION: \n- Default limit is 25 documents per page\n- Use 'page' parameter to get additional pages (starts at 1)\n- Check response for 'has_more_pages' to know if you should continue paginating\n- If user asks for \"all documents\" and you get exactly 25 results, continue with page 2, 3, etc.\n\nFILTERING: Provide an ID filter object with:\n- type: 'ids' for specific document IDs\n- type: 'object_ids' for specific document object IDs \n- type: 'workspace_ids' for all docs in specific workspaces\n- values: array of ID strings (at least 1 required)\n\nExamples:\n- { type: 'ids', values: ['123', '456'] }\n- { type: 'object_ids', values: ['123'] }\n- { type: 'workspace_ids', values: ['ws_101'] }\n\nUSAGE PATTERNS:\n- For specific documents: use type 'ids' or 'object_ids' (A monday doc has two unique identifiers)\n- For workspace exploration: use type 'workspace_ids' with pagination\n- For large searches: start with page 1, then paginate if has_more_pages=true"}getInputSchema(){return mT}async executeInternal(e){try{const a=e.ids;let t,i,n;switch(a.type){case"ids":t=a.values;break;case"object_ids":i=a.values;break;case"workspace_ids":n=a.values}const o={ids:t,object_ids:i,limit:e.limit||25,order_by:e.order_by,page:e.page,workspace_ids:n};let s=await this.mondayApi.request(Bw,o);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:n};s=await this.mondayApi.request(Bw,a)}if(!s.docs||0===s.docs.length){return{content:`No documents found matching the specified criteria${e.page?` (page ${e.page})`:""}.`}}const p=await this.enrichDocsWithMarkdown(s.docs,o),r=this.shouldSuggestPagination(s.docs.length,o.limit||25,o.page||1);return{content:p.content+r}}catch(e){return{content:`Error reading documents: ${e instanceof Error?e.message:"Unknown error occurred"}`}}}shouldSuggestPagination(e,a,t){return e===a?`\n\n🔄 PAGINATION SUGGESTION: You received exactly ${a} documents, which suggests there may be more. Consider calling this tool again with page: ${t+1} to get additional documents.`:""}async enrichDocsWithMarkdown(e,a){const t=await Promise.all(e.filter((e=>null!==e)).map((async e=>{let a="";try{const t={docId:e.id},i=await this.mondayApi.request(Mw,t);a=i.export_markdown_from_doc.success&&i.export_markdown_from_doc.markdown?i.export_markdown_from_doc.markdown:`Error getting markdown: ${i.export_markdown_from_doc.error||"Unknown error"}`}catch(e){a=`Error getting markdown: ${e instanceof Error?e.message:"Unknown error"}`}return{id:e.id,object_id:e.object_id,name:e.name,doc_kind:e.doc_kind,created_at:e.created_at,created_by:e.created_by?.name||"Unknown",url:e.url,relative_url:e.relative_url,workspace:e.workspace?.name||"Unknown",workspace_id:e.workspace_id,doc_folder_id:e.doc_folder_id,settings:e.settings,blocks_as_markdown:a}}))),i=a.page||1,n=a.limit||25,o=t.length,s=o===n;return{content:`Successfully retrieved ${t.length} document${1===t.length?"":"s"}.\n\nPAGINATION INFO:\n- Current page: ${i}\n- Documents per page: ${n}\n- Documents in this response: ${o}\n- Has more pages: ${s?"YES - call again with page: "+(i+1):"NO"}\n\nDOCUMENTS:\n${JSON.stringify(t,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="workspace_info",this.type=y.READ,this.annotations=Zm({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 uT}async executeInternal(e){const a={workspace_id:e.workspace_id},t=await this.mondayApi.request(qw,a);if(!t.workspaces||0===t.workspaces.length)return{content:`No workspace found with ID ${e.workspace_id}`};const i=function(e){const{workspaces:a,boards:t,docs:i,folders:n}=e,o=a?.[0];if(!o)throw new Error("No workspace found");const s=new Map((n||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).map((e=>[e.id,{id:e.id,name:e.name,boards:[],docs:[]}]))),p=[];(t||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).forEach((e=>{const a={id:e.id,name:e.name};e.board_folder_id&&s.has(e.board_folder_id)?s.get(e.board_folder_id).boards.push(a):p.push(a)}));const r=[];return(i||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).forEach((e=>{const a={id:e.id,name:e.name};e.doc_folder_id&&s.has(e.doc_folder_id)?s.get(e.doc_folder_id).docs.push(a):r.push(a)})),{workspace:{id:o.id,name:o.name,description:o.description||"",kind:o.kind||"",created_at:o.created_at||"",state:o.state||"",is_default_workspace:o.is_default_workspace||!1,owners_subscribers:(o.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:p,docs:r}}}(t);return{content:`Workspace Information:\n\n**Workspace:** ${i.workspace.name} (ID: ${i.workspace.id})\n- Description: ${i.workspace.description||"No description"}\n- Kind: ${i.workspace.kind}\n- State: ${i.workspace.state}\n- Default Workspace: ${i.workspace.is_default_workspace?"Yes":"No"}\n- Created: ${i.workspace.created_at}\n- Owners/Subscribers: ${i.workspace.owners_subscribers.length} users\n\n**Folders (${i.folders.length}):**\n${i.folders.map((e=>`\n📁 ${e.name} (ID: ${e.id})\n - Boards (${e.boards.length}): ${e.boards.map((e=>`${e.name} (${e.id})`)).join(", ")||"None"}\n - Docs (${e.docs.length}): ${e.docs.map((e=>`${e.name} (${e.id})`)).join(", ")||"None"}`)).join("\n")}\n\n**Root Level Items:**\n- Boards (${i.root_items.boards.length}): ${i.root_items.boards.map((e=>`${e.name} (${e.id})`)).join(", ")||"None"}\n- Docs (${i.root_items.docs.length}): ${i.root_items.docs.map((e=>`${e.name} (${e.id})`)).join(", ")||"None"}\n\n**Summary:**\n- Total Folders: ${i.folders.length}\n- Total Boards: ${i.folders.reduce(((e,a)=>e+a.boards.length),0)+i.root_items.boards.length}\n- Total Docs: ${i.folders.reduce(((e,a)=>e+a.docs.length),0)+i.root_items.docs.length}\n\n${JSON.stringify(i,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="list_workspaces",this.type=y.READ,this.annotations=Zm({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 hT}async executeInternal(e){const a={limit:5e3},t=await this.mondayApi.request(fT,a);if(!t.workspaces||0===t.workspaces.length)return{content:"No workspaces found."};const i=t.workspaces.filter((e=>null!==e)).map((e=>{const a=e.description?` - ${e.description}`:"";return`• **${e.name}** (ID: ${e.id})${a}`})).join("\n");return{content:`**Available Workspaces (${t.workspaces.length}):**\n\n${i}\n\n**Summary:**\nTotal workspaces found: ${t.workspaces.length}\n\n${JSON.stringify(t.workspaces,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="create_doc",this.type=y.WRITE,this.annotations=Zm({title:"Create Document",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a new monday.com doc either inside a workspace or attached to an item (via a doc column). After creation, the provided markdown will be appended to the document.\n\nLOCATION TYPES:\n- workspace: Creates a document in a workspace (requires workspace_id, optional doc_kind, optional folder_id)\n- item: Creates a document attached to an item (requires item_id, optional column_id)\n\nUSAGE EXAMPLES:\n- Workspace doc: { location: { type: "workspace", workspace_id: 123, doc_kind: "private" }, markdown: "..." }\n- Workspace doc in folder: { location: { type: "workspace", workspace_id: 123, folder_id: 17264196 }, markdown: "..." }\n- Item doc: { location: { type: "item", item_id: 456, column_id: "doc_col_1" }, markdown: "..." }'}getInputSchema(){return bT}async executeInternal(e){try{let a,t;if(e.location.type===vT.enum.workspace){const i={location:{workspace:{workspace_id:e.location.workspace_id.toString(),name:e.doc_name,kind:e.location.doc_kind||xb.Public,folder_id:e.location.folder_id?.toString()}}},n=await this.mondayApi.request(Vw,i);a=n?.create_doc?.id??void 0,t=n?.create_doc?.url??void 0}else if(e.location.type===vT.enum.item){const i={itemId:e.location.item_id.toString()},n=await this.mondayApi.request(jw,i),o=n.items?.[0];if(!o)return{content:`Error: Item with id ${e.location.item_id} not found.`};const s=o.board?.id,p=o.board?.columns?.find((e=>e&&e.type===Cb.Doc));let r=e.location.column_id;if(!r)if(p)r=p.id;else{const e={boardId:s.toString(),columnType:Cb.Doc,columnTitle:"Doc"},a=await this.mondayApi.request(Ow,e);if(r=a?.create_column?.id,!r)return{content:"Error: Failed to create doc column."}}const d={location:{board:{item_id:e.location.item_id.toString(),column_id:r}}},l=await this.mondayApi.request(Vw,d);if(a=l.create_doc?.id??void 0,t=l.create_doc?.url??void 0,e.doc_name&&a)try{const t={docId:a,name:e.doc_name};await this.mondayApi.request(Uw,t)}catch(e){console.warn("Failed to update doc name:",e)}}if(!a)return{content:"Error: Failed to create document."};const i={docId:a,markdown:e.markdown},n=await this.mondayApi.request(Pw,i),o=n?.add_content_to_doc_from_markdown?.success,s=n?.add_content_to_doc_from_markdown?.error;return o?{content:`✅ Document successfully created (id: ${a}). ${t?`\n\nURL: ${t}`:""}`}:{content:`Document ${a} created, but failed to add markdown content: ${s||"Unknown error"}`}}catch(e){return{content:`Error creating document: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends eu{constructor(){super(...arguments),this.name="update_workspace",this.type=y.WRITE,this.annotations=Zm({title:"Update Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing workspace in monday.com"}getInputSchema(){return ET}async executeInternal(e){const a={id:e.id,attributes:e.attributes},t=await this.mondayApi.request(TT,a);return{content:`Workspace ${t.update_workspace?.id} successfully updated`}}},class extends eu{constructor(){super(...arguments),this.name="update_folder",this.type=y.WRITE,this.annotations=Zm({title:"Update Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing folder in monday.com"}getInputSchema(){return IT}async executeInternal(e){const a={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:e.position},t=await this.mondayApi.request(NT,a);return{content:`Folder ${t.update_folder?.id} successfully updated`}}},class extends eu{constructor(){super(...arguments),this.name="create_workspace",this.type=y.WRITE,this.annotations=Zm({title:"Create Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new workspace in monday.com"}getInputSchema(){return AT}async executeInternal(e){const a={name:e.name,workspaceKind:e.workspaceKind,description:e.description,accountProductId:e.accountProductId},t=await this.mondayApi.request(ST,a);return{content:`Workspace ${t.create_workspace?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_folder",this.type=y.WRITE,this.annotations=Zm({title:"Create Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new folder in a monday.com workspace"}getInputSchema(){return OT}async executeInternal(e){const a={workspaceId:e.workspaceId,name:e.name,color:e.color,fontWeight:e.fontWeight,customIcon:e.customIcon,parentFolderId:e.parentFolderId},t=await this.mondayApi.request(DT,a);return{content:`Folder ${t.create_folder?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_dashboard",this.type=y.WRITE,this.annotations=Zm({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 xT}async executeInternal(e){try{const a={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()},t=await this.mondayApi.request(gT,a);if(!t.create_dashboard)throw new Error("Failed to create dashboard");const i=t.create_dashboard,n=i.board_folder_id?` in folder ${i.board_folder_id}`:" in workspace root",o=i.kind===jb.Public?"(visible to all workspace members)":"(private - visible only to invited users)";return{content:`✅ Dashboard "${i.name}" successfully created!\n\nDashboard Details:\n• ID: ${i.id}\n• Name: ${i.name}\n• Workspace ID: ${i.workspace_id}${n}\n• Visibility: ${i.kind} ${o}\n• Connected Boards: ${e.board_ids.length} board(s)\n\nNext Steps:\n1. Use 'all_widgets_schema' to understand available widget types\n2. Understand the connected boards structure, columns, and metadata. Map board ids to column ids\n3. Plan Domain-Beneficial Widgets - Strategic widget planning based on real data analysis\n4. Use 'create_widget' to add widgets to the dashboard`}}catch(e){const a=e instanceof Error?e.message:String(e);throw new Error(`Failed to create dashboard: ${a}`)}}},class extends eu{constructor(){super(...arguments),this.name="all_widgets_schema",this.type=y.READ,this.annotations=Zm({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={},a=await this.mondayApi.request(yT,e);if(!a.all_widgets_schema||0===a.all_widgets_schema.length)throw new Error("No widget schemas found - API returned empty response");const t={};let i=0;for(const e of a.all_widgets_schema)if(e?.widget_type&&e?.schema){const a="string"==typeof e.schema?JSON.parse(e.schema):e.schema,n=a?.description||a?.title||`${e.widget_type} widget for data visualization`;t[e.widget_type]={type:e.widget_type,description:n,schema:e.schema},i++}if(0===i)throw new Error("No valid widget schemas found in API response");return{content:`**Widget Schemas Retrieved Successfully!**\n\n🎯 **Available Widget Types** (${i} schemas found):\n${Object.keys(t).map((e=>`• **${e}**: ${t[e].description}`)).join("\n")}\n\n**Complete JSON Schema 7 Definitions:**\n\n${JSON.stringify(t,null,2)}\n\n**Schema Compliance Tips:**\n- All required fields MUST be provided in widget settings\n- Enum values must match exactly as specified in the schema\n- Data types must conform to the schema definitions\n- Nested objects must follow the exact structure\n\n⚡ **Next Steps:**\n- Use these schemas to validate widget settings before calling 'create_widget'\n- Reference the schema structure when planning widget configurations\n- Ensure 100% compliance with field requirements and data types`}}catch(e){const a=e instanceof Error?e.message:String(e);throw new Error(`Failed to fetch widget schemas: ${a}`)}}},class extends eu{constructor(){super(...arguments),this.name="create_widget",this.type=y.WRITE,this.annotations=Zm({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){try{const a={parent:{kind:e.parent_container_type,id:e.parent_container_id.toString()},kind:e.widget_kind,name:e.widget_name,settings:e.settings},t=await this.mondayApi.request(wT,a);if(!t.create_widget)throw new Error("Failed to create widget");const i=t.create_widget,n=i.parent?.kind===Qg.Dashboard?`dashboard ${i.parent.id}`:`board view ${i.parent?.id}`;return{content:`✅ Widget "${i.name}" successfully created!\n\n**Widget Details:**\n• **ID**: ${i.id}\n• **Name**: ${i.name}\n• **Type**: ${i.kind}\n• **Location**: Placed in ${n}\n\n**Widget Configuration:**\n• **Settings Applied**: ${JSON.stringify(e.settings,null,2)}`}}catch(a){const t=a instanceof Error?a.message:String(a);throw new Error(`Failed to create ${e.widget_kind} widget: ${t}`)}}}];var RT;!function(e){e.API="api",e.APPS="apps"}(RT||(RT={}));const CT=(e,a)=>{let t=[];a?.mode===RT.APPS?t=[...$]:a?.mode!==RT.API&&a?.mode||(t=[...kT]);const i=t.map((a=>((e,a)=>e.prototype instanceof eu?new e(a.apiClient,a.apiToken):new e)(a,e)));return i.filter((e=>{if(!a)return e.type!==y.ALL_API;if(a.mode===RT.API&&"only"===a.enableDynamicApiTools)return e.type===y.ALL_API;let t=!1;return a.mode===RT.API&&!1===a.enableDynamicApiTools&&(t=t||e.type===y.ALL_API),a.readOnlyMode&&(t=t||e.type!==y.READ),a.include?t=t||!a.include?.includes(e.name):a.exclude&&(t=t||a.exclude?.includes(e.name)),!t}))};exports.MondayAgentToolkit=class{constructor(a){this.mondayApi=new e.ApiClient({token:a.mondayApiToken,apiVersion:a.mondayApiVersion,requestConfig:a.mondayApiRequestConfig}),this.mondayApiToken=a.mondayApiToken,this.tools=this.initializeTools(a)}initializeTools(e){const a={apiClient:this.mondayApi,apiToken:this.mondayApiToken};return CT(a,e.toolsConfiguration)}getTools(){return this.tools.map((e=>{const t=e.getInputSchema();return{type:"function",function:{name:e.name,description:e.getDescription(),parameters:t?b.zodToJsonSchema(a.z.object(t)):void 0}}}))}async handleToolCall(e){const{name:t,arguments:i}=e.function,n=JSON.parse(i),o=this.tools.find((e=>e.name===t));if(!o)throw new Error(`Unknown tool: ${t}`);const s=o.getInputSchema();if(s){const t=a.z.object(s).safeParse(n);if(!t.success)throw new Error(`Invalid arguments: ${t.error.message}`);const i=await o.execute(t.data);return{role:"tool",tool_call_id:e.id,content:i.content}}{const a=await o.execute();return{role:"tool",tool_call_id:e.id,content:a.content}}}};
|
|
1300
|
+
`),i=await this.mondayApi.request(t);if(!i.__type)return{content:`Type '${e.typeName}' not found in the GraphQL schema. Please check the type name and try again.`};let n=`## Type: ${i.__type.name||"Unnamed"} ${e.typeName===i.__type.name?"":`(queried: ${e.typeName})`}\nKind: ${i.__type.kind}\n${i.__type.description?`Description: ${i.__type.description}`:""}\n\n`;return i.__type.fields&&i.__type.fields.length>0&&(n+="## Fields\n",i.__type.fields.forEach((e=>{const a=M_(e.type);n+=`- ${e.name}: ${a}${e.description?` - ${e.description}`:""}\n`,e.args&&e.args.length>0&&(n+=" Arguments:\n",e.args.forEach((e=>{const a=M_(e.type);n+=` - ${e.name}: ${a}${e.description?` - ${e.description}`:""}${e.defaultValue?` (default: ${e.defaultValue})`:""}\n`})))})),n+="\n"),i.__type.inputFields&&i.__type.inputFields.length>0&&(n+="## Input Fields\n",i.__type.inputFields.forEach((e=>{const a=M_(e.type);n+=`- ${e.name}: ${a}${e.description?` - ${e.description}`:""}${e.defaultValue?` (default: ${e.defaultValue})`:""}\n`})),n+="\n"),i.__type.interfaces&&i.__type.interfaces.length>0&&(n+="## Implements\n",i.__type.interfaces.forEach((e=>{n+=`- ${e.name}\n`})),n+="\n"),i.__type.enumValues&&i.__type.enumValues.length>0&&(n+="## Enum Values\n",i.__type.enumValues.forEach((e=>{n+=`- ${e.name}${e.description?` - ${e.description}`:""}\n`})),n+="\n"),i.__type.possibleTypes&&i.__type.possibleTypes.length>0&&(n+="## Possible Types\n",i.__type.possibleTypes.forEach((e=>{n+=`- ${e.name}\n`}))),n+=`\n## Usage Examples\nIf this is a Query or Mutation field, you can use it in the all_monday_api tool.\n\nExample for query:\nall_monday_api(operation: "query", name: "getTypeData", variables: "{\\"typeName\\": \\"${i.__type.name}\\"}")\n\nExample for object field access:\nWhen querying objects that have this type, include these fields in your query.\n`,{content:n}}catch(e){const a=e instanceof Error?e.message:"Unknown error",t=a.includes("JSON");return{content:`Error fetching type details: ${a}${t?"\n\nThis could be because the type name is incorrect or the GraphQL query format is invalid. Please check the type name and try again.":""}`}}var a}},class extends eu{constructor(){super(...arguments),this.name="create_custom_activity",this.type=y.WRITE,this.annotations=Zm({title:"Create Custom Activity",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new custom activity in the E&A app"}getInputSchema(){return g_}async executeInternal(e){const a={color:e.color,icon_id:e.icon_id,name:e.name};return await this.mondayApi.request($w,a),{content:`Custom activity '${e.name}' with color ${e.color} and icon ${e.icon_id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_timeline_item",this.type=y.WRITE,this.annotations=Zm({title:"Create Timeline Item",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new timeline item in the E&A app"}getInputSchema(){return E_}async executeInternal(e){const a={item_id:e.item_id.toString(),custom_activity_id:e.custom_activity_id,title:e.title,timestamp:e.timestamp,summary:e.summary,content:e.content,location:e.location,phone:e.phone,url:e.url};e.start_timestamp&&e.end_timestamp&&(a.time_range={start_timestamp:e.start_timestamp,end_timestamp:e.end_timestamp});const t=await this.mondayApi.request(Lw,a);return{content:`Timeline item '${e.title}' with ID ${t.create_timeline_item?.id} successfully created on item ${e.item_id}`}}},class extends eu{constructor(){super(...arguments),this.name="fetch_custom_activity",this.type=y.READ,this.annotations=Zm({title:"Fetch Custom Activities",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get custom activities from the E&A app"}getInputSchema(){return D_}async executeInternal(e){const a=await this.mondayApi.request(Fw);if(!a.custom_activity||0===a.custom_activity.length)return{content:"No custom activities found"};const t=a.custom_activity.map((e=>({id:e.id,name:e.name,color:e.color,icon_id:e.icon_id,type:e.type})));return{content:`Found ${t.length} custom activities: ${JSON.stringify(t,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="read_docs",this.type=y.READ,this.annotations=Zm({title:"Read Documents",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Get a collection of monday.com documents with their content as markdown. \n\nPAGINATION: \n- Default limit is 25 documents per page\n- Use 'page' parameter to get additional pages (starts at 1)\n- Check response for 'has_more_pages' to know if you should continue paginating\n- If user asks for \"all documents\" and you get exactly 25 results, continue with page 2, 3, etc.\n\nFILTERING: Provide an ID filter object with:\n- type: 'ids' for specific document IDs\n- type: 'object_ids' for specific document object IDs \n- type: 'workspace_ids' for all docs in specific workspaces\n- values: array of ID strings (at least 1 required)\n\nExamples:\n- { type: 'ids', values: ['123', '456'] }\n- { type: 'object_ids', values: ['123'] }\n- { type: 'workspace_ids', values: ['ws_101'] }\n\nUSAGE PATTERNS:\n- For specific documents: use type 'ids' or 'object_ids' (A monday doc has two unique identifiers)\n- For workspace exploration: use type 'workspace_ids' with pagination\n- For large searches: start with page 1, then paginate if has_more_pages=true"}getInputSchema(){return mT}async executeInternal(e){try{const a=e.ids;let t,i,n;switch(a.type){case"ids":t=a.values;break;case"object_ids":i=a.values;break;case"workspace_ids":n=a.values}const o={ids:t,object_ids:i,limit:e.limit||25,order_by:e.order_by,page:e.page,workspace_ids:n};let s=await this.mondayApi.request(Bw,o);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:n};s=await this.mondayApi.request(Bw,a)}if(!s.docs||0===s.docs.length){return{content:`No documents found matching the specified criteria${e.page?` (page ${e.page})`:""}.`}}const p=await this.enrichDocsWithMarkdown(s.docs,o),r=this.shouldSuggestPagination(s.docs.length,o.limit||25,o.page||1);return{content:p.content+r}}catch(e){return{content:`Error reading documents: ${e instanceof Error?e.message:"Unknown error occurred"}`}}}shouldSuggestPagination(e,a,t){return e===a?`\n\n🔄 PAGINATION SUGGESTION: You received exactly ${a} documents, which suggests there may be more. Consider calling this tool again with page: ${t+1} to get additional documents.`:""}async enrichDocsWithMarkdown(e,a){const t=await Promise.all(e.filter((e=>null!==e)).map((async e=>{let a="";try{const t={docId:e.id},i=await this.mondayApi.request(Mw,t);a=i.export_markdown_from_doc.success&&i.export_markdown_from_doc.markdown?i.export_markdown_from_doc.markdown:`Error getting markdown: ${i.export_markdown_from_doc.error||"Unknown error"}`}catch(e){a=`Error getting markdown: ${e instanceof Error?e.message:"Unknown error"}`}return{id:e.id,object_id:e.object_id,name:e.name,doc_kind:e.doc_kind,created_at:e.created_at,created_by:e.created_by?.name||"Unknown",url:e.url,relative_url:e.relative_url,workspace:e.workspace?.name||"Unknown",workspace_id:e.workspace_id,doc_folder_id:e.doc_folder_id,settings:e.settings,blocks_as_markdown:a}}))),i=a.page||1,n=a.limit||25,o=t.length,s=o===n;return{content:`Successfully retrieved ${t.length} document${1===t.length?"":"s"}.\n\nPAGINATION INFO:\n- Current page: ${i}\n- Documents per page: ${n}\n- Documents in this response: ${o}\n- Has more pages: ${s?"YES - call again with page: "+(i+1):"NO"}\n\nDOCUMENTS:\n${JSON.stringify(t,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="workspace_info",this.type=y.READ,this.annotations=Zm({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 uT}async executeInternal(e){const a={workspace_id:e.workspace_id},t=await this.mondayApi.request(qw,a);if(!t.workspaces||0===t.workspaces.length)return{content:`No workspace found with ID ${e.workspace_id}`};const i=function(e){const{workspaces:a,boards:t,docs:i,folders:n}=e,o=a?.[0];if(!o)throw new Error("No workspace found");const s=new Map((n||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).map((e=>[e.id,{id:e.id,name:e.name,boards:[],docs:[]}]))),p=[];(t||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).forEach((e=>{const a={id:e.id,name:e.name};e.board_folder_id&&s.has(e.board_folder_id)?s.get(e.board_folder_id).boards.push(a):p.push(a)}));const r=[];return(i||[]).filter((e=>null!=e&&null!=e.id&&null!=e.name)).forEach((e=>{const a={id:e.id,name:e.name};e.doc_folder_id&&s.has(e.doc_folder_id)?s.get(e.doc_folder_id).docs.push(a):r.push(a)})),{workspace:{id:o.id,name:o.name,description:o.description||"",kind:o.kind||"",created_at:o.created_at||"",state:o.state||"",is_default_workspace:o.is_default_workspace||!1,owners_subscribers:(o.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:p,docs:r}}}(t);return{content:`Workspace Information:\n\n**Workspace:** ${i.workspace.name} (ID: ${i.workspace.id})\n- Description: ${i.workspace.description||"No description"}\n- Kind: ${i.workspace.kind}\n- State: ${i.workspace.state}\n- Default Workspace: ${i.workspace.is_default_workspace?"Yes":"No"}\n- Created: ${i.workspace.created_at}\n- Owners/Subscribers: ${i.workspace.owners_subscribers.length} users\n\n**Folders (${i.folders.length}):**\n${i.folders.map((e=>`\n📁 ${e.name} (ID: ${e.id})\n - Boards (${e.boards.length}): ${e.boards.map((e=>`${e.name} (${e.id})`)).join(", ")||"None"}\n - Docs (${e.docs.length}): ${e.docs.map((e=>`${e.name} (${e.id})`)).join(", ")||"None"}`)).join("\n")}\n\n**Root Level Items:**\n- Boards (${i.root_items.boards.length}): ${i.root_items.boards.map((e=>`${e.name} (${e.id})`)).join(", ")||"None"}\n- Docs (${i.root_items.docs.length}): ${i.root_items.docs.map((e=>`${e.name} (${e.id})`)).join(", ")||"None"}\n\n**Summary:**\n- Total Folders: ${i.folders.length}\n- Total Boards: ${i.folders.reduce(((e,a)=>e+a.boards.length),0)+i.root_items.boards.length}\n- Total Docs: ${i.folders.reduce(((e,a)=>e+a.docs.length),0)+i.root_items.docs.length}\n\n${JSON.stringify(i,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="list_workspaces",this.type=y.READ,this.annotations=Zm({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 hT}async executeInternal(e){const a={limit:5e3},t=await this.mondayApi.request(fT,a);if(!t.workspaces||0===t.workspaces.length)return{content:"No workspaces found."};const i=t.workspaces.filter((e=>null!==e)).map((e=>{const a=e.description?` - ${e.description}`:"";return`• **${e.name}** (ID: ${e.id})${a}`})).join("\n");return{content:`**Available Workspaces (${t.workspaces.length}):**\n\n${i}\n\n**Summary:**\nTotal workspaces found: ${t.workspaces.length}\n\n${JSON.stringify(t.workspaces,null,2)}`}}},class extends eu{constructor(){super(...arguments),this.name="create_doc",this.type=y.WRITE,this.annotations=Zm({title:"Create Document",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return'Create a new monday.com doc either inside a workspace or attached to an item (via a doc column). After creation, the provided markdown will be appended to the document.\n\nLOCATION TYPES:\n- workspace: Creates a document in a workspace (requires workspace_id, optional doc_kind, optional folder_id)\n- item: Creates a document attached to an item (requires item_id, optional column_id)\n\nUSAGE EXAMPLES:\n- Workspace doc: { location: { type: "workspace", workspace_id: 123, doc_kind: "private" }, markdown: "..." }\n- Workspace doc in folder: { location: { type: "workspace", workspace_id: 123, folder_id: 17264196 }, markdown: "..." }\n- Item doc: { location: { type: "item", item_id: 456, column_id: "doc_col_1" }, markdown: "..." }'}getInputSchema(){return bT}async executeInternal(e){try{let a,t;if(e.location.type===vT.enum.workspace){const i={location:{workspace:{workspace_id:e.location.workspace_id.toString(),name:e.doc_name,kind:e.location.doc_kind||xb.Public,folder_id:e.location.folder_id?.toString()}}},n=await this.mondayApi.request(Vw,i);a=n?.create_doc?.id??void 0,t=n?.create_doc?.url??void 0}else if(e.location.type===vT.enum.item){const i={itemId:e.location.item_id.toString()},n=await this.mondayApi.request(jw,i),o=n.items?.[0];if(!o)return{content:`Error: Item with id ${e.location.item_id} not found.`};const s=o.board?.id,p=o.board?.columns?.find((e=>e&&e.type===Cb.Doc));let r=e.location.column_id;if(!r)if(p)r=p.id;else{const e={boardId:s.toString(),columnType:Cb.Doc,columnTitle:"Doc"},a=await this.mondayApi.request(Ow,e);if(r=a?.create_column?.id,!r)return{content:"Error: Failed to create doc column."}}const d={location:{board:{item_id:e.location.item_id.toString(),column_id:r}}},l=await this.mondayApi.request(Vw,d);if(a=l.create_doc?.id??void 0,t=l.create_doc?.url??void 0,e.doc_name&&a)try{const t={docId:a,name:e.doc_name};await this.mondayApi.request(Uw,t)}catch(e){console.warn("Failed to update doc name:",e)}}if(!a)return{content:"Error: Failed to create document."};const i={docId:a,markdown:e.markdown},n=await this.mondayApi.request(Pw,i),o=n?.add_content_to_doc_from_markdown?.success,s=n?.add_content_to_doc_from_markdown?.error;return o?{content:`✅ Document successfully created (id: ${a}). ${t?`\n\nURL: ${t}`:""}`}:{content:`Document ${a} created, but failed to add markdown content: ${s||"Unknown error"}`}}catch(e){return{content:`Error creating document: ${e instanceof Error?e.message:"Unknown error"}`}}}},class extends eu{constructor(){super(...arguments),this.name="update_workspace",this.type=y.WRITE,this.annotations=Zm({title:"Update Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing workspace in monday.com"}getInputSchema(){return ET}async executeInternal(e){const a={id:e.id,attributes:e.attributes},t=await this.mondayApi.request(TT,a);return{content:`Workspace ${t.update_workspace?.id} successfully updated`}}},class extends eu{constructor(){super(...arguments),this.name="update_folder",this.type=y.WRITE,this.annotations=Zm({title:"Update Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Update an existing folder in monday.com"}getInputSchema(){return IT}async executeInternal(e){const a={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:e.position},t=await this.mondayApi.request(NT,a);return{content:`Folder ${t.update_folder?.id} successfully updated`}}},class extends eu{constructor(){super(...arguments),this.name="create_workspace",this.type=y.WRITE,this.annotations=Zm({title:"Create Workspace",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new workspace in monday.com"}getInputSchema(){return AT}async executeInternal(e){const a={name:e.name,workspaceKind:e.workspaceKind,description:e.description,accountProductId:e.accountProductId},t=await this.mondayApi.request(ST,a);return{content:`Workspace ${t.create_workspace?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="create_folder",this.type=y.WRITE,this.annotations=Zm({title:"Create Folder",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1})}getDescription(){return"Create a new folder in a monday.com workspace"}getInputSchema(){return OT}async executeInternal(e){const a={workspaceId:e.workspaceId,name:e.name,color:e.color,fontWeight:e.fontWeight,customIcon:e.customIcon,parentFolderId:e.parentFolderId},t=await this.mondayApi.request(DT,a);return{content:`Folder ${t.create_folder?.id} successfully created`}}},class extends eu{constructor(){super(...arguments),this.name="move_object",this.type=y.WRITE,this.annotations=Zm({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 CT}async executeUpdateFolder(e){const{id:a,position:t,parentFolderId:i,workspaceId:n,accountProductId:o}=e,s={folderId:a,position:t,parentFolderId:i,workspaceId:n,accountProductId:o},p=await this.mondayApi.request(NT,s);return{content:`Object ${p.update_folder?.id} successfully moved`}}async executeUpdateBoardHierarchy(e){const{id:a,position:t,parentFolderId:i,workspaceId:n,accountProductId:o}=e,s={boardId:a,attributes:{position:t,folder_id:i,workspace_id:n,account_product_id:o}},p=await this.mondayApi.request(kT,s);return p.update_board_hierarchy?.success?{content:`Board ${p.update_board_hierarchy?.board?.id} position updated successfully`}:{content:`Board position updated failed: ${p.update_board_hierarchy?.message}`}}async executeUpdateOverviewHierarchy(e){const{id:a,position:t,parentFolderId:i,workspaceId:n,accountProductId:o}=e,s={overviewId:a,attributes:{position:t,folder_id:i,workspace_id:n,account_product_id:o}},p=await this.mondayApi.request(RT,s);return p.update_overview_hierarchy?.success?{content:`Overview ${p.update_overview_hierarchy?.overview?.id} position updated successfully`}:{content:`Overview position updated failed: ${p.update_overview_hierarchy?.message}`}}async executeInternal(e){const{objectType:a}=e;switch(a){case Ng.Folder:return this.executeUpdateFolder(e);case Ng.Board:return this.executeUpdateBoardHierarchy(e);case Ng.Overview:return this.executeUpdateOverviewHierarchy(e);default:throw new Error(`Unsupported object type: ${a}`)}}},class extends eu{constructor(){super(...arguments),this.name="create_dashboard",this.type=y.WRITE,this.annotations=Zm({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 xT}async executeInternal(e){try{const a={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()},t=await this.mondayApi.request(gT,a);if(!t.create_dashboard)throw new Error("Failed to create dashboard");const i=t.create_dashboard,n=i.board_folder_id?` in folder ${i.board_folder_id}`:" in workspace root",o=i.kind===jb.Public?"(visible to all workspace members)":"(private - visible only to invited users)";return{content:`✅ Dashboard "${i.name}" successfully created!\n\nDashboard Details:\n• ID: ${i.id}\n• Name: ${i.name}\n• Workspace ID: ${i.workspace_id}${n}\n• Visibility: ${i.kind} ${o}\n• Connected Boards: ${e.board_ids.length} board(s)\n\nNext Steps:\n1. Use 'all_widgets_schema' to understand available widget types\n2. Understand the connected boards structure, columns, and metadata. Map board ids to column ids\n3. Plan Domain-Beneficial Widgets - Strategic widget planning based on real data analysis\n4. Use 'create_widget' to add widgets to the dashboard`}}catch(e){const a=e instanceof Error?e.message:String(e);throw new Error(`Failed to create dashboard: ${a}`)}}},class extends eu{constructor(){super(...arguments),this.name="all_widgets_schema",this.type=y.READ,this.annotations=Zm({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={},a=await this.mondayApi.request(yT,e);if(!a.all_widgets_schema||0===a.all_widgets_schema.length)throw new Error("No widget schemas found - API returned empty response");const t={};let i=0;for(const e of a.all_widgets_schema)if(e?.widget_type&&e?.schema){const a="string"==typeof e.schema?JSON.parse(e.schema):e.schema,n=a?.description||a?.title||`${e.widget_type} widget for data visualization`;t[e.widget_type]={type:e.widget_type,description:n,schema:e.schema},i++}if(0===i)throw new Error("No valid widget schemas found in API response");return{content:`**Widget Schemas Retrieved Successfully!**\n\n🎯 **Available Widget Types** (${i} schemas found):\n${Object.keys(t).map((e=>`• **${e}**: ${t[e].description}`)).join("\n")}\n\n**Complete JSON Schema 7 Definitions:**\n\n${JSON.stringify(t,null,2)}\n\n**Schema Compliance Tips:**\n- All required fields MUST be provided in widget settings\n- Enum values must match exactly as specified in the schema\n- Data types must conform to the schema definitions\n- Nested objects must follow the exact structure\n\n⚡ **Next Steps:**\n- Use these schemas to validate widget settings before calling 'create_widget'\n- Reference the schema structure when planning widget configurations\n- Ensure 100% compliance with field requirements and data types`}}catch(e){const a=e instanceof Error?e.message:String(e);throw new Error(`Failed to fetch widget schemas: ${a}`)}}},class extends eu{constructor(){super(...arguments),this.name="create_widget",this.type=y.WRITE,this.annotations=Zm({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){try{const a={parent:{kind:e.parent_container_type,id:e.parent_container_id.toString()},kind:e.widget_kind,name:e.widget_name,settings:e.settings},t=await this.mondayApi.request(wT,a);if(!t.create_widget)throw new Error("Failed to create widget");const i=t.create_widget,n=i.parent?.kind===Qg.Dashboard?`dashboard ${i.parent.id}`:`board view ${i.parent?.id}`;return{content:`✅ Widget "${i.name}" successfully created!\n\n**Widget Details:**\n• **ID**: ${i.id}\n• **Name**: ${i.name}\n• **Type**: ${i.kind}\n• **Location**: Placed in ${n}\n\n**Widget Configuration:**\n• **Settings Applied**: ${JSON.stringify(e.settings,null,2)}`}}catch(a){const t=a instanceof Error?a.message:String(a);throw new Error(`Failed to create ${e.widget_kind} widget: ${t}`)}}}];var LT;!function(e){e.API="api",e.APPS="apps"}(LT||(LT={}));const FT=(e,a)=>{let t=[];a?.mode===LT.APPS?t=[...$]:a?.mode!==LT.API&&a?.mode||(t=[...$T]);const i=t.map((a=>((e,a)=>e.prototype instanceof eu?new e(a.apiClient,a.apiToken):new e)(a,e)));return i.filter((e=>{if(!a)return e.type!==y.ALL_API;if(a.mode===LT.API&&"only"===a.enableDynamicApiTools)return e.type===y.ALL_API;let t=!1;return a.mode===LT.API&&!1===a.enableDynamicApiTools&&(t=t||e.type===y.ALL_API),a.readOnlyMode&&(t=t||e.type!==y.READ),a.include?t=t||!a.include?.includes(e.name):a.exclude&&(t=t||a.exclude?.includes(e.name)),!t}))};exports.MondayAgentToolkit=class{constructor(a){this.mondayApi=new e.ApiClient({token:a.mondayApiToken,apiVersion:a.mondayApiVersion,requestConfig:a.mondayApiRequestConfig}),this.mondayApiToken=a.mondayApiToken,this.tools=this.initializeTools(a)}initializeTools(e){const a={apiClient:this.mondayApi,apiToken:this.mondayApiToken};return FT(a,e.toolsConfiguration)}getTools(){return this.tools.map((e=>{const t=e.getInputSchema();return{type:"function",function:{name:e.name,description:e.getDescription(),parameters:t?b.zodToJsonSchema(a.z.object(t)):void 0}}}))}async handleToolCall(e){const{name:t,arguments:i}=e.function,n=JSON.parse(i),o=this.tools.find((e=>e.name===t));if(!o)throw new Error(`Unknown tool: ${t}`);const s=o.getInputSchema();if(s){const t=a.z.object(s).safeParse(n);if(!t.success)throw new Error(`Invalid arguments: ${t.error.message}`);const i=await o.execute(t.data);return{role:"tool",tool_call_id:e.id,content:i.content}}{const a=await o.execute();return{role:"tool",tool_call_id:e.id,content:a.content}}}};
|
|
1281
1301
|
//# sourceMappingURL=index.js.map
|