chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
import type { MondayArchiveItemParams, MondayArchiveItemResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayArchiveItemTool: ToolConfig<MondayArchiveItemParams, MondayArchiveItemResponse> =
|
||||
{
|
||||
id: 'monday_archive_item',
|
||||
name: 'Monday Archive Item',
|
||||
description: 'Archive an item on a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
itemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the item to archive',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => ({
|
||||
query: `mutation { archive_item(item_id: ${sanitizeNumericId(params.itemId, 'itemId')}) { id } }`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { id: '' }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.archive_item
|
||||
if (!raw) {
|
||||
return { success: false, output: { id: '' }, error: 'Failed to archive item' }
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: { id: raw.id as string },
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
id: {
|
||||
type: 'string',
|
||||
description: 'The ID of the archived item',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
import type {
|
||||
MondayChangeColumnValueParams,
|
||||
MondayChangeColumnValueResponse,
|
||||
} from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayChangeColumnValueTool: ToolConfig<
|
||||
MondayChangeColumnValueParams,
|
||||
MondayChangeColumnValueResponse
|
||||
> = {
|
||||
id: 'monday_change_column_value',
|
||||
name: 'Monday Change Column Value',
|
||||
description: "Update a single column's value on a Monday.com item",
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board containing the item',
|
||||
},
|
||||
itemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the item to update',
|
||||
},
|
||||
columnId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the column to update (e.g., "status", "date4")',
|
||||
},
|
||||
value: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'The new column value as a JSON string (e.g., {"label":"Done"} for a status column)',
|
||||
},
|
||||
createLabelsIfMissing: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Create status/dropdown labels that do not yet exist on the column',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const args: string[] = [
|
||||
`board_id: ${sanitizeNumericId(params.boardId, 'boardId')}`,
|
||||
`item_id: ${sanitizeNumericId(params.itemId, 'itemId')}`,
|
||||
`column_id: ${JSON.stringify(params.columnId)}`,
|
||||
`value: ${JSON.stringify(params.value)}`,
|
||||
]
|
||||
if (params.createLabelsIfMissing) {
|
||||
args.push('create_labels_if_missing: true')
|
||||
}
|
||||
return {
|
||||
query: `mutation { change_column_value(${args.join(', ')}) { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { item: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.change_column_value
|
||||
if (!raw) {
|
||||
return { success: false, output: { item: null }, error: 'Failed to change column value' }
|
||||
}
|
||||
|
||||
const board = raw.board as Record<string, unknown> | null
|
||||
const group = raw.group as Record<string, unknown> | null
|
||||
const columnValues = ((raw.column_values as Record<string, unknown>[]) ?? []).map(
|
||||
(cv: Record<string, unknown>) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
item: {
|
||||
id: raw.id as string,
|
||||
name: (raw.name as string) ?? '',
|
||||
state: (raw.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (raw.created_at as string) ?? null,
|
||||
updatedAt: (raw.updated_at as string) ?? null,
|
||||
url: (raw.url as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
item: {
|
||||
type: 'json',
|
||||
description: 'The updated item',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: { type: 'string', description: 'Item state', optional: true },
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
import type { MondayCreateBoardParams, MondayCreateBoardResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeEnum,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
const BOARD_KINDS = ['public', 'private', 'share'] as const
|
||||
|
||||
export const mondayCreateBoardTool: ToolConfig<MondayCreateBoardParams, MondayCreateBoardResponse> =
|
||||
{
|
||||
id: 'monday_create_board',
|
||||
name: 'Monday Create Board',
|
||||
description: 'Create a new board in Monday.com',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the new board',
|
||||
},
|
||||
boardKind: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The board kind: public, private, or share',
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The board description',
|
||||
},
|
||||
workspaceId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the workspace to create the board in',
|
||||
},
|
||||
folderId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the folder to create the board in',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const args: string[] = [
|
||||
`board_name: ${JSON.stringify(params.boardName)}`,
|
||||
`board_kind: ${sanitizeEnum(params.boardKind, 'boardKind', BOARD_KINDS)}`,
|
||||
]
|
||||
if (params.description) {
|
||||
args.push(`description: ${JSON.stringify(params.description)}`)
|
||||
}
|
||||
if (params.workspaceId) {
|
||||
args.push(`workspace_id: ${sanitizeNumericId(params.workspaceId, 'workspaceId')}`)
|
||||
}
|
||||
if (params.folderId) {
|
||||
args.push(`folder_id: ${sanitizeNumericId(params.folderId, 'folderId')}`)
|
||||
}
|
||||
return {
|
||||
query: `mutation { create_board(${args.join(', ')}) { id name description state board_kind items_count url updated_at } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { board: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.create_board
|
||||
if (!raw) {
|
||||
return { success: false, output: { board: null }, error: 'Failed to create board' }
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
board: {
|
||||
id: raw.id as string,
|
||||
name: (raw.name as string) ?? '',
|
||||
description: (raw.description as string) ?? null,
|
||||
state: (raw.state as string) ?? 'active',
|
||||
boardKind: (raw.board_kind as string) ?? 'public',
|
||||
itemsCount: (raw.items_count as number) ?? 0,
|
||||
url: (raw.url as string) ?? '',
|
||||
updatedAt: (raw.updated_at as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
board: {
|
||||
type: 'json',
|
||||
description: 'The created board',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Board ID' },
|
||||
name: { type: 'string', description: 'Board name' },
|
||||
description: { type: 'string', description: 'Board description', optional: true },
|
||||
state: { type: 'string', description: 'Board state' },
|
||||
boardKind: { type: 'string', description: 'Board kind (public, private, share)' },
|
||||
itemsCount: { type: 'number', description: 'Number of items' },
|
||||
url: { type: 'string', description: 'Board URL' },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
import type { MondayCreateColumnParams, MondayCreateColumnResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeEnum,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
const COLUMN_TYPES = [
|
||||
'auto_number',
|
||||
'board_relation',
|
||||
'button',
|
||||
'checkbox',
|
||||
'color_picker',
|
||||
'country',
|
||||
'date',
|
||||
'dependency',
|
||||
'doc',
|
||||
'dropdown',
|
||||
'email',
|
||||
'file',
|
||||
'formula',
|
||||
'hour',
|
||||
'item_id',
|
||||
'link',
|
||||
'location',
|
||||
'long_text',
|
||||
'mirror',
|
||||
'name',
|
||||
'numbers',
|
||||
'people',
|
||||
'phone',
|
||||
'progress',
|
||||
'rating',
|
||||
'status',
|
||||
'tags',
|
||||
'team',
|
||||
'text',
|
||||
'timeline',
|
||||
'time_tracking',
|
||||
'vote',
|
||||
'week',
|
||||
'world_clock',
|
||||
] as const
|
||||
|
||||
export const mondayCreateColumnTool: ToolConfig<
|
||||
MondayCreateColumnParams,
|
||||
MondayCreateColumnResponse
|
||||
> = {
|
||||
id: 'monday_create_column',
|
||||
name: 'Monday Create Column',
|
||||
description: 'Create a new column on a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board to create the column on',
|
||||
},
|
||||
columnTitle: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The title of the new column',
|
||||
},
|
||||
columnType: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The column type (e.g., status, text, numbers, date, people, dropdown)',
|
||||
},
|
||||
columnDescription: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The column description',
|
||||
},
|
||||
columnDefaults: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'JSON string of default settings for the column (e.g., status labels)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const args: string[] = [
|
||||
`board_id: ${sanitizeNumericId(params.boardId, 'boardId')}`,
|
||||
`title: ${JSON.stringify(params.columnTitle)}`,
|
||||
`column_type: ${sanitizeEnum(params.columnType, 'columnType', COLUMN_TYPES)}`,
|
||||
]
|
||||
if (params.columnDescription) {
|
||||
args.push(`description: ${JSON.stringify(params.columnDescription)}`)
|
||||
}
|
||||
if (params.columnDefaults) {
|
||||
args.push(`defaults: ${JSON.stringify(params.columnDefaults)}`)
|
||||
}
|
||||
return {
|
||||
query: `mutation { create_column(${args.join(', ')}) { id title type } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { column: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.create_column
|
||||
if (!raw) {
|
||||
return { success: false, output: { column: null }, error: 'Failed to create column' }
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
column: {
|
||||
id: raw.id as string,
|
||||
title: (raw.title as string) ?? '',
|
||||
type: (raw.type as string) ?? '',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
column: {
|
||||
type: 'json',
|
||||
description: 'The created column',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
title: { type: 'string', description: 'Column title' },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import type { MondayCreateGroupParams, MondayCreateGroupResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayCreateGroupTool: ToolConfig<MondayCreateGroupParams, MondayCreateGroupResponse> =
|
||||
{
|
||||
id: 'monday_create_group',
|
||||
name: 'Monday Create Group',
|
||||
description: 'Create a new group on a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board to create the group on',
|
||||
},
|
||||
groupName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the new group (max 255 characters)',
|
||||
},
|
||||
groupColor: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The group color as a hex code (e.g., "#ff642e")',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const args: string[] = [
|
||||
`board_id: ${sanitizeNumericId(params.boardId, 'boardId')}`,
|
||||
`group_name: ${JSON.stringify(params.groupName)}`,
|
||||
]
|
||||
if (params.groupColor) {
|
||||
args.push(`group_color: ${JSON.stringify(params.groupColor)}`)
|
||||
}
|
||||
return {
|
||||
query: `mutation { create_group(${args.join(', ')}) { id title color archived deleted position } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { group: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.create_group
|
||||
if (!raw) {
|
||||
return { success: false, output: { group: null }, error: 'Failed to create group' }
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
group: {
|
||||
id: raw.id as string,
|
||||
title: (raw.title as string) ?? '',
|
||||
color: (raw.color as string) ?? '',
|
||||
archived: (raw.archived as boolean) ?? null,
|
||||
deleted: (raw.deleted as boolean) ?? null,
|
||||
position: (raw.position as string) ?? '',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
group: {
|
||||
type: 'json',
|
||||
description: 'The created group',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Group ID' },
|
||||
title: { type: 'string', description: 'Group title' },
|
||||
color: { type: 'string', description: 'Group color (hex)' },
|
||||
archived: { type: 'boolean', description: 'Whether archived', optional: true },
|
||||
deleted: { type: 'boolean', description: 'Whether deleted', optional: true },
|
||||
position: { type: 'string', description: 'Group position' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
import type { MondayCreateItemParams, MondayCreateItemResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayCreateItemTool: ToolConfig<MondayCreateItemParams, MondayCreateItemResponse> = {
|
||||
id: 'monday_create_item',
|
||||
name: 'Monday Create Item',
|
||||
description: 'Create a new item on a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board to create the item on',
|
||||
},
|
||||
itemName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the new item',
|
||||
},
|
||||
groupId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The group ID to create the item in',
|
||||
},
|
||||
columnValues: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'JSON string of column values to set (e.g., {"status":"Done","date":"2024-01-01"})',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const args: string[] = [
|
||||
`board_id: ${sanitizeNumericId(params.boardId, 'boardId')}`,
|
||||
`item_name: ${JSON.stringify(params.itemName)}`,
|
||||
]
|
||||
if (params.groupId) {
|
||||
args.push(`group_id: ${JSON.stringify(params.groupId)}`)
|
||||
}
|
||||
if (params.columnValues) {
|
||||
args.push(`column_values: ${JSON.stringify(params.columnValues)}`)
|
||||
}
|
||||
return {
|
||||
query: `mutation { create_item(${args.join(', ')}) { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { item: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.create_item
|
||||
if (!raw) {
|
||||
return { success: false, output: { item: null }, error: 'Failed to create item' }
|
||||
}
|
||||
|
||||
const board = raw.board as Record<string, unknown> | null
|
||||
const group = raw.group as Record<string, unknown> | null
|
||||
const columnValues = ((raw.column_values as Record<string, unknown>[]) ?? []).map(
|
||||
(cv: Record<string, unknown>) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
item: {
|
||||
id: raw.id as string,
|
||||
name: (raw.name as string) ?? '',
|
||||
state: (raw.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (raw.created_at as string) ?? null,
|
||||
updatedAt: (raw.updated_at as string) ?? null,
|
||||
url: (raw.url as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
item: {
|
||||
type: 'json',
|
||||
description: 'The created item',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: { type: 'string', description: 'Item state', optional: true },
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
import type { MondayCreateSubitemParams, MondayCreateSubitemResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayCreateSubitemTool: ToolConfig<
|
||||
MondayCreateSubitemParams,
|
||||
MondayCreateSubitemResponse
|
||||
> = {
|
||||
id: 'monday_create_subitem',
|
||||
name: 'Monday Create Subitem',
|
||||
description: 'Create a subitem under a parent item on Monday.com',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
parentItemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the parent item',
|
||||
},
|
||||
itemName: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The name of the new subitem',
|
||||
},
|
||||
columnValues: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'JSON string of column values to set',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const args: string[] = [
|
||||
`parent_item_id: ${sanitizeNumericId(params.parentItemId, 'parentItemId')}`,
|
||||
`item_name: ${JSON.stringify(params.itemName)}`,
|
||||
]
|
||||
if (params.columnValues) {
|
||||
args.push(`column_values: ${JSON.stringify(params.columnValues)}`)
|
||||
}
|
||||
return {
|
||||
query: `mutation { create_subitem(${args.join(', ')}) { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { item: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.create_subitem
|
||||
if (!raw) {
|
||||
return { success: false, output: { item: null }, error: 'Failed to create subitem' }
|
||||
}
|
||||
|
||||
const board = raw.board as Record<string, unknown> | null
|
||||
const group = raw.group as Record<string, unknown> | null
|
||||
const columnValues = ((raw.column_values as Record<string, unknown>[]) ?? []).map(
|
||||
(cv: Record<string, unknown>) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
item: {
|
||||
id: raw.id as string,
|
||||
name: (raw.name as string) ?? '',
|
||||
state: (raw.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (raw.created_at as string) ?? null,
|
||||
updatedAt: (raw.updated_at as string) ?? null,
|
||||
url: (raw.url as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
item: {
|
||||
type: 'json',
|
||||
description: 'The created subitem',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: { type: 'string', description: 'Item state', optional: true },
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import type { MondayCreateUpdateParams, MondayCreateUpdateResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayCreateUpdateTool: ToolConfig<
|
||||
MondayCreateUpdateParams,
|
||||
MondayCreateUpdateResponse
|
||||
> = {
|
||||
id: 'monday_create_update',
|
||||
name: 'Monday Create Update',
|
||||
description: 'Add an update (comment) to a Monday.com item',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
itemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the item to add the update to',
|
||||
},
|
||||
body: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The update text content (supports HTML)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => ({
|
||||
query: `mutation { create_update(item_id: ${sanitizeNumericId(params.itemId, 'itemId')}, body: ${JSON.stringify(params.body)}) { id body text_body created_at creator_id item_id } }`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { update: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.create_update
|
||||
if (!raw) {
|
||||
return { success: false, output: { update: null }, error: 'Failed to create update' }
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
update: {
|
||||
id: raw.id as string,
|
||||
body: (raw.body as string) ?? '',
|
||||
textBody: (raw.text_body as string) ?? null,
|
||||
createdAt: (raw.created_at as string) ?? null,
|
||||
creatorId: (raw.creator_id as string) ?? null,
|
||||
itemId: (raw.item_id as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
update: {
|
||||
type: 'json',
|
||||
description: 'The created update',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Update ID' },
|
||||
body: { type: 'string', description: 'Update body (HTML)' },
|
||||
textBody: { type: 'string', description: 'Plain text body', optional: true },
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
creatorId: { type: 'string', description: 'Creator user ID', optional: true },
|
||||
itemId: { type: 'string', description: 'Item ID', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
import type { MondayDeleteItemParams, MondayDeleteItemResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayDeleteItemTool: ToolConfig<MondayDeleteItemParams, MondayDeleteItemResponse> = {
|
||||
id: 'monday_delete_item',
|
||||
name: 'Monday Delete Item',
|
||||
description: 'Delete an item from a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
itemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the item to delete',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => ({
|
||||
query: `mutation { delete_item(item_id: ${sanitizeNumericId(params.itemId, 'itemId')}) { id } }`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { id: '' }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.delete_item
|
||||
if (!raw) {
|
||||
return { success: false, output: { id: '' }, error: 'Failed to delete item' }
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: { id: raw.id as string },
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
id: {
|
||||
type: 'string',
|
||||
description: 'The ID of the deleted item',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
import type { MondayDuplicateItemParams, MondayDuplicateItemResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayDuplicateItemTool: ToolConfig<
|
||||
MondayDuplicateItemParams,
|
||||
MondayDuplicateItemResponse
|
||||
> = {
|
||||
id: 'monday_duplicate_item',
|
||||
name: 'Monday Duplicate Item',
|
||||
description: 'Duplicate an existing item on a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board containing the item',
|
||||
},
|
||||
itemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the item to duplicate',
|
||||
},
|
||||
withUpdates: {
|
||||
type: 'boolean',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Whether to also duplicate the item updates',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const args: string[] = [
|
||||
`board_id: ${sanitizeNumericId(params.boardId, 'boardId')}`,
|
||||
`item_id: ${sanitizeNumericId(params.itemId, 'itemId')}`,
|
||||
]
|
||||
if (params.withUpdates) {
|
||||
args.push('with_updates: true')
|
||||
}
|
||||
return {
|
||||
query: `mutation { duplicate_item(${args.join(', ')}) { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { item: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.duplicate_item
|
||||
if (!raw) {
|
||||
return { success: false, output: { item: null }, error: 'Failed to duplicate item' }
|
||||
}
|
||||
|
||||
const board = raw.board as Record<string, unknown> | null
|
||||
const group = raw.group as Record<string, unknown> | null
|
||||
const columnValues = ((raw.column_values as Record<string, unknown>[]) ?? []).map(
|
||||
(cv: Record<string, unknown>) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
item: {
|
||||
id: raw.id as string,
|
||||
name: (raw.name as string) ?? '',
|
||||
state: (raw.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (raw.created_at as string) ?? null,
|
||||
updatedAt: (raw.updated_at as string) ?? null,
|
||||
url: (raw.url as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
item: {
|
||||
type: 'json',
|
||||
description: 'The duplicated item',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: { type: 'string', description: 'Item state', optional: true },
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
import type { MondayGetBoardParams, MondayGetBoardResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayGetBoardTool: ToolConfig<MondayGetBoardParams, MondayGetBoardResponse> = {
|
||||
id: 'monday_get_board',
|
||||
name: 'Monday Get Board',
|
||||
description: 'Get a specific Monday.com board with its groups and columns',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board to retrieve',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => ({
|
||||
query: `query { boards(ids: [${sanitizeNumericId(params.boardId, 'boardId')}]) { id name description state board_kind items_count url updated_at groups { id title color archived deleted position } columns { id title type } } }`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { board: null, groups: [], columns: [] }, error }
|
||||
}
|
||||
|
||||
const boards = data.data?.boards ?? []
|
||||
if (boards.length === 0) {
|
||||
return {
|
||||
success: false,
|
||||
output: { board: null, groups: [], columns: [] },
|
||||
error: 'Board not found',
|
||||
}
|
||||
}
|
||||
|
||||
const b = boards[0]
|
||||
const board = {
|
||||
id: b.id as string,
|
||||
name: (b.name as string) ?? '',
|
||||
description: (b.description as string) ?? null,
|
||||
state: (b.state as string) ?? 'active',
|
||||
boardKind: (b.board_kind as string) ?? 'public',
|
||||
itemsCount: (b.items_count as number) ?? 0,
|
||||
url: (b.url as string) ?? '',
|
||||
updatedAt: (b.updated_at as string) ?? null,
|
||||
}
|
||||
|
||||
const groups = (b.groups ?? []).map((g: Record<string, unknown>) => ({
|
||||
id: g.id as string,
|
||||
title: (g.title as string) ?? '',
|
||||
color: (g.color as string) ?? '',
|
||||
archived: (g.archived as boolean) ?? null,
|
||||
deleted: (g.deleted as boolean) ?? null,
|
||||
position: (g.position as string) ?? '',
|
||||
}))
|
||||
|
||||
const columns = (b.columns ?? []).map((c: Record<string, unknown>) => ({
|
||||
id: c.id as string,
|
||||
title: (c.title as string) ?? '',
|
||||
type: (c.type as string) ?? '',
|
||||
}))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: { board, groups, columns },
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
board: {
|
||||
type: 'json',
|
||||
description: 'Board details',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Board ID' },
|
||||
name: { type: 'string', description: 'Board name' },
|
||||
description: { type: 'string', description: 'Board description', optional: true },
|
||||
state: { type: 'string', description: 'Board state' },
|
||||
boardKind: { type: 'string', description: 'Board kind (public, private, share)' },
|
||||
itemsCount: { type: 'number', description: 'Number of items' },
|
||||
url: { type: 'string', description: 'Board URL' },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
},
|
||||
},
|
||||
groups: {
|
||||
type: 'array',
|
||||
description: 'Groups on the board',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Group ID' },
|
||||
title: { type: 'string', description: 'Group title' },
|
||||
color: { type: 'string', description: 'Group color (hex)' },
|
||||
archived: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the group is archived',
|
||||
optional: true,
|
||||
},
|
||||
deleted: { type: 'boolean', description: 'Whether the group is deleted', optional: true },
|
||||
position: { type: 'string', description: 'Group position' },
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
type: 'array',
|
||||
description: 'Columns on the board',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
title: { type: 'string', description: 'Column title' },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import type { MondayGetGroupsParams, MondayGetGroupsResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayGetGroupsTool: ToolConfig<MondayGetGroupsParams, MondayGetGroupsResponse> = {
|
||||
id: 'monday_get_groups',
|
||||
name: 'Monday Get Groups',
|
||||
description: 'Get the groups on a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board to retrieve groups from',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => ({
|
||||
query: `query { boards(ids: [${sanitizeNumericId(params.boardId, 'boardId')}]) { groups { id title color archived deleted position } } }`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { groups: [], count: 0 }, error }
|
||||
}
|
||||
|
||||
const boards = data.data?.boards ?? []
|
||||
if (boards.length === 0) {
|
||||
return { success: false, output: { groups: [], count: 0 }, error: 'Board not found' }
|
||||
}
|
||||
|
||||
const groups = (boards[0].groups ?? []).map((g: Record<string, unknown>) => ({
|
||||
id: g.id as string,
|
||||
title: (g.title as string) ?? '',
|
||||
color: (g.color as string) ?? '',
|
||||
archived: (g.archived as boolean) ?? null,
|
||||
deleted: (g.deleted as boolean) ?? null,
|
||||
position: (g.position as string) ?? '',
|
||||
}))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: { groups, count: groups.length },
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
groups: {
|
||||
type: 'array',
|
||||
description: 'Groups on the board',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Group ID' },
|
||||
title: { type: 'string', description: 'Group title' },
|
||||
color: { type: 'string', description: 'Group color (hex)' },
|
||||
archived: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the group is archived',
|
||||
optional: true,
|
||||
},
|
||||
deleted: { type: 'boolean', description: 'Whether the group is deleted', optional: true },
|
||||
position: { type: 'string', description: 'Group position' },
|
||||
},
|
||||
},
|
||||
},
|
||||
count: { type: 'number', description: 'Number of returned groups' },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import type { MondayGetItemParams, MondayGetItemResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayGetItemTool: ToolConfig<MondayGetItemParams, MondayGetItemResponse> = {
|
||||
id: 'monday_get_item',
|
||||
name: 'Monday Get Item',
|
||||
description: 'Get a specific item by ID from Monday.com',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
itemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the item to retrieve',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => ({
|
||||
query: `query { items(ids: [${sanitizeNumericId(params.itemId, 'itemId')}]) { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } }`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { item: null }, error }
|
||||
}
|
||||
|
||||
const items = data.data?.items ?? []
|
||||
if (items.length === 0) {
|
||||
return { success: false, output: { item: null }, error: 'Item not found' }
|
||||
}
|
||||
|
||||
const raw = items[0]
|
||||
const board = raw.board as Record<string, unknown> | null
|
||||
const group = raw.group as Record<string, unknown> | null
|
||||
const columnValues = ((raw.column_values as Record<string, unknown>[]) ?? []).map(
|
||||
(cv: Record<string, unknown>) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
item: {
|
||||
id: raw.id as string,
|
||||
name: (raw.name as string) ?? '',
|
||||
state: (raw.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (raw.created_at as string) ?? null,
|
||||
updatedAt: (raw.updated_at as string) ?? null,
|
||||
url: (raw.url as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
item: {
|
||||
type: 'json',
|
||||
description: 'The requested item',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: { type: 'string', description: 'Item state', optional: true },
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
import type { MondayGetItemsParams, MondayGetItemsResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeLimit,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
function mapItem(item: Record<string, unknown>): {
|
||||
id: string
|
||||
name: string
|
||||
state: string | null
|
||||
boardId: string | null
|
||||
groupId: string | null
|
||||
groupTitle: string | null
|
||||
columnValues: { id: string; text: string | null; value: string | null; type: string }[]
|
||||
createdAt: string | null
|
||||
updatedAt: string | null
|
||||
url: string | null
|
||||
} {
|
||||
const board = item.board as Record<string, unknown> | null
|
||||
const group = item.group as Record<string, unknown> | null
|
||||
const columnValues = ((item.column_values as Record<string, unknown>[]) ?? []).map((cv) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
}))
|
||||
|
||||
return {
|
||||
id: item.id as string,
|
||||
name: (item.name as string) ?? '',
|
||||
state: (item.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (item.created_at as string) ?? null,
|
||||
updatedAt: (item.updated_at as string) ?? null,
|
||||
url: (item.url as string) ?? null,
|
||||
}
|
||||
}
|
||||
|
||||
export const mondayGetItemsTool: ToolConfig<MondayGetItemsParams, MondayGetItemsResponse> = {
|
||||
id: 'monday_get_items',
|
||||
name: 'Monday Get Items',
|
||||
description: 'Get items from a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board to get items from',
|
||||
},
|
||||
groupId: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Filter items by group ID',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of items to return (default 25, max 500)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const limit = sanitizeLimit(params.limit, 25, 500)
|
||||
const boardId = sanitizeNumericId(params.boardId, 'boardId')
|
||||
if (params.groupId) {
|
||||
return {
|
||||
query: `query { boards(ids: [${boardId}]) { groups(ids: [${JSON.stringify(params.groupId)}]) { items_page(limit: ${limit}) { items { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } } } } }`,
|
||||
}
|
||||
}
|
||||
return {
|
||||
query: `query { boards(ids: [${boardId}]) { items_page(limit: ${limit}) { items { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } } } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { items: [], count: 0 }, error }
|
||||
}
|
||||
|
||||
const boards = data.data?.boards ?? []
|
||||
if (boards.length === 0) {
|
||||
return { success: true, output: { items: [], count: 0 } }
|
||||
}
|
||||
|
||||
const board = boards[0]
|
||||
let rawItems: Record<string, unknown>[] = []
|
||||
|
||||
if (board.groups) {
|
||||
for (const group of board.groups) {
|
||||
const groupItems = group.items_page?.items ?? []
|
||||
rawItems = rawItems.concat(groupItems)
|
||||
}
|
||||
} else {
|
||||
rawItems = board.items_page?.items ?? []
|
||||
}
|
||||
|
||||
const items = rawItems.map(mapItem)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: { items, count: items.length },
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
items: {
|
||||
type: 'array',
|
||||
description: 'List of items from the board',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: {
|
||||
type: 'string',
|
||||
description: 'Item state (active, archived, deleted)',
|
||||
optional: true,
|
||||
},
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values for the item',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Human-readable text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
count: {
|
||||
type: 'number',
|
||||
description: 'Number of items returned',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export { mondayArchiveItemTool } from '@/tools/monday/archive_item'
|
||||
export { mondayChangeColumnValueTool } from '@/tools/monday/change_column_value'
|
||||
export { mondayCreateBoardTool } from '@/tools/monday/create_board'
|
||||
export { mondayCreateColumnTool } from '@/tools/monday/create_column'
|
||||
export { mondayCreateGroupTool } from '@/tools/monday/create_group'
|
||||
export { mondayCreateItemTool } from '@/tools/monday/create_item'
|
||||
export { mondayCreateSubitemTool } from '@/tools/monday/create_subitem'
|
||||
export { mondayCreateUpdateTool } from '@/tools/monday/create_update'
|
||||
export { mondayDeleteItemTool } from '@/tools/monday/delete_item'
|
||||
export { mondayDuplicateItemTool } from '@/tools/monday/duplicate_item'
|
||||
export { mondayGetBoardTool } from '@/tools/monday/get_board'
|
||||
export { mondayGetGroupsTool } from '@/tools/monday/get_groups'
|
||||
export { mondayGetItemTool } from '@/tools/monday/get_item'
|
||||
export { mondayGetItemsTool } from '@/tools/monday/get_items'
|
||||
export { mondayListBoardsTool } from '@/tools/monday/list_boards'
|
||||
export { mondayMoveItemToGroupTool } from '@/tools/monday/move_item_to_group'
|
||||
export { mondaySearchItemsTool } from '@/tools/monday/search_items'
|
||||
export { mondayUpdateItemTool } from '@/tools/monday/update_item'
|
||||
@@ -0,0 +1,102 @@
|
||||
import type { MondayListBoardsParams, MondayListBoardsResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeLimit,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayListBoardsTool: ToolConfig<MondayListBoardsParams, MondayListBoardsResponse> = {
|
||||
id: 'monday_list_boards',
|
||||
name: 'Monday List Boards',
|
||||
description: 'List boards from your Monday.com account',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of boards to return (default 25, max 500)',
|
||||
},
|
||||
page: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Page number for pagination (starts at 1)',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const limit = sanitizeLimit(params.limit, 25, 500)
|
||||
const page = sanitizeLimit(params.page, 1, 10000)
|
||||
return {
|
||||
query: `query { boards(limit: ${limit}, page: ${page}, state: active) { id name description state board_kind items_count url updated_at } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { boards: [], count: 0 }, error }
|
||||
}
|
||||
|
||||
const boards = (data.data?.boards ?? []).map((b: Record<string, unknown>) => ({
|
||||
id: b.id as string,
|
||||
name: (b.name as string) ?? '',
|
||||
description: (b.description as string) ?? null,
|
||||
state: (b.state as string) ?? 'active',
|
||||
boardKind: (b.board_kind as string) ?? 'public',
|
||||
itemsCount: (b.items_count as number) ?? 0,
|
||||
url: (b.url as string) ?? '',
|
||||
updatedAt: (b.updated_at as string) ?? null,
|
||||
}))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: { boards, count: boards.length },
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
boards: {
|
||||
type: 'array',
|
||||
description: 'List of Monday.com boards',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Board ID' },
|
||||
name: { type: 'string', description: 'Board name' },
|
||||
description: { type: 'string', description: 'Board description', optional: true },
|
||||
state: { type: 'string', description: 'Board state (active, archived, deleted)' },
|
||||
boardKind: { type: 'string', description: 'Board kind (public, private, share)' },
|
||||
itemsCount: { type: 'number', description: 'Number of items on the board' },
|
||||
url: { type: 'string', description: 'Board URL' },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
count: {
|
||||
type: 'number',
|
||||
description: 'Number of boards returned',
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
import type {
|
||||
MondayMoveItemToGroupParams,
|
||||
MondayMoveItemToGroupResponse,
|
||||
} from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayMoveItemToGroupTool: ToolConfig<
|
||||
MondayMoveItemToGroupParams,
|
||||
MondayMoveItemToGroupResponse
|
||||
> = {
|
||||
id: 'monday_move_item_to_group',
|
||||
name: 'Monday Move Item to Group',
|
||||
description: 'Move an item to a different group on a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
itemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the item to move',
|
||||
},
|
||||
groupId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the target group',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => ({
|
||||
query: `mutation { move_item_to_group(item_id: ${sanitizeNumericId(params.itemId, 'itemId')}, group_id: ${JSON.stringify(params.groupId)}) { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } }`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { item: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.move_item_to_group
|
||||
if (!raw) {
|
||||
return { success: false, output: { item: null }, error: 'Failed to move item' }
|
||||
}
|
||||
|
||||
const board = raw.board as Record<string, unknown> | null
|
||||
const group = raw.group as Record<string, unknown> | null
|
||||
const columnValues = ((raw.column_values as Record<string, unknown>[]) ?? []).map(
|
||||
(cv: Record<string, unknown>) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
item: {
|
||||
id: raw.id as string,
|
||||
name: (raw.name as string) ?? '',
|
||||
state: (raw.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (raw.created_at as string) ?? null,
|
||||
updatedAt: (raw.updated_at as string) ?? null,
|
||||
url: (raw.url as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
item: {
|
||||
type: 'json',
|
||||
description: 'The moved item with updated group',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: { type: 'string', description: 'Item state', optional: true },
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
import type { MondaySearchItemsParams, MondaySearchItemsResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeLimit,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondaySearchItemsTool: ToolConfig<MondaySearchItemsParams, MondaySearchItemsResponse> =
|
||||
{
|
||||
id: 'monday_search_items',
|
||||
name: 'Monday Search Items',
|
||||
description: 'Search for items on a Monday.com board by column values',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board to search',
|
||||
},
|
||||
columns: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'JSON array of column filters, e.g. [{"column_id":"status","column_values":["Done"]}]',
|
||||
},
|
||||
limit: {
|
||||
type: 'number',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Maximum number of items to return (default 25, max 500)',
|
||||
},
|
||||
cursor: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Pagination cursor from a previous search response',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => {
|
||||
const limit = sanitizeLimit(params.limit, 25, 500)
|
||||
if (params.cursor) {
|
||||
return {
|
||||
query: `query { next_items_page(limit: ${limit}, cursor: ${JSON.stringify(params.cursor)}) { cursor items { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } } }`,
|
||||
}
|
||||
}
|
||||
const boardId = sanitizeNumericId(params.boardId, 'boardId')
|
||||
let parsedColumns: unknown
|
||||
try {
|
||||
parsedColumns =
|
||||
typeof params.columns === 'string' ? JSON.parse(params.columns) : params.columns
|
||||
} catch {
|
||||
throw new Error(
|
||||
'Column filters must be a valid JSON array, e.g. [{"column_id":"status","column_values":["Done"]}]'
|
||||
)
|
||||
}
|
||||
if (!Array.isArray(parsedColumns) || parsedColumns.length === 0) {
|
||||
throw new Error(
|
||||
'Column filters must be a non-empty JSON array, e.g. [{"column_id":"status","column_values":["Done"]}]'
|
||||
)
|
||||
}
|
||||
// The `columns` argument is a typed GraphQL input-object list (ItemsPageByColumnValuesQuery),
|
||||
// which requires unquoted keys. Emit a literal with bare keys and JSON-escaped string values
|
||||
// (JSON.stringify keeps the values injection-safe).
|
||||
const columnsLiteral = `[${parsedColumns
|
||||
.map((entry) => {
|
||||
const column = entry as { column_id?: unknown; column_values?: unknown }
|
||||
const columnId = JSON.stringify(String(column.column_id ?? ''))
|
||||
const rawValues = Array.isArray(column.column_values)
|
||||
? column.column_values
|
||||
: [column.column_values]
|
||||
const columnValues = JSON.stringify(rawValues.map((value) => String(value)))
|
||||
return `{ column_id: ${columnId}, column_values: ${columnValues} }`
|
||||
})
|
||||
.join(', ')}]`
|
||||
return {
|
||||
query: `query { items_page_by_column_values(limit: ${limit}, board_id: ${boardId}, columns: ${columnsLiteral}) { cursor items { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } } }`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { items: [], count: 0, cursor: null }, error }
|
||||
}
|
||||
|
||||
const page = data.data?.items_page_by_column_values ?? data.data?.next_items_page
|
||||
if (!page) {
|
||||
return { success: true, output: { items: [], count: 0, cursor: null } }
|
||||
}
|
||||
|
||||
const items = (page.items ?? []).map((item: Record<string, unknown>) => {
|
||||
const board = item.board as Record<string, unknown> | null
|
||||
const group = item.group as Record<string, unknown> | null
|
||||
const columnValues = ((item.column_values as Record<string, unknown>[]) ?? []).map(
|
||||
(cv: Record<string, unknown>) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
id: item.id as string,
|
||||
name: (item.name as string) ?? '',
|
||||
state: (item.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (item.created_at as string) ?? null,
|
||||
updatedAt: (item.updated_at as string) ?? null,
|
||||
url: (item.url as string) ?? null,
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
items,
|
||||
count: items.length,
|
||||
cursor: (page.cursor as string) ?? null,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
items: {
|
||||
type: 'array',
|
||||
description: 'Matching items',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: { type: 'string', description: 'Item state', optional: true },
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
count: {
|
||||
type: 'number',
|
||||
description: 'Number of items returned',
|
||||
},
|
||||
cursor: {
|
||||
type: 'string',
|
||||
description: 'Pagination cursor for fetching the next page',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
import type { ToolResponse } from '@/tools/types'
|
||||
|
||||
interface MondayBoard {
|
||||
id: string
|
||||
name: string
|
||||
description: string | null
|
||||
state: string
|
||||
boardKind: string
|
||||
itemsCount: number
|
||||
url: string
|
||||
updatedAt: string | null
|
||||
}
|
||||
|
||||
interface MondayGroup {
|
||||
id: string
|
||||
title: string
|
||||
color: string
|
||||
archived: boolean | null
|
||||
deleted: boolean | null
|
||||
position: string
|
||||
}
|
||||
|
||||
interface MondayColumn {
|
||||
id: string
|
||||
title: string
|
||||
type: string
|
||||
}
|
||||
|
||||
interface MondayColumnValue {
|
||||
id: string
|
||||
text: string | null
|
||||
value: string | null
|
||||
type: string
|
||||
}
|
||||
|
||||
interface MondayItem {
|
||||
id: string
|
||||
name: string
|
||||
state: string | null
|
||||
boardId: string | null
|
||||
groupId: string | null
|
||||
groupTitle: string | null
|
||||
columnValues: MondayColumnValue[]
|
||||
createdAt: string | null
|
||||
updatedAt: string | null
|
||||
url: string | null
|
||||
}
|
||||
|
||||
interface MondayUpdate {
|
||||
id: string
|
||||
body: string
|
||||
textBody: string | null
|
||||
createdAt: string | null
|
||||
creatorId: string | null
|
||||
itemId: string | null
|
||||
}
|
||||
|
||||
export interface MondayListBoardsParams {
|
||||
accessToken: string
|
||||
limit?: number
|
||||
page?: number
|
||||
}
|
||||
|
||||
export interface MondayListBoardsResponse extends ToolResponse {
|
||||
output: {
|
||||
boards: MondayBoard[]
|
||||
count: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayGetBoardParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
}
|
||||
|
||||
export interface MondayGetBoardResponse extends ToolResponse {
|
||||
output: {
|
||||
board: MondayBoard | null
|
||||
groups: MondayGroup[]
|
||||
columns: MondayColumn[]
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayGetItemsParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
groupId?: string
|
||||
limit?: number
|
||||
}
|
||||
|
||||
export interface MondayGetItemsResponse extends ToolResponse {
|
||||
output: {
|
||||
items: MondayItem[]
|
||||
count: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayCreateItemParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
itemName: string
|
||||
groupId?: string
|
||||
columnValues?: string
|
||||
}
|
||||
|
||||
export interface MondayCreateItemResponse extends ToolResponse {
|
||||
output: {
|
||||
item: MondayItem | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayUpdateItemParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
itemId: string
|
||||
columnValues: string
|
||||
}
|
||||
|
||||
export interface MondayUpdateItemResponse extends ToolResponse {
|
||||
output: {
|
||||
item: MondayItem | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayDeleteItemParams {
|
||||
accessToken: string
|
||||
itemId: string
|
||||
}
|
||||
|
||||
export interface MondayDeleteItemResponse extends ToolResponse {
|
||||
output: {
|
||||
id: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayCreateUpdateParams {
|
||||
accessToken: string
|
||||
itemId: string
|
||||
body: string
|
||||
}
|
||||
|
||||
export interface MondayCreateUpdateResponse extends ToolResponse {
|
||||
output: {
|
||||
update: MondayUpdate | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondaySearchItemsParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
columns: string
|
||||
limit?: number
|
||||
cursor?: string
|
||||
}
|
||||
|
||||
export interface MondaySearchItemsResponse extends ToolResponse {
|
||||
output: {
|
||||
items: MondayItem[]
|
||||
count: number
|
||||
cursor: string | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayCreateSubitemParams {
|
||||
accessToken: string
|
||||
parentItemId: string
|
||||
itemName: string
|
||||
columnValues?: string
|
||||
}
|
||||
|
||||
export interface MondayCreateSubitemResponse extends ToolResponse {
|
||||
output: {
|
||||
item: MondayItem | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayMoveItemToGroupParams {
|
||||
accessToken: string
|
||||
itemId: string
|
||||
groupId: string
|
||||
}
|
||||
|
||||
export interface MondayMoveItemToGroupResponse extends ToolResponse {
|
||||
output: {
|
||||
item: MondayItem | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayGetItemParams {
|
||||
accessToken: string
|
||||
itemId: string
|
||||
}
|
||||
|
||||
export interface MondayGetItemResponse extends ToolResponse {
|
||||
output: {
|
||||
item: MondayItem | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayArchiveItemParams {
|
||||
accessToken: string
|
||||
itemId: string
|
||||
}
|
||||
|
||||
export interface MondayArchiveItemResponse extends ToolResponse {
|
||||
output: {
|
||||
id: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayCreateGroupParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
groupName: string
|
||||
groupColor?: string
|
||||
}
|
||||
|
||||
export interface MondayCreateGroupResponse extends ToolResponse {
|
||||
output: {
|
||||
group: MondayGroup | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayChangeColumnValueParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
itemId: string
|
||||
columnId: string
|
||||
value: string
|
||||
createLabelsIfMissing?: boolean
|
||||
}
|
||||
|
||||
export interface MondayChangeColumnValueResponse extends ToolResponse {
|
||||
output: {
|
||||
item: MondayItem | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayCreateBoardParams {
|
||||
accessToken: string
|
||||
boardName: string
|
||||
boardKind: string
|
||||
description?: string
|
||||
workspaceId?: string
|
||||
folderId?: string
|
||||
}
|
||||
|
||||
export interface MondayCreateBoardResponse extends ToolResponse {
|
||||
output: {
|
||||
board: MondayBoard | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayCreateColumnParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
columnTitle: string
|
||||
columnType: string
|
||||
columnDescription?: string
|
||||
columnDefaults?: string
|
||||
}
|
||||
|
||||
export interface MondayCreateColumnResponse extends ToolResponse {
|
||||
output: {
|
||||
column: MondayColumn | null
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayGetGroupsParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
}
|
||||
|
||||
export interface MondayGetGroupsResponse extends ToolResponse {
|
||||
output: {
|
||||
groups: MondayGroup[]
|
||||
count: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface MondayDuplicateItemParams {
|
||||
accessToken: string
|
||||
boardId: string
|
||||
itemId: string
|
||||
withUpdates?: boolean
|
||||
}
|
||||
|
||||
export interface MondayDuplicateItemResponse extends ToolResponse {
|
||||
output: {
|
||||
item: MondayItem | null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import type { MondayUpdateItemParams, MondayUpdateItemResponse } from '@/tools/monday/types'
|
||||
import {
|
||||
extractMondayError,
|
||||
MONDAY_API_URL,
|
||||
mondayHeaders,
|
||||
sanitizeNumericId,
|
||||
} from '@/tools/monday/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const mondayUpdateItemTool: ToolConfig<MondayUpdateItemParams, MondayUpdateItemResponse> = {
|
||||
id: 'monday_update_item',
|
||||
name: 'Monday Update Item',
|
||||
description: 'Update column values of an item on a Monday.com board',
|
||||
version: '1.0.0',
|
||||
|
||||
oauth: {
|
||||
required: true,
|
||||
provider: 'monday',
|
||||
},
|
||||
|
||||
params: {
|
||||
accessToken: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'hidden',
|
||||
description: 'Monday.com OAuth access token',
|
||||
},
|
||||
boardId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the board containing the item',
|
||||
},
|
||||
itemId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the item to update',
|
||||
},
|
||||
columnValues: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description:
|
||||
'JSON string of column values to update (e.g., {"status":"Done","date":"2024-01-01"})',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: MONDAY_API_URL,
|
||||
method: 'POST',
|
||||
headers: (params) => mondayHeaders(params.accessToken),
|
||||
body: (params) => ({
|
||||
query: `mutation { change_multiple_column_values(item_id: ${sanitizeNumericId(params.itemId, 'itemId')}, board_id: ${sanitizeNumericId(params.boardId, 'boardId')}, column_values: ${JSON.stringify(params.columnValues)}) { id name state board { id } group { id title } column_values { id text value type } created_at updated_at url } }`,
|
||||
}),
|
||||
},
|
||||
|
||||
transformResponse: async (response) => {
|
||||
const data = await response.json()
|
||||
const error = extractMondayError(data)
|
||||
if (error) {
|
||||
return { success: false, output: { item: null }, error }
|
||||
}
|
||||
|
||||
const raw = data.data?.change_multiple_column_values
|
||||
if (!raw) {
|
||||
return { success: false, output: { item: null }, error: 'Failed to update item' }
|
||||
}
|
||||
|
||||
const board = raw.board as Record<string, unknown> | null
|
||||
const group = raw.group as Record<string, unknown> | null
|
||||
const columnValues = ((raw.column_values as Record<string, unknown>[]) ?? []).map(
|
||||
(cv: Record<string, unknown>) => ({
|
||||
id: cv.id as string,
|
||||
text: (cv.text as string) ?? null,
|
||||
value: (cv.value as string) ?? null,
|
||||
type: (cv.type as string) ?? '',
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
item: {
|
||||
id: raw.id as string,
|
||||
name: (raw.name as string) ?? '',
|
||||
state: (raw.state as string) ?? null,
|
||||
boardId: board ? (board.id as string) : null,
|
||||
groupId: group ? (group.id as string) : null,
|
||||
groupTitle: group ? ((group.title as string) ?? null) : null,
|
||||
columnValues,
|
||||
createdAt: (raw.created_at as string) ?? null,
|
||||
updatedAt: (raw.updated_at as string) ?? null,
|
||||
url: (raw.url as string) ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
item: {
|
||||
type: 'json',
|
||||
description: 'The updated item',
|
||||
optional: true,
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Item ID' },
|
||||
name: { type: 'string', description: 'Item name' },
|
||||
state: { type: 'string', description: 'Item state', optional: true },
|
||||
boardId: { type: 'string', description: 'Board ID', optional: true },
|
||||
groupId: { type: 'string', description: 'Group ID', optional: true },
|
||||
groupTitle: { type: 'string', description: 'Group title', optional: true },
|
||||
columnValues: {
|
||||
type: 'array',
|
||||
description: 'Column values',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { type: 'string', description: 'Column ID' },
|
||||
text: { type: 'string', description: 'Text value', optional: true },
|
||||
value: { type: 'string', description: 'Raw JSON value', optional: true },
|
||||
type: { type: 'string', description: 'Column type' },
|
||||
},
|
||||
},
|
||||
},
|
||||
createdAt: { type: 'string', description: 'Creation timestamp', optional: true },
|
||||
updatedAt: { type: 'string', description: 'Last updated timestamp', optional: true },
|
||||
url: { type: 'string', description: 'Item URL', optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { validateMondayNumericId } from '@/lib/core/security/input-validation'
|
||||
|
||||
export const MONDAY_API_URL = 'https://api.monday.com/v2'
|
||||
|
||||
export function mondayHeaders(accessToken: string): Record<string, string> {
|
||||
return {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: accessToken,
|
||||
'API-Version': '2026-04',
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a Monday.com numeric ID and returns the sanitized string.
|
||||
* Delegates to validateMondayNumericId; throws on invalid input.
|
||||
*/
|
||||
export function sanitizeNumericId(value: string | number, paramName: string): string {
|
||||
const result = validateMondayNumericId(value, paramName)
|
||||
if (!result.isValid) {
|
||||
throw new Error(result.error!)
|
||||
}
|
||||
return result.sanitized!
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerces a limit/page param to a safe integer within bounds.
|
||||
*/
|
||||
export function sanitizeLimit(value: number | undefined, defaultVal: number, max: number): number {
|
||||
const n = Number(value ?? defaultVal)
|
||||
if (!Number.isFinite(n) || n < 1) return defaultVal
|
||||
return Math.min(n, max)
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a GraphQL enum literal (e.g., board_kind, column_type) against an
|
||||
* allowlist and returns the bare, unquoted value for safe inlining. GraphQL
|
||||
* enums must NOT be JSON-stringified; this guards against query injection by
|
||||
* rejecting anything outside the provided set.
|
||||
*/
|
||||
export function sanitizeEnum(
|
||||
value: string | undefined,
|
||||
paramName: string,
|
||||
allowed: readonly string[]
|
||||
): string {
|
||||
const normalized = typeof value === 'string' ? value.trim() : ''
|
||||
if (!allowed.includes(normalized)) {
|
||||
throw new Error(`Invalid ${paramName}: "${value}". Expected one of: ${allowed.join(', ')}`)
|
||||
}
|
||||
return normalized
|
||||
}
|
||||
|
||||
export function extractMondayError(data: Record<string, unknown>): string | null {
|
||||
if (data.errors && Array.isArray(data.errors) && data.errors.length > 0) {
|
||||
const messages = (data.errors as Array<Record<string, unknown>>)
|
||||
.map((e) => e.message as string)
|
||||
.filter(Boolean)
|
||||
return messages.length > 0 ? messages.join('; ') : 'Unknown Monday.com API error'
|
||||
}
|
||||
if (data.error_message) {
|
||||
return data.error_message as string
|
||||
}
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user