Skip to content
Open
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.1.0",
"version": "3.1.1",
"description": "monday.com agent toolkit",
"exports": {
"./mcp": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { createMockApiClient } from './test-utils/mock-api-client';
import { ChangeItemColumnValuesTool } from './change-item-column-values-tool';

describe('ChangeItemColumnValuesTool', () => {
let mocks: ReturnType<typeof createMockApiClient>;

beforeEach(() => {
mocks = createMockApiClient();
jest.clearAllMocks();
});

const successfulResponse = {
change_multiple_column_values: {
id: '123456789',
},
};

describe('with boardId in context', () => {
it('calls the mutation with correct variables including options.disable_undo=false', async () => {
mocks.setResponse(successfulResponse);

const tool = new ChangeItemColumnValuesTool(mocks.mockApiClient, 'fake_token', { boardId: 456 });
const result = await tool.execute({
itemId: 123,
columnValues: '{"text_column": "New Value"}',
});

expect(result.content).toBe('Item 123456789 successfully updated with the new column values');
expect(mocks.getMockRequest()).toHaveBeenCalledWith(
expect.stringContaining('mutation changeItemColumnValues'),
{
boardId: '456',
itemId: '123',
columnValues: '{"text_column": "New Value"}',
options: { disable_undo: false },
},
);
});
});

describe('with boardId in input', () => {
it('calls the mutation with correct variables including options.disable_undo=false', async () => {
mocks.setResponse(successfulResponse);

const tool = new ChangeItemColumnValuesTool(mocks.mockApiClient, 'fake_token');
const result = await tool.execute({
boardId: 789,
itemId: 123,
columnValues: '{"status_column": {"label": "Done"}}',
});

expect(result.content).toBe('Item 123456789 successfully updated with the new column values');
expect(mocks.getMockRequest()).toHaveBeenCalledWith(
expect.stringContaining('mutation changeItemColumnValues'),
{
boardId: '789',
itemId: '123',
columnValues: '{"status_column": {"label": "Done"}}',
options: { disable_undo: false },
},
);
});
});

it('propagates errors from the API', async () => {
mocks.setError('Something went wrong');

const tool = new ChangeItemColumnValuesTool(mocks.mockApiClient, 'fake_token', { boardId: 456 });

await expect(
tool.execute({
itemId: 123,
columnValues: '{"text_column": "New Value"}',
}),
).rejects.toThrow('Something went wrong');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class ChangeItemColumnValuesTool extends BaseMondayApiTool<ChangeItemColu
boardId: boardId.toString(),
itemId: input.itemId.toString(),
columnValues: input.columnValues,
options: { disable_undo: false },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options addition looks good. One thing — per the mcp-tool guide:

When modifying an existing tool's behavior, review and update getDescription() to reflect the new capabilities.

getDescription() above still returns 'Change the column values of an item in a monday.com board' with no mention that changes are now undoable. Consider updating it, e.g.:

return 'Change the column values of an item in a monday.com board. Changes made through this tool can be undone by the user.';

This way agents could inform users that the action is reversible.

};

const res = await this.mondayApi.request<ChangeItemColumnValuesMutation>(changeItemColumnValues, variables);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type Documents = {
"\n mutation DeleteItem($id: ID!) {\n delete_item(item_id: $id) {\n id\n }\n }\n": typeof types.DeleteItemDocument,
"\n mutation createItem($boardId: ID!, $itemName: String!, $groupId: String, $columnValues: JSON) {\n create_item(board_id: $boardId, item_name: $itemName, group_id: $groupId, column_values: $columnValues) {\n id\n name\n }\n }\n": typeof types.CreateItemDocument,
"\n query getBoardSchema($boardId: ID!) {\n boards(ids: [$boardId]) {\n groups {\n id\n title\n }\n columns {\n id\n type\n title\n }\n }\n }\n": typeof types.GetBoardSchemaDocument,
"\n mutation changeItemColumnValues($boardId: ID!, $itemId: ID!, $columnValues: JSON!) {\n change_multiple_column_values(board_id: $boardId, item_id: $itemId, column_values: $columnValues) {\n id\n }\n }\n": typeof types.ChangeItemColumnValuesDocument,
"\n mutation changeItemColumnValues($boardId: ID!, $itemId: ID!, $columnValues: JSON!, $options: JSON) {\n change_multiple_column_values(board_id: $boardId, item_id: $itemId, column_values: $columnValues, options: $options) {\n id\n }\n }\n": typeof types.ChangeItemColumnValuesDocument,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth confirming that npm run codegen (or npm run fetch:generate) was run to regenerate these files, rather than hand-editing them. The mcp-tool guide marks this as CRITICAL after any .graphql.ts change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is here just to make sure you did the edit through the command and not manually

"\n mutation moveItemToGroup($itemId: ID!, $groupId: String!) {\n move_item_to_group(item_id: $itemId, group_id: $groupId) {\n id\n }\n }\n": typeof types.MoveItemToGroupDocument,
"\n mutation createBoard($boardKind: BoardKind!, $boardName: String!, $boardDescription: String, $workspaceId: ID) {\n create_board(\n board_kind: $boardKind\n board_name: $boardName\n description: $boardDescription\n workspace_id: $workspaceId\n empty: true\n ) {\n id\n }\n }\n": typeof types.CreateBoardDocument,
"\n mutation createColumn(\n $boardId: ID!\n $columnType: ColumnType!\n $columnTitle: String!\n $columnDescription: String\n $columnSettings: JSON\n ) {\n create_column(\n board_id: $boardId\n column_type: $columnType\n title: $columnTitle\n description: $columnDescription\n defaults: $columnSettings\n ) {\n id\n }\n }\n": typeof types.CreateColumnDocument,
Expand Down Expand Up @@ -200,7 +200,7 @@ const documents: Documents = {
"\n mutation DeleteItem($id: ID!) {\n delete_item(item_id: $id) {\n id\n }\n }\n": types.DeleteItemDocument,
"\n mutation createItem($boardId: ID!, $itemName: String!, $groupId: String, $columnValues: JSON) {\n create_item(board_id: $boardId, item_name: $itemName, group_id: $groupId, column_values: $columnValues) {\n id\n name\n }\n }\n": types.CreateItemDocument,
"\n query getBoardSchema($boardId: ID!) {\n boards(ids: [$boardId]) {\n groups {\n id\n title\n }\n columns {\n id\n type\n title\n }\n }\n }\n": types.GetBoardSchemaDocument,
"\n mutation changeItemColumnValues($boardId: ID!, $itemId: ID!, $columnValues: JSON!) {\n change_multiple_column_values(board_id: $boardId, item_id: $itemId, column_values: $columnValues) {\n id\n }\n }\n": types.ChangeItemColumnValuesDocument,
"\n mutation changeItemColumnValues($boardId: ID!, $itemId: ID!, $columnValues: JSON!, $options: JSON) {\n change_multiple_column_values(board_id: $boardId, item_id: $itemId, column_values: $columnValues, options: $options) {\n id\n }\n }\n": types.ChangeItemColumnValuesDocument,
"\n mutation moveItemToGroup($itemId: ID!, $groupId: String!) {\n move_item_to_group(item_id: $itemId, group_id: $groupId) {\n id\n }\n }\n": types.MoveItemToGroupDocument,
"\n mutation createBoard($boardKind: BoardKind!, $boardName: String!, $boardDescription: String, $workspaceId: ID) {\n create_board(\n board_kind: $boardKind\n board_name: $boardName\n description: $boardDescription\n workspace_id: $workspaceId\n empty: true\n ) {\n id\n }\n }\n": types.CreateBoardDocument,
"\n mutation createColumn(\n $boardId: ID!\n $columnType: ColumnType!\n $columnTitle: String!\n $columnDescription: String\n $columnSettings: JSON\n ) {\n create_column(\n board_id: $boardId\n column_type: $columnType\n title: $columnTitle\n description: $columnDescription\n defaults: $columnSettings\n ) {\n id\n }\n }\n": types.CreateColumnDocument,
Expand Down Expand Up @@ -573,7 +573,7 @@ export function graphql(source: "\n query getBoardSchema($boardId: ID!) {\n
/**
* 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 changeItemColumnValues($boardId: ID!, $itemId: ID!, $columnValues: JSON!) {\n change_multiple_column_values(board_id: $boardId, item_id: $itemId, column_values: $columnValues) {\n id\n }\n }\n"): (typeof documents)["\n mutation changeItemColumnValues($boardId: ID!, $itemId: ID!, $columnValues: JSON!) {\n change_multiple_column_values(board_id: $boardId, item_id: $itemId, column_values: $columnValues) {\n id\n }\n }\n"];
export function graphql(source: "\n mutation changeItemColumnValues($boardId: ID!, $itemId: ID!, $columnValues: JSON!, $options: JSON) {\n change_multiple_column_values(board_id: $boardId, item_id: $itemId, column_values: $columnValues, options: $options) {\n id\n }\n }\n"): (typeof documents)["\n mutation changeItemColumnValues($boardId: ID!, $itemId: ID!, $columnValues: JSON!, $options: JSON) {\n change_multiple_column_values(board_id: $boardId, item_id: $itemId, column_values: $columnValues, options: $options) {\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
Loading