Skip to content

Commit 4988ba6

Browse files
authored
feat(trello): expand tool coverage and fix API gaps (#5357)
* feat(trello): expand tool coverage and fix API gaps - add delete card, remove label/member, update list, add/update checklist item, list members, and search tools - add filter support to list lists/cards, since/before paging to get actions, member assignment on card creation - promote move-to-list field out of advanced mode * fix(trello): address review feedback on checklist item tooling - idChecklist can be absent on Trello checkItem responses, so stop treating it as required - validate state/name is provided before building the update-checklist-item request URL - reject Update Checklist Item at the block level when neither State nor New Item Name is set - add missing idOrganization field to search's board output schema
1 parent a08da86 commit 4988ba6

17 files changed

Lines changed: 1812 additions & 15 deletions

apps/sim/blocks/blocks/trello.ts

Lines changed: 518 additions & 14 deletions
Large diffs are not rendered by default.

apps/sim/tools/registry.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,19 +3899,27 @@ import {
38993899
tinybirdTruncateDatasourceTool,
39003900
} from '@/tools/tinybird'
39013901
import {
3902+
trelloAddChecklistItemTool,
39023903
trelloAddChecklistTool,
39033904
trelloAddCommentTool,
39043905
trelloAddLabelTool,
39053906
trelloAddMemberTool,
39063907
trelloCreateBoardTool,
39073908
trelloCreateCardTool,
39083909
trelloCreateListTool,
3910+
trelloDeleteCardTool,
39093911
trelloGetActionsTool,
39103912
trelloGetBoardTool,
39113913
trelloGetCardTool,
39123914
trelloListCardsTool,
39133915
trelloListListsTool,
3916+
trelloListMembersTool,
3917+
trelloRemoveLabelTool,
3918+
trelloRemoveMemberTool,
3919+
trelloSearchTool,
39143920
trelloUpdateCardTool,
3921+
trelloUpdateChecklistItemTool,
3922+
trelloUpdateListTool,
39153923
} from '@/tools/trello'
39163924
import {
39173925
triggerDevActivateScheduleTool,
@@ -6560,15 +6568,23 @@ export const tools: Record<string, ToolConfig> = {
65606568
trello_list_cards: trelloListCardsTool,
65616569
trello_create_card: trelloCreateCardTool,
65626570
trello_update_card: trelloUpdateCardTool,
6571+
trello_delete_card: trelloDeleteCardTool,
65636572
trello_get_actions: trelloGetActionsTool,
65646573
trello_add_comment: trelloAddCommentTool,
65656574
trello_create_board: trelloCreateBoardTool,
65666575
trello_get_board: trelloGetBoardTool,
65676576
trello_create_list: trelloCreateListTool,
6577+
trello_update_list: trelloUpdateListTool,
65686578
trello_get_card: trelloGetCardTool,
65696579
trello_add_checklist: trelloAddChecklistTool,
6580+
trello_add_checklist_item: trelloAddChecklistItemTool,
6581+
trello_update_checklist_item: trelloUpdateChecklistItemTool,
65706582
trello_add_label: trelloAddLabelTool,
6583+
trello_remove_label: trelloRemoveLabelTool,
65716584
trello_add_member: trelloAddMemberTool,
6585+
trello_remove_member: trelloRemoveMemberTool,
6586+
trello_list_members: trelloListMembersTool,
6587+
trello_search: trelloSearchTool,
65726588
trigger_dev_trigger_task: triggerDevTriggerTaskTool,
65736589
trigger_dev_batch_trigger_task: triggerDevBatchTriggerTaskTool,
65746590
trigger_dev_get_batch: triggerDevGetBatchTool,
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import { getErrorMessage } from '@sim/utils/errors'
2+
import { env } from '@/lib/core/config/env'
3+
import {
4+
extractTrelloErrorMessage,
5+
mapTrelloChecklistItem,
6+
TRELLO_API_BASE_URL,
7+
} from '@/tools/trello/shared'
8+
import type {
9+
TrelloAddChecklistItemParams,
10+
TrelloAddChecklistItemResponse,
11+
} from '@/tools/trello/types'
12+
import type { ToolConfig } from '@/tools/types'
13+
14+
export const trelloAddChecklistItemTool: ToolConfig<
15+
TrelloAddChecklistItemParams,
16+
TrelloAddChecklistItemResponse
17+
> = {
18+
id: 'trello_add_checklist_item',
19+
name: 'Trello Add Checklist Item',
20+
description: 'Add an item to a Trello checklist',
21+
version: '1.0.0',
22+
23+
oauth: {
24+
required: true,
25+
provider: 'trello',
26+
},
27+
28+
params: {
29+
accessToken: {
30+
type: 'string',
31+
required: true,
32+
visibility: 'hidden',
33+
description: 'Trello OAuth access token',
34+
},
35+
checklistId: {
36+
type: 'string',
37+
required: true,
38+
visibility: 'user-or-llm',
39+
description: 'Trello checklist ID to add the item to (24-character hex string)',
40+
},
41+
name: {
42+
type: 'string',
43+
required: true,
44+
visibility: 'user-or-llm',
45+
description: 'Name of the checklist item',
46+
},
47+
pos: {
48+
type: 'string',
49+
required: false,
50+
visibility: 'user-or-llm',
51+
description: 'Position of the item (top, bottom, or positive float)',
52+
},
53+
checked: {
54+
type: 'boolean',
55+
required: false,
56+
visibility: 'user-or-llm',
57+
description: 'Whether the item should start checked off',
58+
},
59+
},
60+
61+
request: {
62+
url: (params) => {
63+
if (!params.checklistId) {
64+
throw new Error('Checklist ID is required')
65+
}
66+
if (!params.name) {
67+
throw new Error('Checklist item name is required')
68+
}
69+
const apiKey = env.TRELLO_API_KEY
70+
71+
if (!apiKey) {
72+
throw new Error('TRELLO_API_KEY environment variable is not set')
73+
}
74+
75+
const url = new URL(
76+
`${TRELLO_API_BASE_URL}/checklists/${params.checklistId.trim()}/checkItems`
77+
)
78+
url.searchParams.set('key', apiKey)
79+
url.searchParams.set('token', params.accessToken)
80+
url.searchParams.set('name', params.name.trim())
81+
82+
if (params.pos) url.searchParams.set('pos', params.pos)
83+
if (params.checked !== undefined) url.searchParams.set('checked', String(params.checked))
84+
85+
return url.toString()
86+
},
87+
method: 'POST',
88+
headers: () => ({
89+
Accept: 'application/json',
90+
}),
91+
},
92+
93+
transformResponse: async (response) => {
94+
const data = await response.json().catch(() => null)
95+
96+
if (!response.ok) {
97+
const error = extractTrelloErrorMessage(response, data, 'Failed to add checklist item')
98+
99+
return {
100+
success: false,
101+
output: {
102+
error,
103+
},
104+
error,
105+
}
106+
}
107+
108+
try {
109+
const item = mapTrelloChecklistItem(data)
110+
111+
return {
112+
success: true,
113+
output: {
114+
item,
115+
},
116+
}
117+
} catch (error) {
118+
const message = getErrorMessage(error, 'Failed to parse created checklist item')
119+
120+
return {
121+
success: false,
122+
output: {
123+
error: message,
124+
},
125+
error: message,
126+
}
127+
}
128+
},
129+
130+
outputs: {
131+
item: {
132+
type: 'json',
133+
description: 'Created checklist item (id, name, state, pos, idChecklist)',
134+
optional: true,
135+
properties: {
136+
id: { type: 'string', description: 'Checklist item ID' },
137+
name: { type: 'string', description: 'Checklist item name' },
138+
state: { type: 'string', description: 'Item state (complete or incomplete)' },
139+
pos: { type: 'number', description: 'Item position on the checklist' },
140+
idChecklist: {
141+
type: 'string',
142+
description: 'Checklist ID containing the item',
143+
optional: true,
144+
},
145+
},
146+
},
147+
},
148+
}

apps/sim/tools/trello/create_card.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ export const trelloCreateCardTool: ToolConfig<TrelloCreateCardParams, TrelloCrea
7272
description: 'A Trello label ID',
7373
},
7474
},
75+
memberIds: {
76+
type: 'array',
77+
required: false,
78+
visibility: 'user-or-llm',
79+
description: 'Member IDs to assign to the card',
80+
items: {
81+
type: 'string',
82+
description: 'A Trello member ID',
83+
},
84+
},
7585
},
7686

7787
request: {
@@ -111,6 +121,7 @@ export const trelloCreateCardTool: ToolConfig<TrelloCreateCardParams, TrelloCrea
111121
if (params.due) body.due = params.due
112122
if (params.dueComplete !== undefined) body.dueComplete = params.dueComplete
113123
if (params.labelIds?.length) body.idLabels = params.labelIds
124+
if (params.memberIds?.length) body.idMembers = params.memberIds
114125

115126
return body
116127
},
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import { env } from '@/lib/core/config/env'
2+
import { extractTrelloErrorMessage, TRELLO_API_BASE_URL } from '@/tools/trello/shared'
3+
import type { TrelloDeleteCardParams, TrelloDeleteCardResponse } from '@/tools/trello/types'
4+
import type { ToolConfig } from '@/tools/types'
5+
6+
export const trelloDeleteCardTool: ToolConfig<TrelloDeleteCardParams, TrelloDeleteCardResponse> = {
7+
id: 'trello_delete_card',
8+
name: 'Trello Delete Card',
9+
description: 'Permanently delete a Trello card',
10+
version: '1.0.0',
11+
12+
oauth: {
13+
required: true,
14+
provider: 'trello',
15+
},
16+
17+
params: {
18+
accessToken: {
19+
type: 'string',
20+
required: true,
21+
visibility: 'hidden',
22+
description: 'Trello OAuth access token',
23+
},
24+
cardId: {
25+
type: 'string',
26+
required: true,
27+
visibility: 'user-or-llm',
28+
description: 'Trello card ID to permanently delete (24-character hex string)',
29+
},
30+
},
31+
32+
request: {
33+
url: (params) => {
34+
if (!params.cardId) {
35+
throw new Error('Card ID is required')
36+
}
37+
const apiKey = env.TRELLO_API_KEY
38+
39+
if (!apiKey) {
40+
throw new Error('TRELLO_API_KEY environment variable is not set')
41+
}
42+
43+
const url = new URL(`${TRELLO_API_BASE_URL}/cards/${params.cardId.trim()}`)
44+
url.searchParams.set('key', apiKey)
45+
url.searchParams.set('token', params.accessToken)
46+
47+
return url.toString()
48+
},
49+
method: 'DELETE',
50+
headers: () => ({
51+
Accept: 'application/json',
52+
}),
53+
},
54+
55+
transformResponse: async (response) => {
56+
const data = await response.json().catch(() => null)
57+
58+
if (!response.ok) {
59+
const error = extractTrelloErrorMessage(response, data, 'Failed to delete card')
60+
61+
return {
62+
success: false,
63+
output: {
64+
success: false,
65+
error,
66+
},
67+
error,
68+
}
69+
}
70+
71+
return {
72+
success: true,
73+
output: {
74+
success: true,
75+
},
76+
}
77+
},
78+
79+
outputs: {
80+
success: {
81+
type: 'boolean',
82+
description: 'Whether the card was deleted',
83+
},
84+
},
85+
}

apps/sim/tools/trello/get_actions.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ export const trelloGetActionsTool: ToolConfig<TrelloGetActionsParams, TrelloGetA
5656
visibility: 'user-or-llm',
5757
description: 'Page number for action results',
5858
},
59+
since: {
60+
type: 'string',
61+
required: false,
62+
visibility: 'user-or-llm',
63+
description:
64+
'Only return actions after this date (ISO 8601 timestamp) or action ID, for paging through long histories',
65+
},
66+
before: {
67+
type: 'string',
68+
required: false,
69+
visibility: 'user-or-llm',
70+
description:
71+
'Only return actions before this date (ISO 8601 timestamp) or action ID, for paging through long histories',
72+
},
5973
},
6074

6175
request: {
@@ -92,6 +106,14 @@ export const trelloGetActionsTool: ToolConfig<TrelloGetActionsParams, TrelloGetA
92106
url.searchParams.set('page', String(params.page))
93107
}
94108

109+
if (params.since) {
110+
url.searchParams.set('since', params.since)
111+
}
112+
113+
if (params.before) {
114+
url.searchParams.set('before', params.before)
115+
}
116+
95117
return url.toString()
96118
},
97119
method: 'GET',

apps/sim/tools/trello/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
11
import { trelloAddChecklistTool } from '@/tools/trello/add_checklist'
2+
import { trelloAddChecklistItemTool } from '@/tools/trello/add_checklist_item'
23
import { trelloAddCommentTool } from '@/tools/trello/add_comment'
34
import { trelloAddLabelTool } from '@/tools/trello/add_label'
45
import { trelloAddMemberTool } from '@/tools/trello/add_member'
56
import { trelloCreateBoardTool } from '@/tools/trello/create_board'
67
import { trelloCreateCardTool } from '@/tools/trello/create_card'
78
import { trelloCreateListTool } from '@/tools/trello/create_list'
9+
import { trelloDeleteCardTool } from '@/tools/trello/delete_card'
810
import { trelloGetActionsTool } from '@/tools/trello/get_actions'
911
import { trelloGetBoardTool } from '@/tools/trello/get_board'
1012
import { trelloGetCardTool } from '@/tools/trello/get_card'
1113
import { trelloListCardsTool } from '@/tools/trello/list_cards'
1214
import { trelloListListsTool } from '@/tools/trello/list_lists'
15+
import { trelloListMembersTool } from '@/tools/trello/list_members'
16+
import { trelloRemoveLabelTool } from '@/tools/trello/remove_label'
17+
import { trelloRemoveMemberTool } from '@/tools/trello/remove_member'
18+
import { trelloSearchTool } from '@/tools/trello/search'
1319
import { trelloUpdateCardTool } from '@/tools/trello/update_card'
20+
import { trelloUpdateChecklistItemTool } from '@/tools/trello/update_checklist_item'
21+
import { trelloUpdateListTool } from '@/tools/trello/update_list'
1422

1523
export {
1624
trelloListListsTool,
1725
trelloListCardsTool,
1826
trelloCreateCardTool,
1927
trelloUpdateCardTool,
28+
trelloDeleteCardTool,
2029
trelloGetActionsTool,
2130
trelloAddCommentTool,
2231
trelloCreateBoardTool,
2332
trelloGetBoardTool,
2433
trelloCreateListTool,
34+
trelloUpdateListTool,
2535
trelloGetCardTool,
2636
trelloAddChecklistTool,
37+
trelloAddChecklistItemTool,
38+
trelloUpdateChecklistItemTool,
2739
trelloAddLabelTool,
40+
trelloRemoveLabelTool,
2841
trelloAddMemberTool,
42+
trelloRemoveMemberTool,
43+
trelloListMembersTool,
44+
trelloSearchTool,
2945
}
3046

3147
export * from '@/tools/trello/types'

0 commit comments

Comments
 (0)