@@ -38,6 +38,29 @@ const oauthBlockConfig = {
3838 tools : { access : [ 'slack_message' ] } ,
3939}
4040
41+ const tableBlockConfig = {
42+ type : 'table' ,
43+ name : 'Table' ,
44+ outputs : { } ,
45+ subBlocks : [
46+ {
47+ id : 'operation' ,
48+ type : 'dropdown' ,
49+ options : [
50+ { label : 'Query Rows' , id : 'query_rows' } ,
51+ { label : 'Insert Row' , id : 'insert_row' } ,
52+ ] ,
53+ } ,
54+ ] ,
55+ tools : {
56+ access : [ 'table_query_rows' , 'table_insert_row' ] ,
57+ config : {
58+ tool : ( params : Record < string , unknown > ) =>
59+ params . operation === 'insert_row' ? 'table_insert_row' : 'table_query_rows' ,
60+ } ,
61+ } ,
62+ }
63+
4164const routerBlockConfig = {
4265 type : 'router_v2' ,
4366 name : 'Router' ,
@@ -205,6 +228,7 @@ const toolsByIdMock: Record<string, unknown> = {
205228const blockConfigsByType : Record < string , unknown > = {
206229 condition : conditionBlockConfig ,
207230 slack : oauthBlockConfig ,
231+ table : tableBlockConfig ,
208232 router_v2 : routerBlockConfig ,
209233 agent : agentBlockConfig ,
210234 pi : piBlockConfig ,
@@ -1239,6 +1263,42 @@ describe('validateInputsForBlock - agent tools (tool-input)', () => {
12391263 expect ( result . validInputs . tools ) . toBeDefined ( )
12401264 } )
12411265
1266+ it ( 'accepts a declared integration block operation' , ( ) => {
1267+ const result = validateInputsForBlock (
1268+ 'agent' ,
1269+ { tools : [ { type : 'table' , operation : 'insert_row' , usageControl : 'auto' } ] } ,
1270+ 'agent-1'
1271+ )
1272+
1273+ expect ( result . errors ) . toHaveLength ( 0 )
1274+ expect ( result . validInputs . tools ) . toBeDefined ( )
1275+ } )
1276+
1277+ it ( 'rejects a prefixed tool id used as an integration block operation' , ( ) => {
1278+ const result = validateInputsForBlock (
1279+ 'agent' ,
1280+ { tools : [ { type : 'table' , operation : 'table_insert_row' , usageControl : 'auto' } ] } ,
1281+ 'agent-1'
1282+ )
1283+
1284+ expect ( result . validInputs . tools ) . toBeUndefined ( )
1285+ expect ( result . errors ) . toHaveLength ( 1 )
1286+ expect ( result . errors [ 0 ] ?. error ) . toContain ( 'invalid operation "table_insert_row"' )
1287+ expect ( result . errors [ 0 ] ?. error ) . toContain ( 'query_rows, insert_row' )
1288+ expect ( result . errors [ 0 ] ?. error ) . toContain ( 'may differ from the underlying tool id' )
1289+ } )
1290+
1291+ it ( 'rejects a missing operation for a multi-operation integration block' , ( ) => {
1292+ const result = validateInputsForBlock (
1293+ 'agent' ,
1294+ { tools : [ { type : 'table' , usageControl : 'auto' } ] } ,
1295+ 'agent-1'
1296+ )
1297+
1298+ expect ( result . validInputs . tools ) . toBeUndefined ( )
1299+ expect ( result . errors [ 0 ] ?. error ) . toContain ( 'requires an operation' )
1300+ } )
1301+
12421302 it ( 'rejects an integration tool unavailable in this deployment' , ( ) => {
12431303 mockIsIntegrationDeploymentAvailable . mockReturnValue ( false )
12441304
0 commit comments