@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.
- package/dist/cjs/core/index.js +1 -1
- package/dist/cjs/core/index.js.map +1 -1
- package/dist/cjs/mcp/index.js +1 -1
- package/dist/cjs/mcp/index.js.map +1 -1
- package/dist/cjs/openai/index.js +1 -1
- package/dist/cjs/openai/index.js.map +1 -1
- package/dist/esm/core/index.js +1 -1
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/mcp/index.js +1 -1
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/openai/index.js +1 -1
- package/dist/esm/openai/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/openai/index.js
CHANGED
|
@@ -525,7 +525,7 @@ import{ApiClient as e}from"@mondaydotcomorg/api";import t from"axios";import a f
|
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
|
-
`,yc="TOOL_EXECUTION_FAILED",vc="INVALID_OPERATION_TYPE",Ic="EMPTY_API_RESPONSE",Ec="MISSING_REQUIRED_PARAMETER";class Tc extends Error{constructor(e,t,a){super(e),this.name="ToolValidationError",this.code=t,this.errors=a}}function wc(e,t){if(e instanceof Tc)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 Tc(`Failed to ${t}: ${n}`,yc)}function Ac(e){if(e instanceof Error&&"AbortError"===e.name)throw new Tc("Search has timed out, try providing alternative search term","SEARCH_TIMEOUT")}function Sc(e){const t=e?.response;return 429===t?.status}function Nc(t){if(!(t instanceof e))return t;const{token:a,defaultApiVersion:n,defaultEndpoint:i,requestConfig:o}=t;return new e({token:a,apiVersion:n,endpoint:i,requestConfig:{...o,headers:{...o?.headers,"x-api-schema":"public"}}})}const Dc={query:n.string().describe("Custom GraphQL query/mutation. you need to provide the full query / mutation"),variables:n.string().describe("JSON string containing the variables for the GraphQL operation")};class Oc extends te{constructor(e,t){super("function"==typeof e?()=>Nc(e()):Nc(e),t),this.name="all_monday_api",this.type=f.ALL_API,this.annotations=ee({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 Dc}async loadSchema(e){if(Oc.schemaCache[e])return Oc.schemaCache[e];try{const t=await this.mondayApi.rawRequest(cc),{data:a}=t,n=ri(a);return Oc.schemaCache[e]=n,n}catch(e){throw new Tc(`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===ge.MUTATION?a:n.operation===ge.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 ii(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 Tc(`Error parsing variables: ${e instanceof Error?e.message:"Unknown error"}`,"INVALID_VARIABLES_JSON")}const i=Je(t);this.recordGraphqlOperationCounts(i);const o=await this.validateOperation(i,this.context?.apiVersion??O);if(o.length>0)throw new Tc(o.join(", "),"GRAPHQL_VALIDATION_FAILED");try{return{content:await this.mondayApi.request(t,n)}}catch(e){wc(e,"execute GraphQL operation")}}}Oc.schemaCache={};const Rc=1e3;var Cc,kc;!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"}(Cc||(Cc={})),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=Rc]="SECOND"}(kc||(kc={}));const Lc=10*kc.SECOND;async function Uc(e,t){const a={value:!1},n=t.isRateLimitError??Sc;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 Pc='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"}}',$c=e=>{try{const t=JSON.parse(e);return"string"==typeof t?t:e}catch{return e}},xc={itemId:n.number().describe("The ID of the item to be updated"),columnValues:n.string().describe(`The new column values for the item. Multiple columns can be changed at once. ${Pc}`),createLabelsIfMissing:n.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.")},Mc={boardId:n.number().describe("The ID of the board that contains the item to be updated"),...xc};class Vc extends te{constructor(){super(...arguments),this.name="change_item_column_values",this.type=f.WRITE,this.annotations=ee({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?xc:Mc}async executeInternal(e){const t=this.context?.boardId??e.boardId,a=$c(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 Tc(`Invalid columnValues JSON: ${e.message}`,"INVALID_COLUMN_VALUES_JSON")}if(null===i||"object"!=typeof i||Array.isArray(i))throw new Tc("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(ic,{...n,columnIds:o})}catch(e){wc(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 Fc=n.object({itemId:n.number().describe("The id of the item to update."),columnValues:n.string().describe(`The new column values for this item, keyed by column id. To change the item name include a "name" key. ${Pc}`),boardId:n.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.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.")}),Bc={updates:n.array(Fc).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.")},qc={boardId:n.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."),...Bc};function jc(e,t){if(e instanceof Tc)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 Gc=zl`
|
|
528
|
+
`,yc="TOOL_EXECUTION_FAILED",vc="INVALID_OPERATION_TYPE",Ic="EMPTY_API_RESPONSE",Ec="MISSING_REQUIRED_PARAMETER";class Tc extends Error{constructor(e,t,a){super(e),this.name="ToolValidationError",this.code=t,this.errors=a}}function wc(e,t){if(e instanceof Tc)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 Tc(`Failed to ${t}: ${n}`,yc)}function Ac(e){if(e instanceof Error&&"AbortError"===e.name)throw new Tc("Search has timed out, try providing alternative search term","SEARCH_TIMEOUT")}function Sc(e){const t=e?.response;return 429===t?.status}function Nc(t){if(!(t instanceof e))return t;const{token:a,defaultApiVersion:n,defaultEndpoint:i,requestConfig:o}=t;return new e({token:a,apiVersion:n,endpoint:i,requestConfig:{...o,headers:{...o?.headers,"x-api-schema":"public"}}})}const Dc={query:n.string().describe("Custom GraphQL query/mutation. you need to provide the full query / mutation"),variables:n.string().default("{}").describe("JSON string containing the variables for the GraphQL operation")};class Oc extends te{constructor(e,t){super("function"==typeof e?()=>Nc(e()):Nc(e),t),this.name="all_monday_api",this.type=f.ALL_API,this.annotations=ee({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 Dc}async loadSchema(e){if(Oc.schemaCache[e])return Oc.schemaCache[e];try{const t=await this.mondayApi.rawRequest(cc),{data:a}=t,n=ri(a);return Oc.schemaCache[e]=n,n}catch(e){throw new Tc(`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===ge.MUTATION?a:n.operation===ge.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 ii(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 Tc(`Error parsing variables: ${e instanceof Error?e.message:"Unknown error"}`,"INVALID_VARIABLES_JSON")}const i=Je(t);this.recordGraphqlOperationCounts(i);const o=await this.validateOperation(i,this.context?.apiVersion??O);if(o.length>0)throw new Tc(o.join(", "),"GRAPHQL_VALIDATION_FAILED");try{return{content:await this.mondayApi.request(t,n)}}catch(e){wc(e,"execute GraphQL operation")}}}Oc.schemaCache={};const Rc=1e3;var Cc,kc;!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"}(Cc||(Cc={})),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=Rc]="SECOND"}(kc||(kc={}));const Lc=10*kc.SECOND;async function Uc(e,t){const a={value:!1},n=t.isRateLimitError??Sc;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 Pc='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"}}',$c=e=>{try{const t=JSON.parse(e);return"string"==typeof t?t:e}catch{return e}},xc={itemId:n.number().describe("The ID of the item to be updated"),columnValues:n.string().describe(`The new column values for the item. Multiple columns can be changed at once. ${Pc}`),createLabelsIfMissing:n.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.")},Mc={boardId:n.number().describe("The ID of the board that contains the item to be updated"),...xc};class Vc extends te{constructor(){super(...arguments),this.name="change_item_column_values",this.type=f.WRITE,this.annotations=ee({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?xc:Mc}async executeInternal(e){const t=this.context?.boardId??e.boardId,a=$c(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 Tc(`Invalid columnValues JSON: ${e.message}`,"INVALID_COLUMN_VALUES_JSON")}if(null===i||"object"!=typeof i||Array.isArray(i))throw new Tc("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(ic,{...n,columnIds:o})}catch(e){wc(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 Fc=n.object({itemId:n.number().describe("The id of the item to update."),columnValues:n.string().describe(`The new column values for this item, keyed by column id. To change the item name include a "name" key. ${Pc}`),boardId:n.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.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.")}),Bc={updates:n.array(Fc).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.")},qc={boardId:n.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."),...Bc};function jc(e,t){if(e instanceof Tc)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 Gc=zl`
|
|
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
|