Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { z } from 'zod';
import { BaseMondayApiTool } from './base-monday-api-tool';
import { BoardViewTypeValues } from '../../monday-graphql/generated/graphql';
import { ToolInputType, ToolOutputType, ToolType } from '../tool';
import { createBoardView } from '../../monday-graphql/queries.graphql';

export const createBoardViewToolSchema = {
boardId: z.string().describe('The ID of the board to create the view in'),
name: z.string().describe('The name of the board view'),
type: z.nativeEnum(BoardViewTypeValues).describe('The type of board view to create'),
};

export class CreateBoardViewTool extends BaseMondayApiTool<typeof createBoardViewToolSchema> {
name = 'create_board_view';
type = ToolType.MUTATION;

getDescription(): string {
return 'Create a new board view in a monday.com board';
}

getInputSchema(): typeof createBoardViewToolSchema {
return createBoardViewToolSchema;
}

async execute(input: ToolInputType<typeof createBoardViewToolSchema>): Promise<ToolOutputType<never>> {
const variables = {
boardId: input.boardId,
name: input.name,
type: input.type,
};

const res = await this.mondayApi.request(createBoardView, variables);

return {
content: `Board view '${input.name}' of type ${input.type} successfully created in board ${input.boardId}`,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,32 @@ export const createItemToolSchema = {
columnValues: z
.string()
.describe(
`A string containing the new column values for the item following this structure: {\\"column_id\\": \\"value\\",... you can change multiple columns at once, note that for status column you must use nested value with 'label' as a key and for date column use 'date' as key} - example: "{\\"text_column_id\\":\\"New text\\", \\"status_column_id\\":{\\"label\\":\\"Done\\"}, \\"date_column_id\\":{\\"date\\":\\"2023-05-25\\"},\\"dropdown_id\\":\\"value\\", \\"phone_id\\":\\"123-456-7890\\", \\"email_id\\":\\"[email protected]\\"}"`,
`A string containing the new column values for the item following this structure:
{
"column_id": "value",
// You can change multiple columns at once
// For status columns, use nested value with 'label' as key
// For date columns, use 'date' as key
}

Example:
{
"text_column_id": "New text",
"status_column_id": {
"label": "Done"
},
"date_column_id": {
"date": "2023-05-25"
},
"phone_id": {
"phone": "12025550172",
"countryShortName": "US"
},
"email_id": {
"email": "[email protected]",
"text": "This is an example email"
}
}`
),
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { z } from 'zod';
import { BaseMondayApiTool } from './base-monday-api-tool';
import { ToolInputType, ToolOutputType, ToolType } from '../tool';
import { createWorkspace } from '../../monday-graphql/queries.graphql';
import { Mutation, MutationCreate_WorkspaceArgs, WorkspaceKind } from '../../monday-graphql/generated/graphql';

export const createWorkspaceToolSchema = {
name: z.string().describe('The name of the workspace to create'),
kind: z.nativeEnum(WorkspaceKind).default(WorkspaceKind.Open).describe('The kind of workspace to create (open or closed)'),
description: z.string().optional().describe('The description of the workspace'),
};

export class CreateWorkspaceTool extends BaseMondayApiTool<typeof createWorkspaceToolSchema> {
name = 'create_workspace';
type = ToolType.MUTATION;

getDescription(): string {
return 'Create a new workspace in monday.com';
}

getInputSchema(): typeof createWorkspaceToolSchema {
return createWorkspaceToolSchema;
}

async execute(input: ToolInputType<typeof createWorkspaceToolSchema>): Promise<ToolOutputType<never>> {
const variables: MutationCreate_WorkspaceArgs = {
name: input.name,
kind: input.kind,
description: input.description,
};

const res = await this.mondayApi.request<Pick<Mutation, 'create_workspace'>>(createWorkspace, variables);

return {
content: `Workspace ${res.create_workspace?.id} successfully created`,
};
}
}
6 changes: 6 additions & 0 deletions packages/agent-toolkit/src/core/platform-api-tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { GetTypeDetailsTool } from './get-type-details-tool';
import { CreateCustomActivityTool } from './create-custom-activity-tool';
import { CreateTimelineItemTool } from './create-timeline-item-tool';
import { FetchCustomActivityTool } from './fetch-custom-activity-tool';
import { CreateBoardViewTool } from './create-board-view-tool';
import { CreateWorkspaceTool } from './create-workspace-tool';

export const allTools = [
DeleteItemTool,
Expand All @@ -34,6 +36,8 @@ export const allTools = [
CreateCustomActivityTool,
CreateTimelineItemTool,
FetchCustomActivityTool,
CreateBoardViewTool,
CreateWorkspaceTool,
];

export * from './delete-item-tool';
Expand All @@ -53,3 +57,5 @@ export * from './get-type-details-tool';
export * from './create-custom-activity-tool';
export * from './create-timeline-item-tool';
export * from './fetch-custom-activity-tool';
export * from './create-board-view-tool';
export * from './create-workspace-tool';
1 change: 0 additions & 1 deletion packages/agent-toolkit/src/mcp/toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class MondayAgentToolkit extends McpServer {
name: 'monday.com',
version: '1.0.0',
});

this.mondayApiClient = new ApiClient({
token: config.mondayApiToken,
apiVersion: config.mondayApiVersion,
Expand Down
44 changes: 43 additions & 1 deletion packages/agent-toolkit/src/monday-graphql/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,20 @@ export type BoardView = {
view_specific_data_str: Scalars['String']['output'];
};

/** The available board view types. */
export enum BoardViewTypeValues {
/** Calendar board view. */
CalendarBoardView = 'CalendarBoardView',
/** Doc board view. */
DocBoardView = 'DocBoardView',
/** Empty board view. */
EmptyBoardView = 'EmptyBoardView',
/** Form board view. */
FormBoardView = 'FormBoardView',
/** Table board view. */
TableBoardView = 'TableBoardView'
}

/** Options to order by. */
export enum BoardsOrderBy {
/** The rank order of the board creation time (desc). */
Expand Down Expand Up @@ -2161,6 +2175,8 @@ export type Mutation = {
complexity?: Maybe<Complexity>;
/** Create a new board. */
create_board?: Maybe<Board>;
/** Create a new board view. */
create_board_view?: Maybe<BoardView>;
/** Create a new column in board. */
create_column?: Maybe<Column>;
create_custom_activity?: Maybe<CustomActivity>;
Expand Down Expand Up @@ -2463,6 +2479,14 @@ export type MutationCreate_BoardArgs = {
};


/** Update your monday.com data. */
export type MutationCreate_Board_ViewArgs = {
board_id: Scalars['ID']['input'];
name: Scalars['String']['input'];
type: BoardViewTypeValues;
};


/** Update your monday.com data. */
export type MutationCreate_ColumnArgs = {
after_column_id?: InputMaybe<Scalars['ID']['input']>;
Expand Down Expand Up @@ -4766,6 +4790,15 @@ export type DeleteColumnMutationVariables = Exact<{

export type DeleteColumnMutation = { __typename?: 'Mutation', delete_column?: { __typename?: 'Column', id: string } | null };

export type CreateWorkspaceMutationVariables = Exact<{
name: Scalars['String']['input'];
kind: WorkspaceKind;
description?: InputMaybe<Scalars['String']['input']>;
}>;


export type CreateWorkspaceMutation = { __typename?: 'Mutation', create_workspace?: { __typename?: 'Workspace', id?: string | null } | null };

export type GetGraphQlSchemaQueryVariables = Exact<{ [key: string]: never; }>;


Expand All @@ -4785,7 +4818,7 @@ export type TypeRefFragment = { __typename?: '__Type', kind: __TypeKind, name?:
export type GetTypeDetailsQueryVariables = Exact<{ [key: string]: never; }>;


export type GetTypeDetailsQuery = { __typename?: 'Query', __type?: { __typename?: '__Type', name?: string | null, description?: string | null, kind: __TypeKind, fields?: Array<{ __typename?: '__Field', name: string, description?: string | null, type: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind } | null } | null } | null } | null }, args: Array<{ __typename?: '__InputValue', name: string, description?: string | null, defaultValue?: string | null, type: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind } | null } | null } | null } }> }> | null, inputFields?: Array<{ __typename?: '__InputValue', name: string, description?: string | null, defaultValue?: string | null, type: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind } | null } | null } | null } | null } }> | null, interfaces?: Array<{ __typename?: '__Type', name?: string | null }> | null, enumValues?: Array<{ __typename?: '__EnumValue', name: string, description?: string | null }> | null, possibleTypes?: Array<{ __typename?: '__Type', name?: string | null }> | null } | null };
export type GetTypeDetailsQuery = { __typename?: 'Query', __type?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, description?: string | null, fields?: Array<{ __typename?: '__Field', name: string, description?: string | null, type: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind } | null } | null } }> | null, enumValues?: Array<{ __typename?: '__EnumValue', name: string, description?: string | null }> | null, inputFields?: Array<{ __typename?: '__InputValue', name: string, description?: string | null, type: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind, ofType?: { __typename?: '__Type', name?: string | null, kind: __TypeKind } | null } | null } }> | null } | null };

export type CreateCustomActivityMutationVariables = Exact<{
color: CustomActivityColor;
Expand Down Expand Up @@ -4816,3 +4849,12 @@ export type FetchCustomActivityQueryVariables = Exact<{ [key: string]: never; }>


export type FetchCustomActivityQuery = { __typename?: 'Query', custom_activity?: Array<{ __typename?: 'CustomActivity', color?: CustomActivityColor | null, icon_id?: CustomActivityIcon | null, id?: string | null, name?: string | null, type?: string | null }> | null };

export type CreateBoardViewMutationVariables = Exact<{
boardId: Scalars['ID']['input'];
name: Scalars['String']['input'];
type: BoardViewTypeValues;
}>;


export type CreateBoardViewMutation = { __typename?: 'Mutation', create_board_view?: { __typename?: 'BoardView', id: string, name: string, type: string } | null };
81 changes: 31 additions & 50 deletions packages/agent-toolkit/src/monday-graphql/queries.graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ export const deleteColumn = gql`
}
`;

export const createWorkspace = gql`
mutation createWorkspace($name: String!, $kind: WorkspaceKind!, $description: String) {
create_workspace(name: $name, kind: $kind, description: $description) {
id
}
}
`;

export const getGraphQLSchema = gql`
query getGraphQLSchema {
__schema {
Expand Down Expand Up @@ -281,13 +289,12 @@ export const introspectionQuery = gql`
}
`;

// it cant be a variable due to a bug in the API so must be generated string.
export const generateTypeDetailsQuery = (typeName: string) => gql`
query getTypeDetails {
__type(name: "${typeName}") {
name
description
kind
description
fields {
name
description
Expand All @@ -300,39 +307,14 @@ export const generateTypeDetailsQuery = (typeName: string) => gql`
ofType {
name
kind
ofType {
name
kind
ofType {
name
kind
}
}
}
}
}
args {
name
description
type {
name
kind
ofType {
name
kind
ofType {
name
kind
ofType {
name
kind
}
}
}
}
defaultValue
}
}
enumValues {
name
description
}
inputFields {
name
description
Expand All @@ -345,28 +327,9 @@ export const generateTypeDetailsQuery = (typeName: string) => gql`
ofType {
name
kind
ofType {
name
kind
ofType {
name
kind
}
}
}
}
}
defaultValue
}
interfaces {
name
}
enumValues {
name
description
}
possibleTypes {
name
}
}
}
Expand Down Expand Up @@ -428,3 +391,21 @@ export const fetchCustomActivity = gql`
}
}
`;

export const createBoardView = gql`
mutation createBoardView(
$boardId: ID!
$name: String!
$type: BoardViewTypeValues!
) {
create_board_view(
board_id: $boardId
name: $name
type: $type
) {
id
name
type
}
}
`;
31 changes: 31 additions & 0 deletions packages/agent-toolkit/src/monday-graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,24 @@ enum BoardSubscriberKind {
subscriber
}

"""The available board view types."""
enum BoardViewTypeValues {
"""Calendar board view."""
CalendarBoardView

"""Doc board view."""
DocBoardView

"""Empty board view."""
EmptyBoardView

"""Form board view."""
FormBoardView

"""Table board view."""
TableBoardView
}

"""
A board's view.
"""
Expand Down Expand Up @@ -4776,6 +4794,19 @@ type Mutation {
workspace_id: ID
): Board


"""Create a new board view."""
create_board_view(
"""The board's unique identifier."""
board_id: ID!

"""The name of the board view."""
name: String!

"""The type of the board view."""
type: BoardViewTypeValues!
): BoardView

"""
Create a new column in board.
"""
Expand Down
Loading