d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
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
161 lines
5.1 KiB
TypeScript
161 lines
5.1 KiB
TypeScript
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 },
|
|
},
|
|
},
|
|
},
|
|
}
|