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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { z } from 'zod';
import {
CreateWorkspaceMutation,
CreateWorkspaceMutationVariables,
WorkspaceKind,
} from '../../../monday-graphql/generated/graphql';
import { createWorkspace } from '../../../monday-graphql/queries.graphql';
import { ToolInputType, ToolOutputType, ToolType } from '../../tool';
import { BaseMondayApiTool, createMondayApiAnnotations } from './base-monday-api-tool';

export const createWorkspaceToolSchema = {
name: z.string().describe('The name of the new workspace to be created'),
workspaceKind: z.nativeEnum(WorkspaceKind).describe('The kind of workspace to create'),
description: z.string().optional().describe('The description of the new workspace'),
accountProductId: z.number().optional().describe('The account product ID associated with the workspace'),
};

export type CreateWorkspaceToolInput = typeof createWorkspaceToolSchema;

export class CreateWorkspaceTool extends BaseMondayApiTool<CreateWorkspaceToolInput> {
name = 'create_workspace';
type = ToolType.WRITE;
annotations = createMondayApiAnnotations({
title: 'Create Workspace',
readOnlyHint: false,
destructiveHint: false,
idempotentHint: false,
});

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

getInputSchema(): CreateWorkspaceToolInput {
return createWorkspaceToolSchema;
}

protected async executeInternal(input: ToolInputType<CreateWorkspaceToolInput>): Promise<ToolOutputType<never>> {
const variables: CreateWorkspaceMutationVariables = {
name: input.name,
workspaceKind: input.workspaceKind,
description: input.description,
accountProductId: input.accountProductId?.toString(),
};

const res = await this.mondayApi.request<CreateWorkspaceMutation>(createWorkspace, variables);

return {
content: `Workspace ${res.create_workspace?.id} successfully created`,
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 { CreateWorkspaceTool } from './create-workspace-tool';

export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [
DeleteItemTool,
Expand Down Expand Up @@ -66,6 +67,7 @@ export const allGraphqlApiTools: BaseMondayApiToolConstructor[] = [
CreateDashboardTool,
AllWidgetsSchemaTool,
CreateWidgetTool,
CreateWorkspaceTool,
];

export * from './all-monday-api-tool';
Expand Down Expand Up @@ -98,5 +100,6 @@ export * from './list-workspace-tool/list-workspace-tool';
export * from './create-doc-tool';
export * from './get-board-activity/get-board-activity-tool';
export * from './get-board-info/get-board-info-tool';
export * from './create-workspace-tool';
// Dashboard Tools
export * from './dashboard-tools';
Loading