@mondaydotcomorg/agent-toolkit 5.55.0 → 5.56.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.
@@ -521,7 +521,7 @@
521
521
  }
522
522
  }
523
523
  }
524
- `;class pp extends Error{constructor(e,t){super(e),this.name="ToolValidationError",this.code=t}}function lp(e,t){if(e instanceof pp)throw e;const a=e?.response?.errors?.map((e=>{const{code:t,error_data:a}=e.extensions??{},i=Object.fromEntries(Object.entries({code:t,error_data:a}).filter((([,e])=>void 0!==e)));return Object.keys(i).length>0?`${e.message} (details: ${JSON.stringify(i)})`:e.message}))?.join(", ");if(a){const i=new Error(`Failed to ${t}: ${a}`);throw i.response=e.response,i}const i=e instanceof Error?e.message:"Unknown error";throw new Error(`Failed to ${t}: ${i}`)}function cp(e){if(e instanceof Error&&"AbortError"===e.name)throw new Error("Search has timed out, try providing alternative search term")}function mp(e){const t=e?.response;return 429===t?.status}const up={query:o.z.string().describe("Custom GraphQL query/mutation. you need to provide the full query / mutation"),variables:o.z.string().describe("JSON string containing the variables for the GraphQL operation")};class hp extends he{constructor(e,t){super(e,t),this.name="all_monday_api",this.type=g.ALL_API,this.annotations=ue({title:"Run Query or Mutation on any monday.com API",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Execute any monday.com API operation by generating GraphQL queries and mutations dynamically. Make sure you ask only for the fields you need and nothing more. When providing the query/mutation - use get_graphql_schema and get_type_details tools first to understand the schema before crafting your query."}getInputSchema(){return up}async loadSchema(e){if(hp.schemaCache[e])return hp.schemaCache[e];try{const t=await this.mondayApi.rawRequest(tp),{data:a}=t,i=vn(a);return hp.schemaCache[e]=i,i}catch(e){throw new Error(`Failed to load GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`)}}countGraphqlOperations(e){const t={},a={};for(const i of e.definitions){if("OperationDefinition"!==i.kind)continue;const e=this.getGraphqlOperationKey(i);i.operation===ke.MUTATION?a[e]=(a[e]??0)+1:i.operation===ke.QUERY&&(t[e]=(t[e]??0)+1)}return{graphql_queries:t,graphql_mutations:a}}getGraphqlOperationKey(e){if(e.name?.value)return e.name.value;const t=e.selectionSet.selections[0];return"Field"===t?.kind?t.name.value:"<anonymous>"}recordGraphqlOperationCounts(e){const{graphql_queries:t,graphql_mutations:a}=this.countGraphqlOperations(e);this.sessionContext.metadata??={},this.sessionContext.metadata.graphql_queries=t,this.sessionContext.metadata.graphql_mutations=a}async validateOperation(e,t){return gn(await this.loadSchema(t),e).map((e=>e.message))}async executeInternal(e){const{query:t,variables:a}=e;let i={};try{i=JSON.parse(a)}catch(e){throw new Error(`Error parsing variables: ${e instanceof Error?e.message:"Unknown error"}`)}const n=lt(t);this.recordGraphqlOperationCounts(n);const o=await this.validateOperation(n,this.context?.apiVersion??z);if(o.length>0)throw new Error(o.join(", "));try{return{content:await this.mondayApi.request(t,i)}}catch(e){lp(e,"execute GraphQL operation")}}}hp.schemaCache={};const fp=1e3;var _p,gp;!function(e){e[e.YEAR=31536e3]="YEAR",e[e.MONTH31Days=2678400]="MONTH31Days",e[e.MONTH30Days=2592e3]="MONTH30Days",e[e.MONTH29Days=2505600]="MONTH29Days",e[e.MONTH28Days=2419200]="MONTH28Days",e[e.WEEK=604800]="WEEK",e[e.DAY=86400]="DAY",e[e.HOUR=3600]="HOUR",e[e.MINUTE=60]="MINUTE"}(_p||(_p={})),function(e){e[e.YEAR=31536e6]="YEAR",e[e.MONTH31Days=26784e5]="MONTH31Days",e[e.MONTH30Days=2592e6]="MONTH30Days",e[e.MONTH29Days=25056e5]="MONTH29Days",e[e.MONTH28Days=24192e5]="MONTH28Days",e[e.DAY=864e5]="DAY",e[e.HOUR=36e5]="HOUR",e[e.MINUTE=6e4]="MINUTE",e[e.SECOND=fp]="SECOND"}(gp||(gp={}));const bp=10*gp.SECOND;async function vp(e,t){const a={value:!1},i=t.isRateLimitError??mp;return async function(e,t){const a=new Array(e.length);let i=0;const n=Math.min(t,e.length);return await Promise.allSettled(Array.from({length:n},(async()=>{for(;i<e.length;){const t=i++;a[t]=await e[t]()}}))),a}(e.map(((e,n)=>async()=>{if(a.value)return t.onSkipped(n);try{return await e()}catch(e){return i(e)&&(a.value=!0),t.onError(e,n)}})),t.limit)}const yp={itemId:o.z.number().describe("The ID of the item to be updated"),columnValues:o.z.string().describe('A string containing the new column values for the item following this structure: {\\"column_id\\": \\"value\\",... you can change multiple columns at once, note that for status column you must use nested value with \'label\' as a key and for date column use \'date\' as key} - example: "{\\"text_column_id\\":\\"New text\\", \\"status_column_id\\":{\\"label\\":\\"Done\\"}, \\"date_column_id\\":{\\"date\\":\\"2023-05-25\\"}, \\"phone_id\\":\\"123-456-7890\\", \\"email_id\\":\\"test@example.com\\"}"'),createLabelsIfMissing:o.z.boolean().optional().describe("If true, create missing Status/Dropdown labels when setting those columns. Requires permission to change board structure. Omit or false to only use existing labels.")},Ip={boardId:o.z.number().describe("The ID of the board that contains the item to be updated"),...yp};class wp extends he{constructor(){super(...arguments),this.name="change_item_column_values",this.type=g.WRITE,this.annotations=ue({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. [REQUIRED PRECONDITION]: For board-relation linking tasks, call link_board_items_workflow before using this tool."}getInputSchema(){return this.context?.boardId?yp:Ip}async executeInternal(e){const t={boardId:(this.context?.boardId??e.boardId).toString(),itemId:e.itemId.toString(),columnValues:e.columnValues,...void 0!==e.createLabelsIfMissing&&{createLabelsIfMissing:e.createLabelsIfMissing}};let a;try{a=Object.keys(JSON.parse(e.columnValues))}catch(e){throw new pp(`Invalid columnValues JSON: ${e.message}`,"INVALID_COLUMN_VALUES_JSON")}const i=await this.mondayApi.request(Yd,{...t,columnIds:a}),n=i.change_multiple_column_values?.column_values?.reduce(((e,t)=>(e[t.id]=t.value??null,e)),{});return{content:{message:`Item ${i.change_multiple_column_values?.id} successfully updated`,item_id:i.change_multiple_column_values?.id,item_name:i.change_multiple_column_values?.name,item_url:i.change_multiple_column_values?.url,column_values:n}}}}const Tp=Md`
524
+ `;class pp extends Error{constructor(e,t){super(e),this.name="ToolValidationError",this.code=t}}function lp(e,t){if(e instanceof pp)throw e;const a=e?.response?.errors?.map((e=>{const{code:t,error_data:a}=e.extensions??{},i=Object.fromEntries(Object.entries({code:t,error_data:a}).filter((([,e])=>void 0!==e)));return Object.keys(i).length>0?`${e.message} (details: ${JSON.stringify(i)})`:e.message}))?.join(", ");if(a){const i=new Error(`Failed to ${t}: ${a}`);throw i.response=e.response,i}const i=e instanceof Error?e.message:"Unknown error";throw new Error(`Failed to ${t}: ${i}`)}function cp(e){if(e instanceof Error&&"AbortError"===e.name)throw new Error("Search has timed out, try providing alternative search term")}function mp(e){const t=e?.response;return 429===t?.status}const up={query:o.z.string().describe("Custom GraphQL query/mutation. you need to provide the full query / mutation"),variables:o.z.string().describe("JSON string containing the variables for the GraphQL operation")};class hp extends he{constructor(e,t){super(e,t),this.name="all_monday_api",this.type=g.ALL_API,this.annotations=ue({title:"Run Query or Mutation on any monday.com API",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1})}getDescription(){return"Execute any monday.com API operation by generating GraphQL queries and mutations dynamically. Make sure you ask only for the fields you need and nothing more. When providing the query/mutation - use get_graphql_schema and get_type_details tools first to understand the schema before crafting your query."}getInputSchema(){return up}async loadSchema(e){if(hp.schemaCache[e])return hp.schemaCache[e];try{const t=await this.mondayApi.rawRequest(tp),{data:a}=t,i=vn(a);return hp.schemaCache[e]=i,i}catch(e){throw new Error(`Failed to load GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`)}}countGraphqlOperations(e){const t={},a={};for(const i of e.definitions){if("OperationDefinition"!==i.kind)continue;const e=i.operation===ke.MUTATION?a:i.operation===ke.QUERY?t:null;if(e)for(const t of i.selectionSet.selections){if("Field"!==t.kind)continue;const a=t.name.value;e[a]=(e[a]??0)+1}}return{graphql_queries:t,graphql_mutations:a}}recordGraphqlOperationCounts(e){const{graphql_queries:t,graphql_mutations:a}=this.countGraphqlOperations(e);this.sessionContext.metadata??={},this.sessionContext.metadata.graphql_queries=t,this.sessionContext.metadata.graphql_mutations=a}async validateOperation(e,t){return gn(await this.loadSchema(t),e).map((e=>e.message))}async executeInternal(e){const{query:t,variables:a}=e;let i={};try{i=JSON.parse(a)}catch(e){throw new Error(`Error parsing variables: ${e instanceof Error?e.message:"Unknown error"}`)}const n=lt(t);this.recordGraphqlOperationCounts(n);const o=await this.validateOperation(n,this.context?.apiVersion??z);if(o.length>0)throw new Error(o.join(", "));try{return{content:await this.mondayApi.request(t,i)}}catch(e){lp(e,"execute GraphQL operation")}}}hp.schemaCache={};const fp=1e3;var _p,gp;!function(e){e[e.YEAR=31536e3]="YEAR",e[e.MONTH31Days=2678400]="MONTH31Days",e[e.MONTH30Days=2592e3]="MONTH30Days",e[e.MONTH29Days=2505600]="MONTH29Days",e[e.MONTH28Days=2419200]="MONTH28Days",e[e.WEEK=604800]="WEEK",e[e.DAY=86400]="DAY",e[e.HOUR=3600]="HOUR",e[e.MINUTE=60]="MINUTE"}(_p||(_p={})),function(e){e[e.YEAR=31536e6]="YEAR",e[e.MONTH31Days=26784e5]="MONTH31Days",e[e.MONTH30Days=2592e6]="MONTH30Days",e[e.MONTH29Days=25056e5]="MONTH29Days",e[e.MONTH28Days=24192e5]="MONTH28Days",e[e.DAY=864e5]="DAY",e[e.HOUR=36e5]="HOUR",e[e.MINUTE=6e4]="MINUTE",e[e.SECOND=fp]="SECOND"}(gp||(gp={}));const bp=10*gp.SECOND;async function vp(e,t){const a={value:!1},i=t.isRateLimitError??mp;return async function(e,t){const a=new Array(e.length);let i=0;const n=Math.min(t,e.length);return await Promise.allSettled(Array.from({length:n},(async()=>{for(;i<e.length;){const t=i++;a[t]=await e[t]()}}))),a}(e.map(((e,n)=>async()=>{if(a.value)return t.onSkipped(n);try{return await e()}catch(e){return i(e)&&(a.value=!0),t.onError(e,n)}})),t.limit)}const yp={itemId:o.z.number().describe("The ID of the item to be updated"),columnValues:o.z.string().describe('A string containing the new column values for the item following this structure: {\\"column_id\\": \\"value\\",... you can change multiple columns at once, note that for status column you must use nested value with \'label\' as a key and for date column use \'date\' as key} - example: "{\\"text_column_id\\":\\"New text\\", \\"status_column_id\\":{\\"label\\":\\"Done\\"}, \\"date_column_id\\":{\\"date\\":\\"2023-05-25\\"}, \\"phone_id\\":\\"123-456-7890\\", \\"email_id\\":\\"test@example.com\\"}"'),createLabelsIfMissing:o.z.boolean().optional().describe("If true, create missing Status/Dropdown labels when setting those columns. Requires permission to change board structure. Omit or false to only use existing labels.")},Ip={boardId:o.z.number().describe("The ID of the board that contains the item to be updated"),...yp};class wp extends he{constructor(){super(...arguments),this.name="change_item_column_values",this.type=g.WRITE,this.annotations=ue({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. [REQUIRED PRECONDITION]: For board-relation linking tasks, call link_board_items_workflow before using this tool."}getInputSchema(){return this.context?.boardId?yp:Ip}async executeInternal(e){const t={boardId:(this.context?.boardId??e.boardId).toString(),itemId:e.itemId.toString(),columnValues:e.columnValues,...void 0!==e.createLabelsIfMissing&&{createLabelsIfMissing:e.createLabelsIfMissing}};let a;try{a=Object.keys(JSON.parse(e.columnValues))}catch(e){throw new pp(`Invalid columnValues JSON: ${e.message}`,"INVALID_COLUMN_VALUES_JSON")}const i=await this.mondayApi.request(Yd,{...t,columnIds:a}),n=i.change_multiple_column_values?.column_values?.reduce(((e,t)=>(e[t.id]=t.value??null,e)),{});return{content:{message:`Item ${i.change_multiple_column_values?.id} successfully updated`,item_id:i.change_multiple_column_values?.id,item_name:i.change_multiple_column_values?.name,item_url:i.change_multiple_column_values?.url,column_values:n}}}}const Tp=Md`
525
525
  query GetObjectSchemas($ids: [ID!], $names: [String!], $limit: Int, $page: Int, $excludeCreatedByMonday: Boolean) {
526
526
  get_object_schemas(ids: $ids, names: $names, limit: $limit, page: $page, exclude_created_by_monday: $excludeCreatedByMonday) {
527
527
  id
@@ -2123,7 +2123,7 @@
2123
2123
  }
2124
2124
  }
2125
2125
  }
2126
- `,Zh=e=>e.toLocaleLowerCase().replace(/[^\p{L}\d]/gu,""),ef={searchTerm:o.z.string().min(1).describe("The search term to use."),searchType:o.z.preprocess((e=>"string"==typeof e?Cm[e.toUpperCase()]??e.toUpperCase():e),o.z.nativeEnum(km)).describe("The type of search to perform. Valid values: BOARD, DOCUMENTS, FOLDERS, WORKSPACES, UPDATES, ITEMS, TIMELINE_ITEMS."),limit:o.z.preprocess((e=>"number"==typeof e&&e>20?20:e),o.z.number()).optional().default(20).describe("The number of items to get. Maximum is 20."),workspaceIds:o.z.array(o.z.number()).optional().describe("Array of workspace IDs (numbers) to search in. Required for FOLDERS search. For BOARD and DOCUMENTS search, only pass this if the user explicitly asked to search within specific workspaces. Example: [12345, 67890]."),boardIds:o.z.array(o.z.number()).optional().describe("Array of board IDs (numbers) to scope the search to. Only applies to UPDATES search, and only pass it if the user explicitly asked to search within specific boards. Example: [12345, 67890]."),creatorIds:o.z.array(o.z.number()).optional().describe("Array of user IDs (numbers) whose updates to search. Only applies to UPDATES search, and only pass it if the user explicitly asked to search updates by specific authors. Example: [12345, 67890].")};const tf=o.z.object({id:o.z.string().describe("The ID of the entity to mention"),type:o.z.nativeEnum(br).describe("The type of mention: User, Team, Board, or Project")}),af=o.z.array(tf),nf={itemId:o.z.number().describe("The id of the item to which the update will be added"),body:o.z.string().describe("The update text to be created. Do not use @ to mention users, use the mentionsList field instead."),mentionsList:o.z.string().optional().describe('Optional JSON array of mentions in the format: [{"id": "123", "type": "User"}, {"id": "456", "type": "Team"}]. Valid types are: User, Team, Board, Project')};const of=Md`
2126
+ `,Zh=e=>e.toLocaleLowerCase().replace(/[^\p{L}\d]/gu,""),ef={searchTerm:o.z.string().trim().min(1,{message:"searchTerm must be a non-empty search string."}).describe("The non-empty term to search for (at least one non-whitespace character)."),searchType:o.z.preprocess((e=>"string"==typeof e?Cm[e.toUpperCase()]??e.toUpperCase():e),o.z.nativeEnum(km)).describe("The type of search to perform. Valid values: BOARD, DOCUMENTS, FOLDERS, WORKSPACES, UPDATES, ITEMS, TIMELINE_ITEMS."),limit:o.z.preprocess((e=>"number"==typeof e&&e>20?20:e),o.z.number()).optional().default(20).describe("The number of items to get. Maximum is 20."),workspaceIds:o.z.array(o.z.number()).optional().describe("Array of workspace IDs (numbers) to search in. Required for FOLDERS search. For BOARD and DOCUMENTS search, only pass this if the user explicitly asked to search within specific workspaces. Example: [12345, 67890]."),boardIds:o.z.array(o.z.number()).optional().describe("Array of board IDs (numbers) to scope the search to. Only applies to UPDATES search, and only pass it if the user explicitly asked to search within specific boards. Example: [12345, 67890]."),creatorIds:o.z.array(o.z.number()).optional().describe("Array of user IDs (numbers) whose updates to search. Only applies to UPDATES search, and only pass it if the user explicitly asked to search updates by specific authors. Example: [12345, 67890].")};const tf=o.z.object({id:o.z.string().describe("The ID of the entity to mention"),type:o.z.nativeEnum(br).describe("The type of mention: User, Team, Board, or Project")}),af=o.z.array(tf),nf={itemId:o.z.number().describe("The id of the item to which the update will be added"),body:o.z.string().describe("The update text to be created. Do not use @ to mention users, use the mentionsList field instead."),mentionsList:o.z.string().optional().describe('Optional JSON array of mentions in the format: [{"id": "123", "type": "User"}, {"id": "456", "type": "Team"}]. Valid types are: User, Team, Board, Project')};const of=Md`
2127
2127
  mutation updateAssetsOnItem($boardId: ID!, $itemId: ID!, $columnId: String!, $files: [FileInput!]!) {
2128
2128
  update_assets_on_item(board_id: $boardId, item_id: $itemId, column_id: $columnId, files: $files) {
2129
2129
  id