@mondaydotcomorg/agent-toolkit 5.71.7 → 5.71.8

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.
@@ -525,7 +525,7 @@
525
525
  }
526
526
  }
527
527
  }
528
- `,Oc="TOOL_EXECUTION_FAILED",Rc="INVALID_OPERATION_TYPE",Cc="EMPTY_API_RESPONSE",kc="MISSING_REQUIRED_PARAMETER";class Lc extends Error{constructor(e,t,a){super(e),this.name="ToolValidationError",this.code=t,this.errors=a}}function Uc(e,t){if(e instanceof Lc)throw e;const a=e?.response?.errors?.map((e=>{const{code:t,error_data:a}=e.extensions??{},n=Object.fromEntries(Object.entries({code:t,error_data:a}).filter((([,e])=>void 0!==e)));return Object.keys(n).length>0?`${e.message} (details: ${JSON.stringify(n)})`:e.message}))?.join(", ");if(a){const n=new Error(`Failed to ${t}: ${a}`);throw n.response=e.response,n}const n=e instanceof Error?e.message:"Unknown error";throw new Lc(`Failed to ${t}: ${n}`,Oc)}function Pc(e){if(e instanceof Error&&"AbortError"===e.name)throw new Lc("Search has timed out, try providing alternative search term","SEARCH_TIMEOUT")}function $c(e){const t=e?.response;return 429===t?.status}function xc(t){if(!(t instanceof e.ApiClient))return t;const{token:a,defaultApiVersion:n,defaultEndpoint:i,requestConfig:o}=t;return new e.ApiClient({token:a,apiVersion:n,endpoint:i,requestConfig:{...o,headers:{...o?.headers,"x-api-schema":"public"}}})}const Mc={query:n.z.string().describe("Custom GraphQL query/mutation. you need to provide the full query / mutation"),variables:n.z.string().describe("JSON string containing the variables for the GraphQL operation")};class Vc extends ce{constructor(e,t){super("function"==typeof e?()=>xc(e()):xc(e),t),this.name="all_monday_api",this.type=f.ALL_API,this.annotations=le({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 Mc}async loadSchema(e){if(Vc.schemaCache[e])return Vc.schemaCache[e];try{const t=await this.mondayApi.rawRequest(Ic),{data:a}=t,n=fi(a);return Vc.schemaCache[e]=n,n}catch(e){throw new Lc(`Failed to load GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`,"GRAPHQL_SCHEMA_LOAD_FAILED")}}countGraphqlOperations(e){const t={},a={};for(const n of e.definitions){if("OperationDefinition"!==n.kind)continue;const e=n.operation===Ne.MUTATION?a:n.operation===Ne.QUERY?t:null;if(e)for(const t of n.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 hi(await this.loadSchema(t),e).map((e=>e.message))}async executeInternal(e){const{query:t,variables:a}=e;let n={};try{n=JSON.parse(a)}catch(e){throw new Lc(`Error parsing variables: ${e instanceof Error?e.message:"Unknown error"}`,"INVALID_VARIABLES_JSON")}const i=st(t);this.recordGraphqlOperationCounts(i);const o=await this.validateOperation(i,this.context?.apiVersion??V);if(o.length>0)throw new Lc(o.join(", "),"GRAPHQL_VALIDATION_FAILED");try{return{content:await this.mondayApi.request(t,n)}}catch(e){Uc(e,"execute GraphQL operation")}}}Vc.schemaCache={};const Fc=1e3;var Bc,zc;!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"}(Bc||(Bc={})),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=Fc]="SECOND"}(zc||(zc={}));const qc=10*zc.SECOND;async function jc(e,t){const a={value:!1},n=t.isRateLimitError??$c;return async function(e,t){const a=new Array(e.length);let n=0;const i=Math.min(t,e.length);return await Promise.allSettled(Array.from({length:i},(async()=>{for(;n<e.length;){const t=n++;a[t]=await e[t]()}}))),a}(e.map(((e,i)=>async()=>{if(a.value)return t.onSkipped(i);try{return await e()}catch(e){return n(e)&&(a.value=!0),t.onError(e,i)}})),t.limit)}const Gc='Pass a JSON object serialized once as a string, keyed by column id — not a JSON string of a JSON string. Column ids and labels must come from get_board_info for this board, people ids from list_users_and_teams, never guessed. Formats by column type: text and numbers: "value". long_text: {"text": "..."}. status: {"label": "Done"} or {"index": 1}, and the label must already exist unless createLabelsIfMissing is true. dropdown: {"labels": ["A"]} or {"ids": [1]} — always an array, even for one value. date: {"date": "YYYY-MM-DD"}. timeline: {"from": "YYYY-MM-DD", "to": "YYYY-MM-DD"}. people: {"personsAndTeams": [{"id": 123, "kind": "person"}]}, where kind is "person" or "team". board_relation: {"item_ids": [123]}. tags: {"tag_ids": [123]}. checkbox: {"checked": "true"}. link: {"url": "https://...", "text": "..."}. location: {"lat": "40.7", "lng": "-74.0", "address": "..."}, lat and lng are required strings, an address alone fails. email: {"email": "a@b.com", "text": "a@b.com"}. phone: {"phone": "+12125551234", "countryShortName": "US"}, digits only with an optional leading + and no spaces or dashes, uppercase ISO-2 country code. Plain strings fail for email and phone. null clears a column. Example: {"text_col": "New text", "status_col": {"label": "Done"}, "dropdown_col": {"labels": ["A"]}, "date_col": {"date": "2023-05-25"}}',Hc=e=>{try{const t=JSON.parse(e);return"string"==typeof t?t:e}catch{return e}},Wc={itemId:n.z.number().describe("The ID of the item to be updated"),columnValues:n.z.string().describe(`The new column values for the item. Multiple columns can be changed at once. ${Gc}`),createLabelsIfMissing:n.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.")},Yc={boardId:n.z.number().describe("The ID of the board that contains the item to be updated"),...Wc};class Kc extends ce{constructor(){super(...arguments),this.name="change_item_column_values",this.type=f.WRITE,this.annotations=le({title:"Change Item Column Values",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Change the column values of a single item on a monday.com board. [IMPORTANT] If you need to update multiple items in one call, use update_items instead of calling this tool in a loop. Otherwise: change the column values of a single item in a monday.com board. [REQUIRED PRECONDITION]: Before using this tool, if new columns were added to the board or if you are not familiar with the board's structure (column IDs, column types, status labels, etc.), first use get_board_info with filters.columns.only to get column metadata without fetching views. This is essential for constructing valid column values. For board-relation linking tasks, call link_board_items_workflow before using this tool."}getInputSchema(){return this.context?.boardId?Wc:Yc}async executeInternal(e){const t=this.context?.boardId??e.boardId,a=Hc(e.columnValues),n={boardId:t.toString(),itemId:e.itemId.toString(),columnValues:a,...void 0!==e.createLabelsIfMissing&&{createLabelsIfMissing:e.createLabelsIfMissing}};let i;try{i=JSON.parse(a)}catch(e){throw new Lc(`Invalid columnValues JSON: ${e.message}`,"INVALID_COLUMN_VALUES_JSON")}if(null===i||"object"!=typeof i||Array.isArray(i))throw new Lc("Invalid columnValues JSON: expected a JSON object keyed by column id","INVALID_COLUMN_VALUES_JSON");const o=Object.keys(i);let r;try{r=await this.mondayApi.request(hc,{...n,columnIds:o})}catch(e){Uc(e,"change column values")}const s=r.change_multiple_column_values?.column_values?.reduce(((e,t)=>(e[t.id]=t.value??null,e)),{});return{content:{message:`Item ${r.change_multiple_column_values?.id} successfully updated`,item_id:r.change_multiple_column_values?.id,item_name:r.change_multiple_column_values?.name,item_url:r.change_multiple_column_values?.url,column_values:s}}}}const Qc=n.z.object({itemId:n.z.number().describe("The id of the item to update."),columnValues:n.z.string().describe(`The new column values for this item, keyed by column id. To change the item name include a "name" key. ${Gc}`),boardId:n.z.number().optional().describe("Optional. The id of the board that contains this item. Provide it when this update targets a board other than the batch default or the board in context. When omitted, the batch boardId or the board in context is used."),createLabelsIfMissing:n.z.boolean().optional().describe("When true, missing status or dropdown labels referenced in this update columnValues are auto-created on the board instead of erroring with ColumnValueException. Requires permission to change board structure.")}),Jc={updates:n.z.array(Qc).min(1,"updates must not be empty").max(40,"updates must not exceed 40 per call").describe("The item updates to apply, up to 40 per call. Each entry updates one item and returns its own result on success or a raw error message on failure. Each entry independently chooses its boardId, columnValues, and createLabelsIfMissing.")},Xc={boardId:n.z.number().optional().describe("Optional default board id used for any update that does not set its own boardId. Each update can override it with its own boardId, so a single call can span multiple boards."),...Jc};function Zc(e,t){if(e instanceof Lc)return{code:e.code,message:e.message,path:["results",t]};const a=e?.response?.errors?.[0],n=e instanceof Error?e.message:String(e),i=a?.extensions??{};return{...i,code:i.code??"GRAPHQL_ERROR",message:a?.message??n,path:["results",t]}}const em=rc`
528
+ `,Oc="TOOL_EXECUTION_FAILED",Rc="INVALID_OPERATION_TYPE",Cc="EMPTY_API_RESPONSE",kc="MISSING_REQUIRED_PARAMETER";class Lc extends Error{constructor(e,t,a){super(e),this.name="ToolValidationError",this.code=t,this.errors=a}}function Uc(e,t){if(e instanceof Lc)throw e;const a=e?.response?.errors?.map((e=>{const{code:t,error_data:a}=e.extensions??{},n=Object.fromEntries(Object.entries({code:t,error_data:a}).filter((([,e])=>void 0!==e)));return Object.keys(n).length>0?`${e.message} (details: ${JSON.stringify(n)})`:e.message}))?.join(", ");if(a){const n=new Error(`Failed to ${t}: ${a}`);throw n.response=e.response,n}const n=e instanceof Error?e.message:"Unknown error";throw new Lc(`Failed to ${t}: ${n}`,Oc)}function Pc(e){if(e instanceof Error&&"AbortError"===e.name)throw new Lc("Search has timed out, try providing alternative search term","SEARCH_TIMEOUT")}function $c(e){const t=e?.response;return 429===t?.status}function xc(t){if(!(t instanceof e.ApiClient))return t;const{token:a,defaultApiVersion:n,defaultEndpoint:i,requestConfig:o}=t;return new e.ApiClient({token:a,apiVersion:n,endpoint:i,requestConfig:{...o,headers:{...o?.headers,"x-api-schema":"public"}}})}const Mc={query:n.z.string().describe("Custom GraphQL query/mutation. you need to provide the full query / mutation"),variables:n.z.string().default("{}").describe("JSON string containing the variables for the GraphQL operation")};class Vc extends ce{constructor(e,t){super("function"==typeof e?()=>xc(e()):xc(e),t),this.name="all_monday_api",this.type=f.ALL_API,this.annotations=le({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 Mc}async loadSchema(e){if(Vc.schemaCache[e])return Vc.schemaCache[e];try{const t=await this.mondayApi.rawRequest(Ic),{data:a}=t,n=fi(a);return Vc.schemaCache[e]=n,n}catch(e){throw new Lc(`Failed to load GraphQL schema: ${e instanceof Error?e.message:"Unknown error"}`,"GRAPHQL_SCHEMA_LOAD_FAILED")}}countGraphqlOperations(e){const t={},a={};for(const n of e.definitions){if("OperationDefinition"!==n.kind)continue;const e=n.operation===Ne.MUTATION?a:n.operation===Ne.QUERY?t:null;if(e)for(const t of n.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 hi(await this.loadSchema(t),e).map((e=>e.message))}async executeInternal(e){const{query:t,variables:a}=e;let n={};try{n=JSON.parse(a)}catch(e){throw new Lc(`Error parsing variables: ${e instanceof Error?e.message:"Unknown error"}`,"INVALID_VARIABLES_JSON")}const i=st(t);this.recordGraphqlOperationCounts(i);const o=await this.validateOperation(i,this.context?.apiVersion??V);if(o.length>0)throw new Lc(o.join(", "),"GRAPHQL_VALIDATION_FAILED");try{return{content:await this.mondayApi.request(t,n)}}catch(e){Uc(e,"execute GraphQL operation")}}}Vc.schemaCache={};const Fc=1e3;var Bc,zc;!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"}(Bc||(Bc={})),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=Fc]="SECOND"}(zc||(zc={}));const qc=10*zc.SECOND;async function jc(e,t){const a={value:!1},n=t.isRateLimitError??$c;return async function(e,t){const a=new Array(e.length);let n=0;const i=Math.min(t,e.length);return await Promise.allSettled(Array.from({length:i},(async()=>{for(;n<e.length;){const t=n++;a[t]=await e[t]()}}))),a}(e.map(((e,i)=>async()=>{if(a.value)return t.onSkipped(i);try{return await e()}catch(e){return n(e)&&(a.value=!0),t.onError(e,i)}})),t.limit)}const Gc='Pass a JSON object serialized once as a string, keyed by column id — not a JSON string of a JSON string. Column ids and labels must come from get_board_info for this board, people ids from list_users_and_teams, never guessed. Formats by column type: text and numbers: "value". long_text: {"text": "..."}. status: {"label": "Done"} or {"index": 1}, and the label must already exist unless createLabelsIfMissing is true. dropdown: {"labels": ["A"]} or {"ids": [1]} — always an array, even for one value. date: {"date": "YYYY-MM-DD"}. timeline: {"from": "YYYY-MM-DD", "to": "YYYY-MM-DD"}. people: {"personsAndTeams": [{"id": 123, "kind": "person"}]}, where kind is "person" or "team". board_relation: {"item_ids": [123]}. tags: {"tag_ids": [123]}. checkbox: {"checked": "true"}. link: {"url": "https://...", "text": "..."}. location: {"lat": "40.7", "lng": "-74.0", "address": "..."}, lat and lng are required strings, an address alone fails. email: {"email": "a@b.com", "text": "a@b.com"}. phone: {"phone": "+12125551234", "countryShortName": "US"}, digits only with an optional leading + and no spaces or dashes, uppercase ISO-2 country code. Plain strings fail for email and phone. null clears a column. Example: {"text_col": "New text", "status_col": {"label": "Done"}, "dropdown_col": {"labels": ["A"]}, "date_col": {"date": "2023-05-25"}}',Hc=e=>{try{const t=JSON.parse(e);return"string"==typeof t?t:e}catch{return e}},Wc={itemId:n.z.number().describe("The ID of the item to be updated"),columnValues:n.z.string().describe(`The new column values for the item. Multiple columns can be changed at once. ${Gc}`),createLabelsIfMissing:n.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.")},Yc={boardId:n.z.number().describe("The ID of the board that contains the item to be updated"),...Wc};class Kc extends ce{constructor(){super(...arguments),this.name="change_item_column_values",this.type=f.WRITE,this.annotations=le({title:"Change Item Column Values",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0})}getDescription(){return"Change the column values of a single item on a monday.com board. [IMPORTANT] If you need to update multiple items in one call, use update_items instead of calling this tool in a loop. Otherwise: change the column values of a single item in a monday.com board. [REQUIRED PRECONDITION]: Before using this tool, if new columns were added to the board or if you are not familiar with the board's structure (column IDs, column types, status labels, etc.), first use get_board_info with filters.columns.only to get column metadata without fetching views. This is essential for constructing valid column values. For board-relation linking tasks, call link_board_items_workflow before using this tool."}getInputSchema(){return this.context?.boardId?Wc:Yc}async executeInternal(e){const t=this.context?.boardId??e.boardId,a=Hc(e.columnValues),n={boardId:t.toString(),itemId:e.itemId.toString(),columnValues:a,...void 0!==e.createLabelsIfMissing&&{createLabelsIfMissing:e.createLabelsIfMissing}};let i;try{i=JSON.parse(a)}catch(e){throw new Lc(`Invalid columnValues JSON: ${e.message}`,"INVALID_COLUMN_VALUES_JSON")}if(null===i||"object"!=typeof i||Array.isArray(i))throw new Lc("Invalid columnValues JSON: expected a JSON object keyed by column id","INVALID_COLUMN_VALUES_JSON");const o=Object.keys(i);let r;try{r=await this.mondayApi.request(hc,{...n,columnIds:o})}catch(e){Uc(e,"change column values")}const s=r.change_multiple_column_values?.column_values?.reduce(((e,t)=>(e[t.id]=t.value??null,e)),{});return{content:{message:`Item ${r.change_multiple_column_values?.id} successfully updated`,item_id:r.change_multiple_column_values?.id,item_name:r.change_multiple_column_values?.name,item_url:r.change_multiple_column_values?.url,column_values:s}}}}const Qc=n.z.object({itemId:n.z.number().describe("The id of the item to update."),columnValues:n.z.string().describe(`The new column values for this item, keyed by column id. To change the item name include a "name" key. ${Gc}`),boardId:n.z.number().optional().describe("Optional. The id of the board that contains this item. Provide it when this update targets a board other than the batch default or the board in context. When omitted, the batch boardId or the board in context is used."),createLabelsIfMissing:n.z.boolean().optional().describe("When true, missing status or dropdown labels referenced in this update columnValues are auto-created on the board instead of erroring with ColumnValueException. Requires permission to change board structure.")}),Jc={updates:n.z.array(Qc).min(1,"updates must not be empty").max(40,"updates must not exceed 40 per call").describe("The item updates to apply, up to 40 per call. Each entry updates one item and returns its own result on success or a raw error message on failure. Each entry independently chooses its boardId, columnValues, and createLabelsIfMissing.")},Xc={boardId:n.z.number().optional().describe("Optional default board id used for any update that does not set its own boardId. Each update can override it with its own boardId, so a single call can span multiple boards."),...Jc};function Zc(e,t){if(e instanceof Lc)return{code:e.code,message:e.message,path:["results",t]};const a=e?.response?.errors?.[0],n=e instanceof Error?e.message:String(e),i=a?.extensions??{};return{...i,code:i.code??"GRAPHQL_ERROR",message:a?.message??n,path:["results",t]}}const em=rc`
529
529
  query GetObjectSchemas($ids: [ID!], $names: [String!], $limit: Int, $page: Int, $excludeCreatedByMonday: Boolean) {
530
530
  get_object_schemas(ids: $ids, names: $names, limit: $limit, page: $page, exclude_created_by_monday: $excludeCreatedByMonday) {
531
531
  id