From 584775ca2be3cb6d8228d9d57c7a93bf1249eb5b Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Wed, 27 Aug 2025 11:33:52 +0300 Subject: [PATCH 01/14] feat(agent-toolkit): add createForm mutation and related tools - Introduced CreateFormTool to facilitate form creation. - Added createForm GraphQL mutation to handle form creation requests. - Updated package.json to include @mondaydotcomorg/workforms-contracts dependency. - Enhanced GraphQL types to support the new mutation. --- packages/agent-toolkit/package.json | 1 + .../platform-api-tools/create-form-tool.ts | 60 +++++++++ .../core/tools/platform-api-tools/index.ts | 3 + .../src/monday-graphql/generated/graphql.ts | 16 +++ .../src/monday-graphql/queries.graphql.ts | 29 +++++ yarn.lock | 120 ++++++++++++++++++ 6 files changed, 229 insertions(+) create mode 100644 packages/agent-toolkit/src/core/tools/platform-api-tools/create-form-tool.ts diff --git a/packages/agent-toolkit/package.json b/packages/agent-toolkit/package.json index 6ed26aa3..ce69d157 100644 --- a/packages/agent-toolkit/package.json +++ b/packages/agent-toolkit/package.json @@ -49,6 +49,7 @@ }, "dependencies": { "@mondaydotcomorg/api": "^10.0.5", + "@mondaydotcomorg/workforms-contracts": "^1.26.4", "axios": "^1.10.0", "jsonwebtoken": "^9.0.2", "zod": "^3.24.2", diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/create-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/create-form-tool.ts new file mode 100644 index 00000000..b38ea5ec --- /dev/null +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/create-form-tool.ts @@ -0,0 +1,60 @@ +import { z } from 'zod'; +import { BoardKind, CreateFormMutation, CreateFormMutationVariables } from '../../../monday-graphql/generated/graphql'; +import { createForm } from '../../../monday-graphql/queries.graphql'; +import { ToolInputType, ToolOutputType, ToolType } from '../../tool'; +import { BaseMondayApiTool, createMondayApiAnnotations } from './base-monday-api-tool'; +import { GraphQLDescriptions } from '@mondaydotcomorg/workforms-contracts'; + +export const createFormToolSchema = { + destination_workspace_id: z.number().describe(GraphQLDescriptions.form.args.destinationWorkspaceId), + destination_folder_id: z.number().optional().describe(GraphQLDescriptions.form.args.destinationFolderId), + destination_folder_name: z.string().optional().describe(GraphQLDescriptions.form.args.destinationFolderName), + board_kind: z.nativeEnum(BoardKind).optional().describe(GraphQLDescriptions.form.args.boardKind), + destination_name: z.string().optional().describe(GraphQLDescriptions.form.args.destinationName), + board_owner_ids: z.array(z.number()).optional().describe(GraphQLDescriptions.form.args.boardOwnerIds), + board_owner_team_ids: z.array(z.number()).optional().describe(GraphQLDescriptions.form.args.boardOwnerTeamIds), + board_subscriber_ids: z.array(z.number()).optional().describe(GraphQLDescriptions.form.args.boardSubscriberIds), + board_subscriber_teams_ids: z + .array(z.number()) + .optional() + .describe(GraphQLDescriptions.form.args.boardSubscriberTeamsIds), +}; + +export class CreateFormTool extends BaseMondayApiTool { + name = 'create_form'; + type = ToolType.WRITE; + annotations = createMondayApiAnnotations({ + title: 'Create Form', + readOnlyHint: false, + destructiveHint: false, + idempotentHint: false, + }); + + getDescription(): string { + return 'Create a monday.com form'; + } + + getInputSchema(): typeof createFormToolSchema { + return createFormToolSchema; + } + + protected async executeInternal(input: ToolInputType): Promise> { + const variables: CreateFormMutationVariables = { + destination_workspace_id: input.destination_workspace_id, + destination_folder_id: input.destination_folder_id, + destination_folder_name: input.destination_folder_name, + board_kind: input.board_kind, + destination_name: input.destination_name, + board_owner_ids: input.board_owner_ids, + board_owner_team_ids: input.board_owner_team_ids, + board_subscriber_ids: input.board_subscriber_ids, + board_subscriber_teams_ids: input.board_subscriber_teams_ids, + }; + + const res = await this.mondayApi.request(createForm, variables); + + return { + content: `Form created successfully. Board ID: ${res.create_form?.boardId}, Token: ${res.create_form?.token}`, + }; + } +} diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts index c62cf2be..2287055a 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts @@ -2,6 +2,7 @@ import { AllMondayApiTool } from './all-monday-api-tool'; import { BaseMondayApiToolConstructor } from './base-monday-api-tool'; import { ChangeItemColumnValuesTool } from './change-item-column-values-tool'; import { CreateBoardTool } from './create-board-tool'; +import { CreateFormTool } from './create-form-tool'; import { CreateColumnTool } from './create-column-tool'; import { CreateCustomActivityTool } from './create-custom-activity-tool'; import { CreateItemTool } from './create-item-tool'; @@ -40,6 +41,7 @@ export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [ ChangeItemColumnValuesTool, MoveItemToGroupTool, CreateBoardTool, + CreateFormTool, CreateColumnTool, DeleteColumnTool, AllMondayApiTool, @@ -63,6 +65,7 @@ export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [ export * from './all-monday-api-tool'; export * from './change-item-column-values-tool'; export * from './create-board-tool'; +export * from './create-form-tool'; export * from './create-column-tool'; export * from './create-custom-activity-tool'; export * from './create-item-tool'; diff --git a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts index 7280d03e..bd19d8ae 100644 --- a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts @@ -8444,3 +8444,19 @@ export type GetWorkspaceInfoQueryVariables = Exact<{ export type GetWorkspaceInfoQuery = { __typename?: 'Query', workspaces?: Array<{ __typename?: 'Workspace', id?: string | null, name: string, description?: string | null, kind?: WorkspaceKind | null, created_at?: any | null, state?: State | null, is_default_workspace?: boolean | null, owners_subscribers?: Array<{ __typename?: 'User', id: string, name: string, email: string } | null> | null } | null> | null, boards?: Array<{ __typename?: 'Board', id: string, name: string, board_folder_id?: string | null } | null> | null, docs?: Array<{ __typename?: 'Document', id: string, name: string, doc_folder_id?: string | null } | null> | null, folders?: Array<{ __typename?: 'Folder', id: string, name: string } | null> | null }; + + + +export type CreateFormMutationVariables = Exact<{ + destination_workspace_id: Scalars['Float']['input']; + destination_folder_id?: InputMaybe; + destination_folder_name?: InputMaybe; + board_kind?: InputMaybe; + destination_name?: InputMaybe; + board_owner_ids?: InputMaybe>; + board_owner_team_ids?: InputMaybe>; + board_subscriber_ids?: InputMaybe>; + board_subscriber_teams_ids?: InputMaybe>; +}>; + +export type CreateFormMutation = { __typename?: 'Mutation', create_form?: { __typename?: 'CreateFormResult', boardId: string, token: string }}; diff --git a/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts b/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts index e4f5ce24..ab615f79 100644 --- a/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts @@ -559,3 +559,32 @@ export const getWorkspaceInfo = gql` } } `; + +export const createForm = gql` + mutation createForm( + $destination_workspace_id: Float! + $destination_folder_id: Float + $destination_folder_name: String + $board_kind: BoardKind + $destination_name: String + $board_owner_ids: [Float!] + $board_owner_team_ids: [Float!] + $board_subscriber_ids: [Float!] + $board_subscriber_teams_ids: [Float!] + ) { + create_form( + destination_workspace_id: $destination_workspace_id + destination_folder_id: $destination_folder_id + destination_folder_name: $destination_folder_name + board_kind: $board_kind + destination_name: $destination_name + board_owner_ids: $board_owner_ids + board_owner_team_ids: $board_owner_team_ids + board_subscriber_ids: $board_subscriber_ids + board_subscriber_teams_ids: $board_subscriber_teams_ids + ) { + boardId + token + } + } +`; diff --git a/yarn.lock b/yarn.lock index fb2d031e..71faccce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -823,6 +823,52 @@ resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== +"@hapi/address@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@hapi/address/-/address-5.1.1.tgz#e9925fc1b65f5cc3fbea821f2b980e4652e84cb6" + integrity sha512-A+po2d/dVoY7cYajycYI43ZbYMXukuopIsqCjh5QzsBCipDtdofHntljDlpccMjIfTy6UOkg+5KPriwYch2bXA== + dependencies: + "@hapi/hoek" "^11.0.2" + +"@hapi/formula@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@hapi/formula/-/formula-3.0.2.tgz#81b538060ee079481c906f599906d163c4badeaf" + integrity sha512-hY5YPNXzw1He7s0iqkRQi+uMGh383CGdyyIGYtB+W5N3KHPXoqychklvHhKCC9M3Xtv0OCs/IHw+r4dcHtBYWw== + +"@hapi/hoek@^11.0.2", "@hapi/hoek@^11.0.7": + version "11.0.7" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-11.0.7.tgz#56a920793e0a42d10e530da9a64cc0d3919c4002" + integrity sha512-HV5undWkKzcB4RZUusqOpcgxOaq6VOAH7zhhIr2g3G8NF/MlFO75SjOr2NfuSx0Mh40+1FqCkagKLJRykUWoFQ== + +"@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": + version "9.3.0" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" + integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== + +"@hapi/pinpoint@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@hapi/pinpoint/-/pinpoint-2.0.1.tgz#32077e715655fc00ab8df74b6b416114287d6513" + integrity sha512-EKQmr16tM8s16vTT3cA5L0kZZcTMU5DUOZTuvpnY738m+jyP3JIUj+Mm1xc1rsLkGBQ/gVnfKYPwOmPg1tUR4Q== + +"@hapi/tlds@^1.1.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@hapi/tlds/-/tlds-1.1.2.tgz#66d3b71d16fd3cd7a7c8353329681ef6ac546e1b" + integrity sha512-1jkwm1WY9VIb6WhdANRmWDkXQUcIRpxqZpSdS+HD9vhoVL3zwoFvP8doQNEgT6k3VST0Ewu50wZnXIceRYp5tw== + +"@hapi/topo@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012" + integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg== + dependencies: + "@hapi/hoek" "^9.0.0" + +"@hapi/topo@^6.0.2": + version "6.0.2" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-6.0.2.tgz#f219c1c60da8430228af4c1f2e40c32a0d84bbb4" + integrity sha512-KR3rD5inZbGMrHmgPxsJ9dbi6zEK+C3ZwUwTa+eMwWLz7oijWUTWD2pMSNNYJAU6Qq+65NkxXjqHr/7LM2Xkqg== + dependencies: + "@hapi/hoek" "^11.0.2" + "@humanwhocodes/config-array@^0.13.0": version "0.13.0" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.13.0.tgz#fb907624df3256d04b9aa2df50d7aa97ec648748" @@ -1124,6 +1170,17 @@ graphql-request "^6.1.0" graphql-tag "^2.12.6" +"@mondaydotcomorg/workforms-contracts@^1.26.4": + version "1.26.4" + resolved "https://registry.yarnpkg.com/@mondaydotcomorg/workforms-contracts/-/workforms-contracts-1.26.4.tgz#45b9054aed1e6f3b761c1db49ac427178e44f595" + integrity sha512-KfTHjWcYzoDn1lkWRKF13fxlHqR19SukSdi0DAC4LD6O4l2rtk5O/b0jw+Xle9rKlvK12fqutiT3w2LdjXVI/A== + dependencies: + "@types/joi" "^17.2.3" + awesome-phonenumber "^7.4.0" + joi "^17.13.1" + moment "^2.30.1" + uuid "^11.1.0" + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1206,6 +1263,23 @@ estree-walker "^2.0.2" picomatch "^4.0.2" +"@sideway/address@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5" + integrity sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q== + dependencies: + "@hapi/hoek" "^9.0.0" + +"@sideway/formula@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" + integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg== + +"@sideway/pinpoint@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" + integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -1225,6 +1299,11 @@ dependencies: "@sinonjs/commons" "^3.0.0" +"@standard-schema/spec@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@standard-schema/spec/-/spec-1.0.0.tgz#f193b73dc316c4170f2e82a881da0f550d551b9c" + integrity sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA== + "@tsconfig/node10@^1.0.7": version "1.0.11" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" @@ -1317,6 +1396,13 @@ expect "^29.0.0" pretty-format "^29.0.0" +"@types/joi@^17.2.3": + version "17.2.3" + resolved "https://registry.yarnpkg.com/@types/joi/-/joi-17.2.3.tgz#b7768ed9d84f1ebd393328b9f97c1cf3d2b94798" + integrity sha512-dGjs/lhrWOa+eO0HwgxCSnDm5eMGCsXuvLglMghJq32F6q5LyyNuXb41DHzrg501CKNOSSAHmfB7FDGeUnDmzw== + dependencies: + joi "*" + "@types/js-yaml@^4.0.0": version "4.0.9" resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.9.tgz#cd82382c4f902fed9691a2ed79ec68c5898af4c2" @@ -1653,6 +1739,11 @@ auto-bind@~4.0.0: resolved "https://registry.yarnpkg.com/auto-bind/-/auto-bind-4.0.0.tgz#e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb" integrity sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ== +awesome-phonenumber@^7.4.0: + version "7.5.0" + resolved "https://registry.yarnpkg.com/awesome-phonenumber/-/awesome-phonenumber-7.5.0.tgz#94fc48720e0a8b67f1a436c5a467832203c16af6" + integrity sha512-qWQHCiMHMNVyUsICiCcaPJAYbGL4E4kGnIxnrwkS3YCwcPa8VtQCo11HGKY8AbUpXJloDG10c9Bulhw3xYkC/g== + axios@^1.10.0: version "1.10.0" resolved "https://registry.npmjs.org/axios/-/axios-1.10.0.tgz#af320aee8632eaf2a400b6a1979fa75856f38d54" @@ -3688,6 +3779,30 @@ jiti@^2.0.0: resolved "https://registry.yarnpkg.com/jiti/-/jiti-2.4.2.tgz#d19b7732ebb6116b06e2038da74a55366faef560" integrity sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A== +joi@*: + version "18.0.1" + resolved "https://registry.yarnpkg.com/joi/-/joi-18.0.1.tgz#1e1885d035cc6ca1624e81bf22112e7c1ee38e1b" + integrity sha512-IiQpRyypSnLisQf3PwuN2eIHAsAIGZIrLZkd4zdvIar2bDyhM91ubRjy8a3eYablXsh9BeI/c7dmPYHca5qtoA== + dependencies: + "@hapi/address" "^5.1.1" + "@hapi/formula" "^3.0.2" + "@hapi/hoek" "^11.0.7" + "@hapi/pinpoint" "^2.0.1" + "@hapi/tlds" "^1.1.1" + "@hapi/topo" "^6.0.2" + "@standard-schema/spec" "^1.0.0" + +joi@^17.13.1: + version "17.13.3" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec" + integrity sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA== + dependencies: + "@hapi/hoek" "^9.3.0" + "@hapi/topo" "^5.1.0" + "@sideway/address" "^4.1.5" + "@sideway/formula" "^3.0.1" + "@sideway/pinpoint" "^2.0.0" + jose@^5.0.0: version "5.10.0" resolved "https://registry.yarnpkg.com/jose/-/jose-5.10.0.tgz#c37346a099d6467c401351a9a0c2161e0f52c4be" @@ -5295,6 +5410,11 @@ util-deprecate@^1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +uuid@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.1.0.tgz#9549028be1753bb934fc96e2bca09bb4105ae912" + integrity sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A== + v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" From 684ac3129c83d1c0c333caea2e978457ffc62ba4 Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Wed, 27 Aug 2025 14:16:58 +0300 Subject: [PATCH 02/14] feat(agent-toolkit): document WorkForms operations in GraphQL queries - Added comments to clarify the purpose of the WorkForms operations section. - Introduced createForm mutation for creating new monday forms (API version 2025-10). --- packages/agent-toolkit/src/monday-graphql/queries.graphql.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts b/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts index ab615f79..2fddd01d 100644 --- a/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts @@ -560,6 +560,11 @@ export const getWorkspaceInfo = gql` } `; +// ----------------------------- +// WorkForms (Forms) Operations +// ----------------------------- + +// Create a new monday form (API version 2025-10) export const createForm = gql` mutation createForm( $destination_workspace_id: Float! From 68f9a88f7d777acc68dc49a67e69ce03296e7d0c Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Wed, 27 Aug 2025 16:01:09 +0300 Subject: [PATCH 03/14] feat(agent-toolkit): add GetForm query and related tools - Introduced GetFormTool for fetching forms by token. - Added getForm GraphQL query to retrieve detailed form information. - Updated GraphQL types to include GetFormQuery and its variables. --- .../tools/platform-api-tools/get-form-tool.ts | 46 ++++++ .../core/tools/platform-api-tools/index.ts | 2 + .../src/monday-graphql/generated/graphql.ts | 14 +- .../src/monday-graphql/queries.graphql.ts | 132 ++++++++++++++++++ 4 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 packages/agent-toolkit/src/core/tools/platform-api-tools/get-form-tool.ts diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/get-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/get-form-tool.ts new file mode 100644 index 00000000..7b6dffbd --- /dev/null +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/get-form-tool.ts @@ -0,0 +1,46 @@ +import { z } from 'zod'; +import { GetFormQuery, GetFormQueryVariables } from '../../../monday-graphql/generated/graphql'; +import { getForm } from '../../../monday-graphql/queries.graphql'; +import { ToolInputType, ToolOutputType, ToolType } from '../../tool'; +import { BaseMondayApiTool, createMondayApiAnnotations } from './base-monday-api-tool'; +import { GraphQLDescriptions, Form } from '@mondaydotcomorg/workforms-contracts'; + +export const getFormToolSchema = { + formToken: z.string().describe(GraphQLDescriptions.commonArgs.formToken), +}; + +export class GetFormTool extends BaseMondayApiTool { + name = 'get_form'; + type = ToolType.READ; + annotations = createMondayApiAnnotations({ + title: 'Get Form', + readOnlyHint: true, + destructiveHint: false, + }); + + getDescription(): string { + return 'Get a monday.com form by its form token'; + } + + getInputSchema(): typeof getFormToolSchema { + return getFormToolSchema; + } + + protected async executeInternal(input: ToolInputType): Promise> { + const variables: GetFormQueryVariables = { + formToken: input.formToken, + }; + + const res = await this.mondayApi.request(getForm, variables); + + if (!res.form) { + return { + content: `Form with token ${input.formToken} not found or you don't have access to it.`, + }; + } + + return { + content: `The form with the token ${input.formToken} is: ${JSON.stringify(res.form, null, 2)}`, + }; + } +} diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts index 2287055a..63cf8b80 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts @@ -28,6 +28,7 @@ import { CreateDocTool } from './create-doc-tool'; import { CreateDashboardTool } from './dashboard-tools/create-dashboard-tool'; import { AllWidgetsSchemaTool } from './dashboard-tools/all-widgets-schema-tool'; import { CreateWidgetTool } from './dashboard-tools/create-widget-tool'; +import { GetFormTool } from './get-form-tool'; export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [ DeleteItemTool, @@ -42,6 +43,7 @@ export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [ MoveItemToGroupTool, CreateBoardTool, CreateFormTool, + GetFormTool, CreateColumnTool, DeleteColumnTool, AllMondayApiTool, diff --git a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts index bd19d8ae..236752d3 100644 --- a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts @@ -1,3 +1,5 @@ +import { Form } from "@mondaydotcomorg/workforms-contracts" + export type Maybe = T | null; export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; @@ -8445,7 +8447,9 @@ export type GetWorkspaceInfoQueryVariables = Exact<{ export type GetWorkspaceInfoQuery = { __typename?: 'Query', workspaces?: Array<{ __typename?: 'Workspace', id?: string | null, name: string, description?: string | null, kind?: WorkspaceKind | null, created_at?: any | null, state?: State | null, is_default_workspace?: boolean | null, owners_subscribers?: Array<{ __typename?: 'User', id: string, name: string, email: string } | null> | null } | null> | null, boards?: Array<{ __typename?: 'Board', id: string, name: string, board_folder_id?: string | null } | null> | null, docs?: Array<{ __typename?: 'Document', id: string, name: string, doc_folder_id?: string | null } | null> | null, folders?: Array<{ __typename?: 'Folder', id: string, name: string } | null> | null }; - +// ----------------------------- +// WorkForms (Forms) Types +// ----------------------------- export type CreateFormMutationVariables = Exact<{ destination_workspace_id: Scalars['Float']['input']; @@ -8459,4 +8463,10 @@ export type CreateFormMutationVariables = Exact<{ board_subscriber_teams_ids?: InputMaybe>; }>; -export type CreateFormMutation = { __typename?: 'Mutation', create_form?: { __typename?: 'CreateFormResult', boardId: string, token: string }}; +export type CreateFormMutation = { __typename?: 'Mutation', create_form?: { __typename?: 'CreateFormResult', boardId: string, token: string } | null }; + +export type GetFormQueryVariables = Exact<{ + formToken: Scalars['String']['input']; +}>; + +export type GetFormQuery = { __typename?: 'Query', form?: Form & { __typename?: 'Form' } | null }; diff --git a/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts b/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts index 2fddd01d..632b389b 100644 --- a/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts @@ -593,3 +593,135 @@ export const createForm = gql` } } `; + +// Fetch a form by its token +export const getForm = gql` + query getForm($formToken: String!) { + form(formToken: $formToken) { + token + type + questions { + id + type + visible + title + description + required + showIfRules + options { + label + } + settings { + prefill { + enabled + source + lookup + } + prefixAutofilled + prefixPredefined { + enabled + prefix + } + checkedByDefault + defaultCurrentDate + includeTime + display + optionsOrder + labelLimitCount + locationAutofilled + limit + skipValidation + } + } + features { + isInternal + reCaptchaChallenge + shortenedLink { + enabled + url + } + password { + enabled + } + draftSubmission { + enabled + } + requireLogin { + enabled + redirectToLogin + } + responseLimit { + enabled + limit + } + closeDate { + enabled + date + } + preSubmissionView { + enabled + title + description + startButton { + text + } + } + afterSubmissionView { + title + description + redirectAfterSubmission { + enabled + redirectUrl + } + allowResubmit + showSuccessImage + allowEditSubmission + allowViewSubmission + } + monday { + itemGroupId + includeNameQuestion + includeUpdateQuestion + syncQuestionAndColumnsTitles + } + } + appearance { + hideBranding + showProgressBar + primaryColor + layout { + format + alignment + direction + } + background { + type + value + } + text { + font + color + size + } + logo { + position + url + size + } + submitButton { + text + } + } + accessibility { + language + logoAltText + } + tags { + id + name + value + columnId + } + } + } +`; From c3309e9d5baf75d61a93844ac2163e4fead2936e Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 09:44:24 +0300 Subject: [PATCH 04/14] refactor(agent-toolkit): remove deprecated form tools and update dependencies - Deleted CreateFormTool and GetFormTool as part of the refactor. - Removed @mondaydotcomorg/workforms-contracts dependency from package.json. - Updated import paths for GraphQL types to reflect new structure. --- packages/agent-toolkit/package.json | 1 - .../core/tools/platform-api-tools/index.ts | 2 +- .../{ => workforms-tools}/create-form-tool.ts | 14 +- .../{ => workforms-tools}/get-form-tool.ts | 10 +- .../workforms-tools/workforms.consts.ts | 238 +++++++++ .../workforms-tools/workforms.types.ts | 455 ++++++++++++++++++ .../src/monday-graphql/generated/graphql.ts | 2 +- yarn.lock | 120 ----- 8 files changed, 709 insertions(+), 133 deletions(-) rename packages/agent-toolkit/src/core/tools/platform-api-tools/{ => workforms-tools}/create-form-tool.ts (87%) rename packages/agent-toolkit/src/core/tools/platform-api-tools/{ => workforms-tools}/get-form-tool.ts (77%) create mode 100644 packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.consts.ts create mode 100644 packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.types.ts diff --git a/packages/agent-toolkit/package.json b/packages/agent-toolkit/package.json index ce69d157..6ed26aa3 100644 --- a/packages/agent-toolkit/package.json +++ b/packages/agent-toolkit/package.json @@ -49,7 +49,6 @@ }, "dependencies": { "@mondaydotcomorg/api": "^10.0.5", - "@mondaydotcomorg/workforms-contracts": "^1.26.4", "axios": "^1.10.0", "jsonwebtoken": "^9.0.2", "zod": "^3.24.2", diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts index 63cf8b80..208c47be 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts @@ -28,7 +28,7 @@ import { CreateDocTool } from './create-doc-tool'; import { CreateDashboardTool } from './dashboard-tools/create-dashboard-tool'; import { AllWidgetsSchemaTool } from './dashboard-tools/all-widgets-schema-tool'; import { CreateWidgetTool } from './dashboard-tools/create-widget-tool'; -import { GetFormTool } from './get-form-tool'; +import { GetFormTool } from './workforms-tools/get-form-tool'; export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [ DeleteItemTool, diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/create-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts similarity index 87% rename from packages/agent-toolkit/src/core/tools/platform-api-tools/create-form-tool.ts rename to packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts index b38ea5ec..793f8932 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/create-form-tool.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts @@ -1,9 +1,13 @@ import { z } from 'zod'; -import { BoardKind, CreateFormMutation, CreateFormMutationVariables } from '../../../monday-graphql/generated/graphql'; -import { createForm } from '../../../monday-graphql/queries.graphql'; -import { ToolInputType, ToolOutputType, ToolType } from '../../tool'; -import { BaseMondayApiTool, createMondayApiAnnotations } from './base-monday-api-tool'; -import { GraphQLDescriptions } from '@mondaydotcomorg/workforms-contracts'; +import { + BoardKind, + CreateFormMutation, + CreateFormMutationVariables, +} from '../../../../monday-graphql/generated/graphql'; +import { createForm } from '../../../../monday-graphql/queries.graphql'; +import { ToolInputType, ToolOutputType, ToolType } from '../../../tool'; +import { BaseMondayApiTool, createMondayApiAnnotations } from '../base-monday-api-tool'; +import { GraphQLDescriptions } from './workforms.consts'; export const createFormToolSchema = { destination_workspace_id: z.number().describe(GraphQLDescriptions.form.args.destinationWorkspaceId), diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/get-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts similarity index 77% rename from packages/agent-toolkit/src/core/tools/platform-api-tools/get-form-tool.ts rename to packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts index 7b6dffbd..543dd2ad 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/get-form-tool.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts @@ -1,9 +1,9 @@ import { z } from 'zod'; -import { GetFormQuery, GetFormQueryVariables } from '../../../monday-graphql/generated/graphql'; -import { getForm } from '../../../monday-graphql/queries.graphql'; -import { ToolInputType, ToolOutputType, ToolType } from '../../tool'; -import { BaseMondayApiTool, createMondayApiAnnotations } from './base-monday-api-tool'; -import { GraphQLDescriptions, Form } from '@mondaydotcomorg/workforms-contracts'; +import { GetFormQuery, GetFormQueryVariables } from '../../../../monday-graphql/generated/graphql'; +import { getForm } from '../../../../monday-graphql/queries.graphql'; +import { ToolInputType, ToolOutputType, ToolType } from '../../../tool'; +import { BaseMondayApiTool, createMondayApiAnnotations } from '../base-monday-api-tool'; +import { GraphQLDescriptions } from './workforms.consts'; export const getFormToolSchema = { formToken: z.string().describe(GraphQLDescriptions.commonArgs.formToken), diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.consts.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.consts.ts new file mode 100644 index 00000000..cd146419 --- /dev/null +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.consts.ts @@ -0,0 +1,238 @@ +export const GraphQLDescriptions = { + commonArgs: { + formToken: 'The unique identifier token for the form. Required for all form-specific operations.', + questionId: 'The unique identifier for the question. Used to target specific questions within a form.', + }, + form: { + operations: { + createForm: 'Create a new form with specified configuration. Returns the created form with its unique token.', + updateForm: 'Update form properties including title, description, or question order.', + activateForm: 'Activate a form to make it visible to users and accept new submissions.', + deactivateForm: 'Deactivate a form to hide it from users and stop accepting submissions. Form data is preserved.', + }, + properties: { + id: 'The unique identifier for the form. Auto-generated upon creation.', + token: 'The unique token used to access and identify the form. Used in public URLs and API calls.', + boardId: 'The board ID connected to the form. Used to store form responses as items.', + title: 'The display title shown to users at the top of the form.', + description: 'Optional detailed description explaining the form purpose, displayed below the title.', + active: 'Boolean indicating if the form is currently accepting responses and visible to users.', + ownerId: 'The ID of the user who created and owns this form. Determines permissions.', + createWithAI: 'Boolean indicating if this form was initially created using AI assistance.', + builtWithAI: 'Boolean indicating if this form was built or modified using AI functionality.', + questions: 'Array of question objects that make up the form content, in display order.', + isSuspicious: + 'Boolean flag indicating if the form has been flagged for review due to suspicious content or activity.', + isAnonymous: 'Boolean indicating if responses are collected without identifying the submitter.', + type: 'The category or classification of the form for organizational purposes.', + features: 'Object containing feature toggles and settings like password protection, response limits, etc.', + appearance: 'Object containing visual styling settings including colors, fonts, layout, and branding.', + accessibility: 'Object containing accessibility settings such as language, alt text, and reading direction.', + tags: 'Array of tracking tags for categorization and analytics (e.g., UTM parameters for marketing tracking).', + }, + inputs: { + title: 'The title text for the form. Must be at least 1 character long.', + description: 'Optional description text providing context about the form purpose.', + input: 'Complete form configuration object containing properties to create or update.', + questions: 'Ordered array of question IDs for reordering. Must include all existing question IDs.', + }, + args: { + formToken: 'The unique form token identifying which form to operate on.', + destinationWorkspaceId: 'The workspace in which the form will be created in.', + destinationFolderId: 'The folder in which the form will be created under.', + destinationFolderName: 'The name of the folder in which the form will be created in.', + boardKind: 'The board kind to create for the board in which the form will create items in.', + destinationName: 'The name of the board that will be created to store the form responses in.', + boardOwnerIds: + 'Array of user IDs who will have owner permissions on the board in which the form will create items in.', + boardOwnerTeamIds: + 'Array of team IDs whose members will have owner permissions on the board in which the form will create items in.', + boardSubscriberIds: + 'Array of user IDs who will receive notifications about board activity for the board in which the form will create items in.', + boardSubscriberTeamsIds: + 'Array of team IDs whose members will receive notifications about board activity for the board in which the form will create items in.', + }, + }, + formSettings: { + operations: { + updateFormSettings: 'Update form configuration including features, appearance, and accessibility options.', + setFormPassword: + 'Set a password on a form to restrict access. This will enable password protection for the form.', + shortenUrl: 'Shorten a URL for a form and store it in the form settings. Returns the shortened link object.', + }, + properties: { + features: + 'Object containing form features including but not limited to password protection, response limits, login requirements, etc.', + appearance: 'Object containing visual styling including colors, layout, fonts, and branding elements.', + accessibility: 'Object containing accessibility options such as language, alt text, etc.', + isInternal: 'Boolean indicating if the form is restricted to internal users only.', + reCaptchaChallenge: 'Boolean enabling reCAPTCHA verification to prevent spam submissions.', + password: 'Object containing password protection configuration for the form.', + passwordEnabled: + 'Boolean enabling password protection. When true, users must enter a password to access the form.', + requireLogin: 'Object containing login requirement settings for form access.', + requireLoginEnabled: 'Boolean requiring users to be logged in before submitting responses.', + redirectToLogin: 'Boolean automatically redirecting unauthenticated users to the login page.', + shortenedLink: 'Object containing shortened URL configuration for easy form sharing.', + shortenedLinkEnabled: 'Boolean enabling generation of shortened URLs for the form.', + shortenedLinkUrl: 'The generated shortened URL for form access. Only available when shortened links are enabled.', + draftSubmission: 'Object containing draft saving configuration allowing users to save progress.', + draftSubmissionEnabled: 'Boolean allowing users to save incomplete responses as drafts.', + aiTranslate: 'Object containing AI translation configuration for the form.', + aiTranslateEnabled: 'Boolean enabling AI translation for the form.', + responseLimit: 'Object containing response limitation settings to control submission volume.', + responseLimitEnabled: 'Boolean enabling response count limits for the form.', + responseLimitValue: 'Integer specifying the maximum number of responses allowed.', + closeDate: 'Object containing automatic form closure configuration.', + closeDateEnabled: 'Boolean enabling automatic form closure at a specified date and time.', + closeDateValue: 'ISO timestamp when the form will automatically stop accepting responses.', + allowResubmit: 'Boolean allowing users to submit multiple responses to the same form.', + allowEditSubmission: 'Boolean allowing users to modify their submitted responses after submission.', + allowViewSubmission: 'Boolean allowing users to view their submitted responses.', + preSubmissionView: 'Object containing welcome screen configuration displayed before the form.', + preSubmissionEnabled: 'Boolean showing a welcome/introduction screen before the form begins.', + preSubmissionTitle: 'Text displayed as the title on the welcome screen.', + preSubmissionDescription: 'Text providing context or instructions on the welcome screen.', + startButton: 'Object containing start button configuration for the welcome screen.', + startButtonText: 'Custom text for the button that begins the form experience.', + afterSubmissionView: 'Object containing settings for the post-submission user experience.', + postSubmissionTitle: 'Text displayed as the title after successful form submission.', + postSubmissionDescription: 'Text shown to users after they complete the form.', + showSuccessImage: 'Boolean displaying a success image after form completion.', + redirectAfterSubmission: 'Object containing redirect configuration after form submission.', + redirectAfterSubmissionEnabled: 'Boolean enabling automatic redirect after form completion to a specified URL.', + redirectUrl: 'The URL where users will be redirected after successfully submitting the form.', + monday: 'Object containing board settings for response handling.', + itemGroupId: 'The board group ID where new items from form responses will be created.', + includeNameQuestion: + 'Boolean adding a name question to the form. This is a special question type that represents the name column from the associated monday board', + includeUpdateQuestion: + 'Boolean adding an update/comment field to the form. This is a special question type that represents the updates from the associated item of the submission on the monday board. ', + syncQuestionAndColumnsTitles: + 'Boolean synchronizing form question titles with board column names. When true, the form question titles will be synchronized with the board column names.', + hideBranding: 'Boolean hiding monday branding from the form display.', + showProgressBar: 'Boolean displaying a progress indicator showing form completion progress bar.', + primaryColor: 'Hex color code for the primary theme color used throughout the form.', + layout: 'Object containing form structure and presentation settings.', + format: 'String specifying the form display format. Can be a step by step form or a classic one page form.', + alignment: 'String controlling text and content alignment.', + direction: 'String setting reading direction.', + background: 'Object containing background appearance configuration for the form.', + backgroundType: 'String specifying background style.', + backgroundValue: + 'String containing the background value. The value will depend on the background type. If the background type is color, the value will be a hex color code. If the background type is image, the value will be an image URL.', + text: 'Object containing typography and text styling configuration.', + font: 'String specifying the font family used throughout the form.', + textColor: 'Hex color code for the text color in the form.', + fontSize: 'String or number specifying the base font size for form text.', + logo: 'Object containing logo display configuration for form branding.', + logoPosition: 'String specifying logo placement ("top", "bottom", "header").', + logoUrl: 'URL pointing to the logo image file for display on the form.', + logoSize: + 'String specifying logo size ("small", "medium", "large") for the logo that appears on the header of the form.', + logoAltText: 'Alternative text description for the logo image for accessibility.', + submitButton: 'Object containing submit button styling and text configuration.', + submitButtonText: 'Custom text displayed on the form submission button.', + language: 'Language code for form localization and interface text (e.g., "en", "es", "fr").', + }, + inputs: { + settings: 'Complete form settings object containing all configuration options.', + features: 'Form features configuration including security, limits, and access controls.', + appearance: 'Visual styling configuration including colors, layout, and branding.', + accessibility: 'Accessibility configuration including language and reading direction.', + password: + 'Password configuration for the form. Only setting enabled to false is supported. To enable a form to be password protected, please use the set_form_password mutation instead.', + passwordValue: 'The password to set for the form. Must be at least 1 character long.', + }, + }, + question: { + operations: { + createQuestion: 'Create a new question within a form. Returns the created question with auto-generated ID.', + updateQuestion: + 'Update an existing question properties including title, type, or settings. Requires question ID.', + deleteQuestion: 'Permanently remove a question from a form. This action cannot be undone.', + }, + properties: { + title: + 'The question text displayed to respondents. Must be at least 1 character long and clearly indicate the expected response.', + type: 'The question type determining input behavior and validation (e.g., "text", "email", "single_select", "multi_select").', + visible: + 'Boolean controlling question visibility to respondents. Hidden questions remain in form structure but are not displayed.', + required: 'Boolean indicating if the question must be answered before form submission.', + position: 'Integer specifying the display order of the question within the form (zero-based).', + description: + 'Optional explanatory text providing additional context, instructions, or examples for the question.', + placeholder: 'Optional placeholder text shown in input fields to guide user input.', + createdAt: 'ISO timestamp when the question was created.', + updatedAt: 'ISO timestamp when the question was last modified.', + selectOptions: + 'Array of option objects for choice-based questions (single_select, multi_select). Required for select types.', + selectLabel: 'The display text for individual option choices in select-type questions.', + }, + inputs: { + question: 'Complete question object containing all properties for creation or update.', + questionData: 'Question configuration including type, title, and type-specific settings.', + position: 'Integer position where the question should be placed in the form sequence.', + }, + }, + questionSettings: { + properties: { + validation: 'Validation rules applied to the question response', + prefill: + 'Configuration for automatically populating question values from various data sources such as user account information or URL query parameters.', + prefillEnabled: + 'Whether prefill functionality is enabled for this question. When true, the question will attempt to auto-populate values from the specified source.', + prefillSource: + 'The data source to use for prefilling the question value. Check the PrefillSources for available options.', + prefillLookup: + 'The specific field or parameter name to lookup from the prefill source. For account sources, this would be a user property like "name" or "email". For query parameters, this would be the parameter name that would be set in the URL.', + prefixAutofilled: + "Phone questions only: Automatically detect and fill the phone country prefix based on the user's geographic location or browser settings.", + prefixPredefined: + 'Phone questions only: Configuration for setting a specific predefined phone country prefix that will be pre-selected for users.', + prefixPredefinedEnabled: + 'Whether a predefined phone prefix is enabled for phone number questions. When true, the specified prefix will be pre-selected.', + prefixPredefinedPrefix: + 'The predefined phone country prefix to use as country code in capital letters (e.g., "US", "UK", "IL"). Only used when enabled is true.', + checkedByDefault: + 'Boolean/checkbox questions only: Whether the checkbox should be checked by default when the form loads.', + defaultCurrentDate: + 'Date based questions only: Automatically set the current date as the default value when the form loads.', + includeTime: + 'Date questions only: Whether to include time selection (hours and minutes) in addition to the date picker. When false, only date selection is available.', + display: + 'Single/Multi Select questions only: Controls how the selection options are visually presented to users.', + optionsOrder: 'Single/Multi Select questions only: Determines the ordering of selection options.', + labelLimitCount: 'Multi Select questions only: Limits the number of options a user can select.', + locationAutofilled: + "Location questions only: Automatically detect and fill the user's current location using browser geolocation services, requiring user permission.", + limit: 'Rating questions only: Maximum rating value that users can select.', + skipValidation: 'Link/URL questions only: Whether to skip URL format validation, allowing any text input.', + }, + inputs: { + settings: 'Question-specific configuration object that varies by question type.', + validationRules: 'Validation constraints and rules', + choiceOptions: 'List of available choices for selection questions', + fileSettings: 'File upload constraints and settings', + }, + }, + tag: { + operations: { + createTag: 'Create a new tag for a form. Tags are used to categorize and track responses. (e.g. UTM tags)', + deleteTag: 'Delete a tag from a form', + updateTag: 'Update an existing tag in a form', + }, + properties: { + id: 'The unique identifier for the tag', + name: 'The name of the tag', + value: 'The value of the tag', + columnId: 'The ID of the column this tag is associated with', + }, + inputs: { + tagInput: 'The tag data to create', + name: 'The name of the tag. Must be unique within the form and not reserved.', + value: 'The value of the tag', + deleteTagInput: 'Options for deleting the tag', + }, + }, +}; diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.types.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.types.ts new file mode 100644 index 00000000..998bd81f --- /dev/null +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.types.ts @@ -0,0 +1,455 @@ +enum FormType { + Internal = 'internal', + InlineInternal = 'inline_internal', + Preview = 'preview', + Standard = 'standard', + EnforcedItemCreationForm = 'enforced_item_creation_form', +} + +enum LogoSize { + Small = 'small', + Medium = 'medium', + Large = 'large', + ExtraLarge = 'extraLarge', +} + +enum LogoPosition { + Auto = 'auto', + Left = 'left', + Center = 'center', + Right = 'right', +} + +interface Tag { + id: string; + name: string; + columnId: string; + value?: string; +} + +enum BackgroundType { + Image = 'image', + Color = 'color', + None = 'none', +} + +enum Direction { + LtR = 'ltr', + Rtl = 'rtl', +} + +enum Format { + OneByOne = 'one-by-one', + Classic = 'classic', +} + +enum Alignment { + FullLeft = 'full-left', + Left = 'left', + Center = 'center', + Right = 'right', + FullRight = 'full-right', +} + +enum FontSize { + Small = 'small', + Medium = 'medium', + Large = 'large', +} + +enum WorkformsQuestionType { + Boolean = 'Boolean', + ConnectedBoards = 'ConnectedBoards', + Country = 'Country', + Date = 'Date', + DateRange = 'DateRange', + Email = 'Email', + File = 'File', + Link = 'Link', + Location = 'Location', + LongText = 'LongText', + MultiSelect = 'MultiSelect', + Name = 'Name', + Number = 'Number', + People = 'People', + Phone = 'Phone', + Rating = 'Rating', + ShortText = 'ShortText', + Signature = 'Signature', + SingleSelect = 'SingleSelect', + Subitems = 'Subitems', + Updates = 'Updates', +} + +enum PrefillSources { + Account = 'account', + QueryParam = 'queryParam', +} + +enum PrefillAccountLookups { + Email = 'email', + Name = 'name', + Title = 'title', + Phone = 'phone', + FirstName = 'first_name', + LastName = 'last_name', + Location = 'location', + Timezone = 'time_zone', + ManagerName = 'manager_display_name', +} + +enum ConditionOperator { + And = 'AND', + Or = 'OR', +} + +type Condition = { + id: string; + buildingBlockId: string; // id of the parent question + operator: ConditionOperator; + values: string[]; +}; + +type PhoneQuestionSettings = { + prefixAutofilled: boolean; + prefixPredefined: { + enabled: boolean; + prefix: string | null; + }; +}; + +type BooleanQuestionSettings = { + checkedByDefault: boolean; +}; + +type ConnectedBoardsQuestionSettings = { + boards: { + id: number; + name: string; + }[]; + allowMultipleItems: boolean; +}; + +type DateQuestionSettings = { + defaultCurrentDate: boolean; + includeTime: boolean; +}; + +enum SelectDisplay { + Horizontal = 'horizontal', + Vertical = 'vertical', + Dropdown = 'dropdown', +} + +enum SelectOrderByOptions { + Alphabetical = 'alphabetical', + Random = 'random', + Custom = 'custom', +} + +type SingleSelectQuestionSettings = { + display: SelectDisplay; + optionsOrder: SelectOrderByOptions; + optionsPositions?: Record; +}; + +type MultiSelectQuestionSettings = { + display: SelectDisplay; + labelLimitCount: number | null; + optionsOrder: SelectOrderByOptions; + optionsPositions?: Record; +}; + +type LocationQuestionSettings = { + locationAutofilled: boolean; +}; + +type RatingQuestionSettings = { + limit: 3 | 4 | 5; +}; + +type PeopleQuestionSettings = { + people: { + id: number; + name: string; + photoUrl: string | null; + title: string | null; + }[]; + maximum: number | null; +}; + +type LinkQuestionSettings = { + skipValidation: boolean; +}; + +type SubitemsQuestionSettings = { + subitemBoardId: string; + // eslint-disable-next-line no-use-before-define + subQuestions: Question[]; +}; + +type PrefillSettingsValue = { + enabled: boolean; + source: PrefillSources; + lookup: PrefillAccountLookups | string; +}; + +type PrefillSettings = { + prefill?: PrefillSettingsValue; +}; + +type ShowIfRule = { + id: string; + operator: ConditionOperator.Or; + conditions: string[]; +}; + +enum SelectOptionsType { + MultiSelect = 'multi-select', + SingleSelect = 'single-select', + People = 'people', + Location = 'location', + CountryCode = 'country-code', + Country = 'country', + ConnectedBoards = 'connected_boards', +} + +interface SelectOption { + label: string; + value: string; +} + +interface PeopleOption extends SelectOption { + avatarUrl?: string; +} + +interface MultiSelectOption extends SelectOption { + position: number; + visible?: boolean; + active?: boolean; +} + +interface SingleSelectOption extends SelectOption { + position: number; + visible?: boolean; + active?: boolean; +} + +interface LocationOption extends SelectOption { + address?: string; + locationDetails?: { + address: string; + placeId: string; + }; +} + +// Base settings that no-specific question uses, so we can add more settings to it +type BaseQuestionSettings = PrefillSettings; + +type QuestionSettings = + | BaseQuestionSettings + | PhoneQuestionSettings + | BooleanQuestionSettings + | DateQuestionSettings + | SingleSelectQuestionSettings + | MultiSelectQuestionSettings + | LocationQuestionSettings + | RatingQuestionSettings + | PeopleQuestionSettings + | LinkQuestionSettings + | ConnectedBoardsQuestionSettings + | SubitemsQuestionSettings; + +interface BaseQuestion { + id: string; + type: WorkformsQuestionType; + visible: boolean; + title: string; + description: string | null; + settings: QuestionSettings; + required: boolean; + showIfRules: { + operator: ConditionOperator.Or; + rules: ShowIfRule[]; + }; + forceRequired?: boolean; +} + +export type PhoneQuestion = BaseQuestion & { + type: WorkformsQuestionType.Phone; + settings: PhoneQuestionSettings; +}; + +export type BooleanQuestion = BaseQuestion & { + type: WorkformsQuestionType.Boolean; + settings: BooleanQuestionSettings; +}; + +export type ConnectedBoardsQuestion = BaseQuestion & { + type: WorkformsQuestionType.ConnectedBoards; + settings: ConnectedBoardsQuestionSettings; +}; + +export type DateQuestion = BaseQuestion & { + type: WorkformsQuestionType.Date; + settings: DateQuestionSettings; +}; + +export type SingleSelectQuestion = BaseQuestion & { + type: WorkformsQuestionType.SingleSelect; + settings: SingleSelectQuestionSettings; + options: SingleSelectOption[]; +}; + +export type MultiSelectQuestion = BaseQuestion & { + type: WorkformsQuestionType.MultiSelect; + settings: MultiSelectQuestionSettings; + options: MultiSelectOption[]; +}; + +export type LocationQuestion = BaseQuestion & { + type: WorkformsQuestionType.Location; + settings: LocationQuestionSettings; + options: LocationOption[]; +}; + +export type RatingQuestion = BaseQuestion & { + type: WorkformsQuestionType.Rating; + settings: RatingQuestionSettings; +}; + +type PeopleQuestion = BaseQuestion & { + type: WorkformsQuestionType.People; + settings: PeopleQuestionSettings; + options: PeopleOption[]; +}; + +type LinkQuestion = BaseQuestion & { + type: WorkformsQuestionType.Link; + settings: LinkQuestionSettings; +}; + +type SubitemsQuestion = BaseQuestion & { + type: WorkformsQuestionType.Subitems; + settings: SubitemsQuestionSettings; +}; + +export type Question = + | BaseQuestion + | BooleanQuestion + | DateQuestion + | LocationQuestion + | RatingQuestion + | MultiSelectQuestion + | PeopleQuestion + | PhoneQuestion + | SingleSelectQuestion + | LinkQuestion + | ConnectedBoardsQuestion + | SubitemsQuestion; + +export interface Form { + id: number; + token: string; + active: boolean; + title: string; + ownerId?: number; + createWithAI: boolean; + builtWithAI: boolean; + description: string | null; + closeDate: string | null; + questions: Question[]; + conditions: { + [id: string]: Condition; + }; + isSuspicious: boolean; + isAnonymous: boolean; + type: FormType; + features: { + isInternal: boolean; + reCaptchaChallenge: boolean; + shortenedLink: { + enabled: boolean; + url: string | null; + }; + password: { + enabled: boolean; + }; + draftSubmission: { + enabled: boolean; + }; + requireLogin: { + enabled: boolean; + redirectToLogin: boolean; + }; + responseLimit: { + enabled: boolean; + limit: number | null; + }; + closeDate: { + enabled: boolean; + date: string | null; + }; + preSubmissionView: { + enabled: boolean; + title: string | null; + description: string | null; + startButton: { + text: string | null; + }; + }; + postSubmissionView: { + title: string | null; + description: string | null; + redirectAfterSubmission: { + enabled: boolean; + redirectUrl: string | null; + }; + allowResubmit: boolean; + showSuccessImage: boolean; + allowEditSubmission: boolean; + allowViewSubmission: boolean; + }; + monday: { + itemGroupId: string | null; + includeNameQuestion: boolean; + includeUpdateQuestion: boolean; + syncQuestionAndColumnsTitles: boolean; + }; + aiTranslate: { + enabled: boolean; + }; + }; + appearance: { + hideBranding: boolean; + showProgressBar: boolean; + primaryColor: string | null; + layout: { + format: Format; + alignment: Alignment; + direction: Direction; + }; + background: + | { type: BackgroundType.Color; value: string | null } + | { type: BackgroundType.Image; value: string } + | { type: BackgroundType.None }; + text: { + font: string | null; + color: string | null; + size: FontSize | null; + }; + logo: { + position: LogoPosition; + url: string | null; + size: LogoSize; + }; + submitButton: { + text: string | null; + }; + }; + accessibility: { + language: string | null; + logoAltText: string | null; + }; + tags: Tag[]; +} diff --git a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts index 236752d3..149f3bc4 100644 --- a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts @@ -1,4 +1,4 @@ -import { Form } from "@mondaydotcomorg/workforms-contracts" +import { Form } from "src/core/tools/platform-api-tools/workforms-tools/workforms.types" export type Maybe = T | null; export type InputMaybe = Maybe; diff --git a/yarn.lock b/yarn.lock index 71faccce..fb2d031e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -823,52 +823,6 @@ resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861" integrity sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ== -"@hapi/address@^5.1.1": - version "5.1.1" - resolved "https://registry.yarnpkg.com/@hapi/address/-/address-5.1.1.tgz#e9925fc1b65f5cc3fbea821f2b980e4652e84cb6" - integrity sha512-A+po2d/dVoY7cYajycYI43ZbYMXukuopIsqCjh5QzsBCipDtdofHntljDlpccMjIfTy6UOkg+5KPriwYch2bXA== - dependencies: - "@hapi/hoek" "^11.0.2" - -"@hapi/formula@^3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@hapi/formula/-/formula-3.0.2.tgz#81b538060ee079481c906f599906d163c4badeaf" - integrity sha512-hY5YPNXzw1He7s0iqkRQi+uMGh383CGdyyIGYtB+W5N3KHPXoqychklvHhKCC9M3Xtv0OCs/IHw+r4dcHtBYWw== - -"@hapi/hoek@^11.0.2", "@hapi/hoek@^11.0.7": - version "11.0.7" - resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-11.0.7.tgz#56a920793e0a42d10e530da9a64cc0d3919c4002" - integrity sha512-HV5undWkKzcB4RZUusqOpcgxOaq6VOAH7zhhIr2g3G8NF/MlFO75SjOr2NfuSx0Mh40+1FqCkagKLJRykUWoFQ== - -"@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": - version "9.3.0" - resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" - integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== - -"@hapi/pinpoint@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@hapi/pinpoint/-/pinpoint-2.0.1.tgz#32077e715655fc00ab8df74b6b416114287d6513" - integrity sha512-EKQmr16tM8s16vTT3cA5L0kZZcTMU5DUOZTuvpnY738m+jyP3JIUj+Mm1xc1rsLkGBQ/gVnfKYPwOmPg1tUR4Q== - -"@hapi/tlds@^1.1.1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@hapi/tlds/-/tlds-1.1.2.tgz#66d3b71d16fd3cd7a7c8353329681ef6ac546e1b" - integrity sha512-1jkwm1WY9VIb6WhdANRmWDkXQUcIRpxqZpSdS+HD9vhoVL3zwoFvP8doQNEgT6k3VST0Ewu50wZnXIceRYp5tw== - -"@hapi/topo@^5.1.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012" - integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg== - dependencies: - "@hapi/hoek" "^9.0.0" - -"@hapi/topo@^6.0.2": - version "6.0.2" - resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-6.0.2.tgz#f219c1c60da8430228af4c1f2e40c32a0d84bbb4" - integrity sha512-KR3rD5inZbGMrHmgPxsJ9dbi6zEK+C3ZwUwTa+eMwWLz7oijWUTWD2pMSNNYJAU6Qq+65NkxXjqHr/7LM2Xkqg== - dependencies: - "@hapi/hoek" "^11.0.2" - "@humanwhocodes/config-array@^0.13.0": version "0.13.0" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.13.0.tgz#fb907624df3256d04b9aa2df50d7aa97ec648748" @@ -1170,17 +1124,6 @@ graphql-request "^6.1.0" graphql-tag "^2.12.6" -"@mondaydotcomorg/workforms-contracts@^1.26.4": - version "1.26.4" - resolved "https://registry.yarnpkg.com/@mondaydotcomorg/workforms-contracts/-/workforms-contracts-1.26.4.tgz#45b9054aed1e6f3b761c1db49ac427178e44f595" - integrity sha512-KfTHjWcYzoDn1lkWRKF13fxlHqR19SukSdi0DAC4LD6O4l2rtk5O/b0jw+Xle9rKlvK12fqutiT3w2LdjXVI/A== - dependencies: - "@types/joi" "^17.2.3" - awesome-phonenumber "^7.4.0" - joi "^17.13.1" - moment "^2.30.1" - uuid "^11.1.0" - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -1263,23 +1206,6 @@ estree-walker "^2.0.2" picomatch "^4.0.2" -"@sideway/address@^4.1.5": - version "4.1.5" - resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5" - integrity sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q== - dependencies: - "@hapi/hoek" "^9.0.0" - -"@sideway/formula@^3.0.1": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" - integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg== - -"@sideway/pinpoint@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" - integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== - "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -1299,11 +1225,6 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@standard-schema/spec@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@standard-schema/spec/-/spec-1.0.0.tgz#f193b73dc316c4170f2e82a881da0f550d551b9c" - integrity sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA== - "@tsconfig/node10@^1.0.7": version "1.0.11" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" @@ -1396,13 +1317,6 @@ expect "^29.0.0" pretty-format "^29.0.0" -"@types/joi@^17.2.3": - version "17.2.3" - resolved "https://registry.yarnpkg.com/@types/joi/-/joi-17.2.3.tgz#b7768ed9d84f1ebd393328b9f97c1cf3d2b94798" - integrity sha512-dGjs/lhrWOa+eO0HwgxCSnDm5eMGCsXuvLglMghJq32F6q5LyyNuXb41DHzrg501CKNOSSAHmfB7FDGeUnDmzw== - dependencies: - joi "*" - "@types/js-yaml@^4.0.0": version "4.0.9" resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.9.tgz#cd82382c4f902fed9691a2ed79ec68c5898af4c2" @@ -1739,11 +1653,6 @@ auto-bind@~4.0.0: resolved "https://registry.yarnpkg.com/auto-bind/-/auto-bind-4.0.0.tgz#e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb" integrity sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ== -awesome-phonenumber@^7.4.0: - version "7.5.0" - resolved "https://registry.yarnpkg.com/awesome-phonenumber/-/awesome-phonenumber-7.5.0.tgz#94fc48720e0a8b67f1a436c5a467832203c16af6" - integrity sha512-qWQHCiMHMNVyUsICiCcaPJAYbGL4E4kGnIxnrwkS3YCwcPa8VtQCo11HGKY8AbUpXJloDG10c9Bulhw3xYkC/g== - axios@^1.10.0: version "1.10.0" resolved "https://registry.npmjs.org/axios/-/axios-1.10.0.tgz#af320aee8632eaf2a400b6a1979fa75856f38d54" @@ -3779,30 +3688,6 @@ jiti@^2.0.0: resolved "https://registry.yarnpkg.com/jiti/-/jiti-2.4.2.tgz#d19b7732ebb6116b06e2038da74a55366faef560" integrity sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A== -joi@*: - version "18.0.1" - resolved "https://registry.yarnpkg.com/joi/-/joi-18.0.1.tgz#1e1885d035cc6ca1624e81bf22112e7c1ee38e1b" - integrity sha512-IiQpRyypSnLisQf3PwuN2eIHAsAIGZIrLZkd4zdvIar2bDyhM91ubRjy8a3eYablXsh9BeI/c7dmPYHca5qtoA== - dependencies: - "@hapi/address" "^5.1.1" - "@hapi/formula" "^3.0.2" - "@hapi/hoek" "^11.0.7" - "@hapi/pinpoint" "^2.0.1" - "@hapi/tlds" "^1.1.1" - "@hapi/topo" "^6.0.2" - "@standard-schema/spec" "^1.0.0" - -joi@^17.13.1: - version "17.13.3" - resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec" - integrity sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA== - dependencies: - "@hapi/hoek" "^9.3.0" - "@hapi/topo" "^5.1.0" - "@sideway/address" "^4.1.5" - "@sideway/formula" "^3.0.1" - "@sideway/pinpoint" "^2.0.0" - jose@^5.0.0: version "5.10.0" resolved "https://registry.yarnpkg.com/jose/-/jose-5.10.0.tgz#c37346a099d6467c401351a9a0c2161e0f52c4be" @@ -5410,11 +5295,6 @@ util-deprecate@^1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -uuid@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.1.0.tgz#9549028be1753bb934fc96e2bca09bb4105ae912" - integrity sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A== - v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" From 65837fd91741d6d9bd3c43d7b368f03beae43389 Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 09:49:48 +0300 Subject: [PATCH 05/14] refactor(agent-toolkit): update import paths for form tools - Moved CreateFormTool and GetFormTool imports to the workforms-tools directory. - Cleaned up import statements to reflect the new structure. --- .../agent-toolkit/src/core/tools/platform-api-tools/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts index 208c47be..219c8324 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts @@ -2,7 +2,8 @@ import { AllMondayApiTool } from './all-monday-api-tool'; import { BaseMondayApiToolConstructor } from './base-monday-api-tool'; import { ChangeItemColumnValuesTool } from './change-item-column-values-tool'; import { CreateBoardTool } from './create-board-tool'; -import { CreateFormTool } from './create-form-tool'; +import { CreateFormTool } from './workforms-tools/create-form-tool'; +import { GetFormTool } from './workforms-tools/get-form-tool'; import { CreateColumnTool } from './create-column-tool'; import { CreateCustomActivityTool } from './create-custom-activity-tool'; import { CreateItemTool } from './create-item-tool'; @@ -28,7 +29,6 @@ import { CreateDocTool } from './create-doc-tool'; import { CreateDashboardTool } from './dashboard-tools/create-dashboard-tool'; import { AllWidgetsSchemaTool } from './dashboard-tools/all-widgets-schema-tool'; import { CreateWidgetTool } from './dashboard-tools/create-widget-tool'; -import { GetFormTool } from './workforms-tools/get-form-tool'; export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [ DeleteItemTool, From 3bf9bd5444b4d15e012b200de8d389897470151d Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 09:51:45 +0300 Subject: [PATCH 06/14] refactor(agent-toolkit): reorganize form tool imports - Updated import paths for CreateFormTool and GetFormTool to reflect their new location in the workforms-tools directory. - Ensured all relevant tools are correctly exported from the updated structure. --- .../agent-toolkit/src/core/tools/platform-api-tools/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts index 219c8324..6becec28 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/index.ts @@ -67,7 +67,8 @@ export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [ export * from './all-monday-api-tool'; export * from './change-item-column-values-tool'; export * from './create-board-tool'; -export * from './create-form-tool'; +export * from './workforms-tools/create-form-tool'; +export * from './workforms-tools/get-form-tool'; export * from './create-column-tool'; export * from './create-custom-activity-tool'; export * from './create-item-tool'; From de37496499295951331edc1d7e011da931275149 Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 10:34:20 +0300 Subject: [PATCH 07/14] docs(agent-toolkit): update README to include WorkForms operations - Added documentation for CreateFormTool and GetFormTool under WorkForms Operations section. - Enhanced clarity on the toolkit's capabilities for managing forms in monday.com. --- packages/agent-toolkit/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/agent-toolkit/README.md b/packages/agent-toolkit/README.md index 2e8d9f8f..08501954 100644 --- a/packages/agent-toolkit/README.md +++ b/packages/agent-toolkit/README.md @@ -34,6 +34,10 @@ The toolkit includes several pre-built tools for common Monday.com operations, o - `CreateColumnTool` - Create a new column in a monday.com board - `DeleteColumnTool` - Delete a column from a monday.com board +### WorkForms Operations +- `CreateFormTool` - Create a monday.com form +- `GetFormTool` - Get a form by its token, found in the form's URL + ### Account Operations - `GetUsersTool` - Get users, can be filtered by name or partial name From 6b2c384037b517ee987910696209ace4ab42b941 Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 10:53:03 +0300 Subject: [PATCH 08/14] refactor(agent-toolkit): update GraphQL import paths for form tools - Changed import paths for CreateFormTool and GetFormTool to use the new workforms.graphql file. - Removed the old queries.graphql file references to streamline the codebase. --- .../workforms-tools/create-form-tool.ts | 2 +- .../workforms-tools/get-form-tool.ts | 2 +- .../workforms-tools/workforms.graphql.ts | 163 +++++++++++++++++ .../src/monday-graphql/queries.graphql.ts | 166 ------------------ 4 files changed, 165 insertions(+), 168 deletions(-) create mode 100644 packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts index 793f8932..74341e66 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts @@ -4,7 +4,7 @@ import { CreateFormMutation, CreateFormMutationVariables, } from '../../../../monday-graphql/generated/graphql'; -import { createForm } from '../../../../monday-graphql/queries.graphql'; +import { createForm } from './workforms.graphql'; import { ToolInputType, ToolOutputType, ToolType } from '../../../tool'; import { BaseMondayApiTool, createMondayApiAnnotations } from '../base-monday-api-tool'; import { GraphQLDescriptions } from './workforms.consts'; diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts index 543dd2ad..7d45221a 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; import { GetFormQuery, GetFormQueryVariables } from '../../../../monday-graphql/generated/graphql'; -import { getForm } from '../../../../monday-graphql/queries.graphql'; +import { getForm } from './workforms.graphql'; import { ToolInputType, ToolOutputType, ToolType } from '../../../tool'; import { BaseMondayApiTool, createMondayApiAnnotations } from '../base-monday-api-tool'; import { GraphQLDescriptions } from './workforms.consts'; diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts new file mode 100644 index 00000000..7b708a6d --- /dev/null +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts @@ -0,0 +1,163 @@ +import { gql } from 'graphql-request'; + +// Create a new monday form (API version 2025-10) +export const createForm = gql` + mutation createForm( + $destination_workspace_id: Float! + $destination_folder_id: Float + $destination_folder_name: String + $board_kind: BoardKind + $destination_name: String + $board_owner_ids: [Float!] + $board_owner_team_ids: [Float!] + $board_subscriber_ids: [Float!] + $board_subscriber_teams_ids: [Float!] + ) { + create_form( + destination_workspace_id: $destination_workspace_id + destination_folder_id: $destination_folder_id + destination_folder_name: $destination_folder_name + board_kind: $board_kind + destination_name: $destination_name + board_owner_ids: $board_owner_ids + board_owner_team_ids: $board_owner_team_ids + board_subscriber_ids: $board_subscriber_ids + board_subscriber_teams_ids: $board_subscriber_teams_ids + ) { + boardId + token + } + } +`; + +// Fetch a form by its token +export const getForm = gql` + query getForm($formToken: String!) { + form(formToken: $formToken) { + token + type + questions { + id + type + visible + title + description + required + showIfRules + options { + label + } + settings { + prefill { + enabled + source + lookup + } + prefixAutofilled + prefixPredefined { + enabled + prefix + } + checkedByDefault + defaultCurrentDate + includeTime + display + optionsOrder + labelLimitCount + locationAutofilled + limit + skipValidation + } + } + features { + isInternal + reCaptchaChallenge + shortenedLink { + enabled + url + } + password { + enabled + } + draftSubmission { + enabled + } + requireLogin { + enabled + redirectToLogin + } + responseLimit { + enabled + limit + } + closeDate { + enabled + date + } + preSubmissionView { + enabled + title + description + startButton { + text + } + } + afterSubmissionView { + title + description + redirectAfterSubmission { + enabled + redirectUrl + } + allowResubmit + showSuccessImage + allowEditSubmission + allowViewSubmission + } + monday { + itemGroupId + includeNameQuestion + includeUpdateQuestion + syncQuestionAndColumnsTitles + } + } + appearance { + hideBranding + showProgressBar + primaryColor + layout { + format + alignment + direction + } + background { + type + value + } + text { + font + color + size + } + logo { + position + url + size + } + submitButton { + text + } + } + accessibility { + language + logoAltText + } + tags { + id + name + value + columnId + } + } + } +`; diff --git a/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts b/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts index 632b389b..e4f5ce24 100644 --- a/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/queries.graphql.ts @@ -559,169 +559,3 @@ export const getWorkspaceInfo = gql` } } `; - -// ----------------------------- -// WorkForms (Forms) Operations -// ----------------------------- - -// Create a new monday form (API version 2025-10) -export const createForm = gql` - mutation createForm( - $destination_workspace_id: Float! - $destination_folder_id: Float - $destination_folder_name: String - $board_kind: BoardKind - $destination_name: String - $board_owner_ids: [Float!] - $board_owner_team_ids: [Float!] - $board_subscriber_ids: [Float!] - $board_subscriber_teams_ids: [Float!] - ) { - create_form( - destination_workspace_id: $destination_workspace_id - destination_folder_id: $destination_folder_id - destination_folder_name: $destination_folder_name - board_kind: $board_kind - destination_name: $destination_name - board_owner_ids: $board_owner_ids - board_owner_team_ids: $board_owner_team_ids - board_subscriber_ids: $board_subscriber_ids - board_subscriber_teams_ids: $board_subscriber_teams_ids - ) { - boardId - token - } - } -`; - -// Fetch a form by its token -export const getForm = gql` - query getForm($formToken: String!) { - form(formToken: $formToken) { - token - type - questions { - id - type - visible - title - description - required - showIfRules - options { - label - } - settings { - prefill { - enabled - source - lookup - } - prefixAutofilled - prefixPredefined { - enabled - prefix - } - checkedByDefault - defaultCurrentDate - includeTime - display - optionsOrder - labelLimitCount - locationAutofilled - limit - skipValidation - } - } - features { - isInternal - reCaptchaChallenge - shortenedLink { - enabled - url - } - password { - enabled - } - draftSubmission { - enabled - } - requireLogin { - enabled - redirectToLogin - } - responseLimit { - enabled - limit - } - closeDate { - enabled - date - } - preSubmissionView { - enabled - title - description - startButton { - text - } - } - afterSubmissionView { - title - description - redirectAfterSubmission { - enabled - redirectUrl - } - allowResubmit - showSuccessImage - allowEditSubmission - allowViewSubmission - } - monday { - itemGroupId - includeNameQuestion - includeUpdateQuestion - syncQuestionAndColumnsTitles - } - } - appearance { - hideBranding - showProgressBar - primaryColor - layout { - format - alignment - direction - } - background { - type - value - } - text { - font - color - size - } - logo { - position - url - size - } - submitButton { - text - } - } - accessibility { - language - logoAltText - } - tags { - id - name - value - columnId - } - } - } -`; From f42c2dc7ab46532153162bc0603c2444c908fc4b Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 16:34:10 +0300 Subject: [PATCH 09/14] docs(agent-toolkit): enhance GetFormTool description for clarity - Updated the description of GetFormTool to provide detailed information on extracting form tokens from URLs. - Clarified the format of the form URL and the location of the token within it. --- .../tools/platform-api-tools/workforms-tools/get-form-tool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts index 7d45221a..a203df8b 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts @@ -19,7 +19,7 @@ export class GetFormTool extends BaseMondayApiTool Date: Thu, 28 Aug 2025 16:36:31 +0300 Subject: [PATCH 10/14] docs(agent-toolkit): enhance CreateFormTool description for clarity - Updated the description of CreateFormTool to provide detailed information on the creation of a new form and associated board. - Clarified the significance of the returned board_id and formToken for future queries and mutations. --- .../platform-api-tools/workforms-tools/create-form-tool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts index 74341e66..a76b06aa 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/create-form-tool.ts @@ -35,7 +35,7 @@ export class CreateFormTool extends BaseMondayApiTool Date: Thu, 28 Aug 2025 17:24:45 +0300 Subject: [PATCH 11/14] docs(README): add WorkForms operations to documentation - Included create_form and get_form operations under the WorkForms Operations section in the README. - Enhanced documentation to reflect the toolkit's capabilities for managing forms in monday.com. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 66bcdd30..f4a64462 100644 --- a/README.md +++ b/README.md @@ -217,6 +217,8 @@ Our MCP server provides a rich set of tools that give AI assistants the ability | | create_column | Add a new column to an existing board | | | delete_column | Remove a column from a board | | **Account Operations** | get_users_by_name | Retrieve user information by name or partial name | +| **WorkForms Operations** | create_form | Create a new monday.com form | +| | get_form | Get a form by its token | ## 🔮 Dynamic API Tools (Beta) From 962197b7f9c23193858be9627141009d77ac9e20 Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 17:34:41 +0300 Subject: [PATCH 12/14] feat(agent-toolkit): enhance GetFormTool with minimal form retrieval option - Added support for fetching a minimal version of the form with core properties through the new getMinimalForm GraphQL query. - Introduced an optional parameter `includeFullFormDetails` in the GetFormTool schema to toggle between full and minimal form details. - Updated GraphQL descriptions to clarify the new functionality and its usage. --- .../workforms-tools/get-form-tool.ts | 7 ++-- .../workforms-tools/workforms.consts.ts | 2 ++ .../workforms-tools/workforms.graphql.ts | 34 ++++++++++++++++++- .../src/monday-graphql/generated/graphql.ts | 1 + 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts index a203df8b..7b141317 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts @@ -1,12 +1,13 @@ import { z } from 'zod'; import { GetFormQuery, GetFormQueryVariables } from '../../../../monday-graphql/generated/graphql'; -import { getForm } from './workforms.graphql'; +import { getForm, getMinimalForm } from './workforms.graphql'; import { ToolInputType, ToolOutputType, ToolType } from '../../../tool'; import { BaseMondayApiTool, createMondayApiAnnotations } from '../base-monday-api-tool'; import { GraphQLDescriptions } from './workforms.consts'; export const getFormToolSchema = { formToken: z.string().describe(GraphQLDescriptions.commonArgs.formToken), + includeFullFormDetails: z.boolean().optional().describe(GraphQLDescriptions.form.args.includeFullFormDetails), }; export class GetFormTool extends BaseMondayApiTool { @@ -29,9 +30,11 @@ export class GetFormTool extends BaseMondayApiTool): Promise> { const variables: GetFormQueryVariables = { formToken: input.formToken, + includeFullFormDetails: input.includeFullFormDetails ?? false, }; - const res = await this.mondayApi.request(getForm, variables); + const queryToUse = input.includeFullFormDetails ? getForm : getMinimalForm; + const res = await this.mondayApi.request(queryToUse, variables); if (!res.form) { return { diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.consts.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.consts.ts index cd146419..37a8e730 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.consts.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.consts.ts @@ -38,6 +38,8 @@ export const GraphQLDescriptions = { }, args: { formToken: 'The unique form token identifying which form to operate on.', + includeFullFormDetails: + 'Boolean indicating if the full form details should be included in the response. Default will be to only return the core properties of the form and its questions', destinationWorkspaceId: 'The workspace in which the form will be created in.', destinationFolderId: 'The folder in which the form will be created under.', destinationFolderName: 'The name of the folder in which the form will be created in.', diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts index 7b708a6d..75c89943 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts @@ -30,12 +30,44 @@ export const createForm = gql` } `; -// Fetch a form by its token +// Fetch a minimal form with only the core properties by its token +export const getMinimalForm = gql` + query getMinimalForm($formToken: String!) { + form(formToken: $formToken) { + id + token + ownerId + active + title + description + questions { + id + title + type + visible + required + showIfRules + options { + label + } + } + } + } +`; + +// Fetch a full form with all its details by its token export const getForm = gql` query getForm($formToken: String!) { form(formToken: $formToken) { + id token + title + description + active + ownerId type + builtWitAI + isAnonymous questions { id type diff --git a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts index 149f3bc4..e0df0452 100644 --- a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts @@ -8467,6 +8467,7 @@ export type CreateFormMutation = { __typename?: 'Mutation', create_form?: { __ty export type GetFormQueryVariables = Exact<{ formToken: Scalars['String']['input']; + includeFullFormDetails?: InputMaybe; }>; export type GetFormQuery = { __typename?: 'Query', form?: Form & { __typename?: 'Form' } | null }; From e28ceb9fe3686e87aaf7bca40d2549d57680f2e0 Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 17:43:17 +0300 Subject: [PATCH 13/14] fix(workforms.graphql): correct typo in field name from 'builtWitAI' to 'builtWithAI' --- .../platform-api-tools/workforms-tools/workforms.graphql.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts index 75c89943..6400d8db 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts @@ -66,7 +66,7 @@ export const getForm = gql` active ownerId type - builtWitAI + builtWithAI isAnonymous questions { id From 8f1e7da97d35607ea101aedb3ef0c2df092d874d Mon Sep 17 00:00:00 2001 From: Guy Hadas Date: Thu, 28 Aug 2025 17:45:15 +0300 Subject: [PATCH 14/14] refactor(GetFormTool): remove minimal form retrieval option - Eliminated the `includeFullFormDetails` parameter from the GetFormTool schema. - Updated the executeInternal method to always fetch the full form using the getForm query. - Removed the getMinimalForm query from the workforms.graphql file to streamline the codebase. --- .../workforms-tools/get-form-tool.ts | 7 ++---- .../workforms-tools/workforms.graphql.ts | 25 ------------------- .../src/monday-graphql/generated/graphql.ts | 1 - 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts index 7b141317..a203df8b 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/get-form-tool.ts @@ -1,13 +1,12 @@ import { z } from 'zod'; import { GetFormQuery, GetFormQueryVariables } from '../../../../monday-graphql/generated/graphql'; -import { getForm, getMinimalForm } from './workforms.graphql'; +import { getForm } from './workforms.graphql'; import { ToolInputType, ToolOutputType, ToolType } from '../../../tool'; import { BaseMondayApiTool, createMondayApiAnnotations } from '../base-monday-api-tool'; import { GraphQLDescriptions } from './workforms.consts'; export const getFormToolSchema = { formToken: z.string().describe(GraphQLDescriptions.commonArgs.formToken), - includeFullFormDetails: z.boolean().optional().describe(GraphQLDescriptions.form.args.includeFullFormDetails), }; export class GetFormTool extends BaseMondayApiTool { @@ -30,11 +29,9 @@ export class GetFormTool extends BaseMondayApiTool): Promise> { const variables: GetFormQueryVariables = { formToken: input.formToken, - includeFullFormDetails: input.includeFullFormDetails ?? false, }; - const queryToUse = input.includeFullFormDetails ? getForm : getMinimalForm; - const res = await this.mondayApi.request(queryToUse, variables); + const res = await this.mondayApi.request(getForm, variables); if (!res.form) { return { diff --git a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts index 6400d8db..2e3e06b1 100644 --- a/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts +++ b/packages/agent-toolkit/src/core/tools/platform-api-tools/workforms-tools/workforms.graphql.ts @@ -30,31 +30,6 @@ export const createForm = gql` } `; -// Fetch a minimal form with only the core properties by its token -export const getMinimalForm = gql` - query getMinimalForm($formToken: String!) { - form(formToken: $formToken) { - id - token - ownerId - active - title - description - questions { - id - title - type - visible - required - showIfRules - options { - label - } - } - } - } -`; - // Fetch a full form with all its details by its token export const getForm = gql` query getForm($formToken: String!) { diff --git a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts index bd6e598d..09c163c5 100644 --- a/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts +++ b/packages/agent-toolkit/src/monday-graphql/generated/graphql.ts @@ -8534,7 +8534,6 @@ export type CreateFormMutation = { __typename?: 'Mutation', create_form?: { __ty export type GetFormQueryVariables = Exact<{ formToken: Scalars['String']['input']; - includeFullFormDetails?: InputMaybe; }>; export type GetFormQuery = { __typename?: 'Query', form?: Form & { __typename?: 'Form' } | null };