Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/agent-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mondaydotcomorg/agent-toolkit",
"version": "3.0.4",
"version": "3.0.5",
"description": "monday.com agent toolkit",
"exports": {
"./mcp": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('Create Update Tool', () => {
itemId: '456',
body: 'This is a test update',
mentionsList: undefined,
parentId: undefined,
});
});

Expand All @@ -48,6 +49,26 @@ describe('Create Update Tool', () => {
{ id: '12345', type: 'User' },
{ id: '456', type: 'Team' },
],
parentId: undefined,
});
});

it('Successfully creates a reply to an existing update using parentId', async () => {
mocks.setResponse(successfulResponse);
const tool = new CreateUpdateTool(mocks.mockApiClient, 'fake_token');

const result = await tool.execute({
itemId: 456,
body: 'This is a reply',
parentId: 111222,
});

expect(result.content).toBe('Update 123456789 successfully created on item 456');
expect(mocks.getMockRequest()).toHaveBeenCalledWith(expect.stringContaining('mutation createUpdate'), {
itemId: '456',
body: 'This is a reply',
mentionsList: undefined,
parentId: '111222',
});
});

Expand Down Expand Up @@ -156,6 +177,7 @@ describe('Create Update Tool', () => {
{ id: '3', type: 'Board' },
{ id: '4', type: 'Project' },
],
parentId: undefined,
});
});

Expand Down Expand Up @@ -186,5 +208,7 @@ describe('Create Update Tool', () => {
expect(() => schema.itemId.parse(123)).not.toThrow();
expect(() => schema.body.parse('test')).not.toThrow();
expect(() => schema.mentionsList.parse(undefined)).not.toThrow();
expect(() => schema.parentId.parse(undefined)).not.toThrow();
expect(() => schema.parentId.parse(999)).not.toThrow();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export const createUpdateToolSchema = {
.describe(
'Optional JSON array of mentions in the format: [{"id": "123", "type": "User"}, {"id": "456", "type": "Team"}]. Valid types are: User, Team, Board, Project',
),
parentId: z
.number()
.optional()
.describe('The ID of the update to reply to. Use this parameter when you want to reply on an existing update leave it empty if you want to create a new update'),
};

export class CreateUpdateTool extends BaseMondayApiTool<typeof createUpdateToolSchema> {
Expand All @@ -43,7 +47,7 @@ export class CreateUpdateTool extends BaseMondayApiTool<typeof createUpdateToolS
});

getDescription(): string {
return 'Create a new update (comment/post) on a monday.com item. Updates can be used to add comments, notes, or discussions to items. You can optionally mention users, teams, or boards in the update.';
return 'Create a new update (comment/post) on a monday.com item. Updates can be used to add comments, notes, or discussions to items. You can optionally mention users, teams, or boards in the update. You can also reply to an existing update by using the parentId parameter.';
}

getInputSchema(): typeof createUpdateToolSchema {
Expand Down Expand Up @@ -73,6 +77,7 @@ export class CreateUpdateTool extends BaseMondayApiTool<typeof createUpdateToolS
itemId: input.itemId.toString(),
body: input.body,
mentionsList: parsedMentionsList,
parentId: input.parentId?.toString(),
};

const res = await this.mondayApi.request<CreateUpdateMutation>(createUpdate, variables);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { gql } from 'graphql-request';

export const createUpdate = gql`
mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention]) {
create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList) {
mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention], $parentId: ID) {
create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList, parent_id: $parentId) {
id
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Documents = {
"\n mutation createSubitem($parentItemId: ID!, $itemName: String!, $columnValues: JSON) {\n create_subitem(parent_item_id: $parentItemId, item_name: $itemName, column_values: $columnValues) {\n id\n name\n parent_item {\n id\n }\n }\n }\n": typeof types.CreateSubitemDocument,
"\n mutation duplicateItem($boardId: ID!, $itemId: ID!, $withUpdates: Boolean) {\n duplicate_item(board_id: $boardId, item_id: $itemId, with_updates: $withUpdates) {\n id\n name\n }\n }\n": typeof types.DuplicateItemDocument,
"\n mutation createNotification($user_id: ID!, $target_id: ID!, $text: String!, $target_type: NotificationTargetType!) {\n create_notification(user_id: $user_id, target_id: $target_id, text: $text, target_type: $target_type) {\n text\n }\n }\n": typeof types.CreateNotificationDocument,
"\n mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention]) {\n create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList) {\n id\n }\n }\n": typeof types.CreateUpdateDocument,
"\n mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention], $parentId: ID) {\n create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList, parent_id: $parentId) {\n id\n }\n }\n": typeof types.CreateUpdateDocument,
"\n mutation createWorkspace(\n $name: String!\n $workspaceKind: WorkspaceKind!\n $description: String\n $accountProductId: ID\n ) {\n create_workspace(\n name: $name\n kind: $workspaceKind\n description: $description\n account_product_id: $accountProductId\n ) {\n id\n }\n }\n": typeof types.CreateWorkspaceDocument,
"\n mutation CreateDashboard(\n $name: String!\n $workspace_id: ID!\n $board_ids: [ID!]!\n $kind: DashboardKind\n $board_folder_id: ID\n ) {\n create_dashboard(\n name: $name\n workspace_id: $workspace_id\n board_ids: $board_ids\n kind: $kind\n board_folder_id: $board_folder_id\n ) {\n id\n name\n workspace_id\n kind\n board_folder_id\n }\n }\n": typeof types.CreateDashboardDocument,
"\n query GetAllWidgetsSchema {\n all_widgets_schema {\n widget_type\n schema\n }\n }\n": typeof types.GetAllWidgetsSchemaDocument,
Expand Down Expand Up @@ -127,7 +127,7 @@ const documents: Documents = {
"\n mutation createSubitem($parentItemId: ID!, $itemName: String!, $columnValues: JSON) {\n create_subitem(parent_item_id: $parentItemId, item_name: $itemName, column_values: $columnValues) {\n id\n name\n parent_item {\n id\n }\n }\n }\n": types.CreateSubitemDocument,
"\n mutation duplicateItem($boardId: ID!, $itemId: ID!, $withUpdates: Boolean) {\n duplicate_item(board_id: $boardId, item_id: $itemId, with_updates: $withUpdates) {\n id\n name\n }\n }\n": types.DuplicateItemDocument,
"\n mutation createNotification($user_id: ID!, $target_id: ID!, $text: String!, $target_type: NotificationTargetType!) {\n create_notification(user_id: $user_id, target_id: $target_id, text: $text, target_type: $target_type) {\n text\n }\n }\n": types.CreateNotificationDocument,
"\n mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention]) {\n create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList) {\n id\n }\n }\n": types.CreateUpdateDocument,
"\n mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention], $parentId: ID) {\n create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList, parent_id: $parentId) {\n id\n }\n }\n": types.CreateUpdateDocument,
"\n mutation createWorkspace(\n $name: String!\n $workspaceKind: WorkspaceKind!\n $description: String\n $accountProductId: ID\n ) {\n create_workspace(\n name: $name\n kind: $workspaceKind\n description: $description\n account_product_id: $accountProductId\n ) {\n id\n }\n }\n": types.CreateWorkspaceDocument,
"\n mutation CreateDashboard(\n $name: String!\n $workspace_id: ID!\n $board_ids: [ID!]!\n $kind: DashboardKind\n $board_folder_id: ID\n ) {\n create_dashboard(\n name: $name\n workspace_id: $workspace_id\n board_ids: $board_ids\n kind: $kind\n board_folder_id: $board_folder_id\n ) {\n id\n name\n workspace_id\n kind\n board_folder_id\n }\n }\n": types.CreateDashboardDocument,
"\n query GetAllWidgetsSchema {\n all_widgets_schema {\n widget_type\n schema\n }\n }\n": types.GetAllWidgetsSchemaDocument,
Expand Down Expand Up @@ -285,7 +285,7 @@ export function graphql(source: "\n mutation createNotification($user_id: ID!,
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention]) {\n create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList) {\n id\n }\n }\n"): (typeof documents)["\n mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention]) {\n create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList) {\n id\n }\n }\n"];
export function graphql(source: "\n mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention], $parentId: ID) {\n create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList, parent_id: $parentId) {\n id\n }\n }\n"): (typeof documents)["\n mutation createUpdate($itemId: ID!, $body: String!, $mentionsList: [UpdateMention], $parentId: ID) {\n create_update(body: $body, item_id: $itemId, mentions_list: $mentionsList, parent_id: $parentId) {\n id\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading