@@ -17,8 +17,8 @@ import { createObjectTool } from '../tools/create-object.tool.js';
1717import { addFieldTool } from '../tools/add-field.tool.js' ;
1818import { modifyFieldTool } from '../tools/modify-field.tool.js' ;
1919import { deleteFieldTool } from '../tools/delete-field.tool.js' ;
20- import { listMetadataObjectsTool } from '../tools/list-metadata -objects.tool.js' ;
21- import { describeMetadataObjectTool } from '../tools/describe-metadata -object.tool.js' ;
20+ import { listObjectsTool } from '../tools/list-objects.tool.js' ;
21+ import { describeObjectTool } from '../tools/describe-object.tool.js' ;
2222
2323// ── Helpers ────────────────────────────────────────────────────────
2424
@@ -63,8 +63,8 @@ describe('Metadata Tool Definitions', () => {
6363 'add_field' ,
6464 'modify_field' ,
6565 'delete_field' ,
66- 'list_metadata_objects ' ,
67- 'describe_metadata_object ' ,
66+ 'list_objects ' ,
67+ 'describe_object ' ,
6868 ] ) ;
6969 } ) ;
7070
@@ -86,8 +86,8 @@ describe('Individual Tool Metadata (.tool.ts)', () => {
8686 { tool : addFieldTool , expectedName : 'add_field' , expectedLabel : 'Add Field' } ,
8787 { tool : modifyFieldTool , expectedName : 'modify_field' , expectedLabel : 'Modify Field' } ,
8888 { tool : deleteFieldTool , expectedName : 'delete_field' , expectedLabel : 'Delete Field' } ,
89- { tool : listMetadataObjectsTool , expectedName : 'list_metadata_objects ' , expectedLabel : 'List Metadata Objects' } ,
90- { tool : describeMetadataObjectTool , expectedName : 'describe_metadata_object ' , expectedLabel : 'Describe Metadata Object' } ,
89+ { tool : listObjectsTool , expectedName : 'list_objects ' , expectedLabel : 'List Objects' } ,
90+ { tool : describeObjectTool , expectedName : 'describe_object ' , expectedLabel : 'Describe Object' } ,
9191 ] ;
9292
9393 for ( const { tool, expectedName, expectedLabel } of tools ) {
@@ -132,8 +132,8 @@ describe('Individual Tool Metadata (.tool.ts)', () => {
132132 } ) ;
133133
134134 it ( 'should not mark read-only tools as requiresConfirmation' , ( ) => {
135- expect ( listMetadataObjectsTool . requiresConfirmation ) . toBe ( false ) ;
136- expect ( describeMetadataObjectTool . requiresConfirmation ) . toBe ( false ) ;
135+ expect ( listObjectsTool . requiresConfirmation ) . toBe ( false ) ;
136+ expect ( describeObjectTool . requiresConfirmation ) . toBe ( false ) ;
137137 } ) ;
138138
139139 it ( 'should not mark add_field and modify_field as requiresConfirmation' , ( ) => {
@@ -162,17 +162,17 @@ describe('registerMetadataTools', () => {
162162 expect ( registry . has ( 'add_field' ) ) . toBe ( true ) ;
163163 expect ( registry . has ( 'modify_field' ) ) . toBe ( true ) ;
164164 expect ( registry . has ( 'delete_field' ) ) . toBe ( true ) ;
165- expect ( registry . has ( 'list_metadata_objects ' ) ) . toBe ( true ) ;
166- expect ( registry . has ( 'describe_metadata_object ' ) ) . toBe ( true ) ;
165+ expect ( registry . has ( 'list_objects ' ) ) . toBe ( true ) ;
166+ expect ( registry . has ( 'describe_object ' ) ) . toBe ( true ) ;
167167 } ) ;
168168} ) ;
169169
170170// ═══════════════════════════════════════════════════════════════════
171171// Dual registration (data tools + metadata tools)
172172// ═══════════════════════════════════════════════════════════════════
173173
174- describe ( 'registerDataTools + registerMetadataTools — no collision ' , ( ) => {
175- it ( 'should register both tool sets on the same registry without overwriting ' , ( ) => {
174+ describe ( 'registerDataTools + registerMetadataTools — unified list/describe ' , ( ) => {
175+ it ( 'should register both tool sets on the same registry with shared list_objects and describe_object ' , ( ) => {
176176 const registry = new ToolRegistry ( ) ;
177177 const metadataService = createMockMetadataService ( ) ;
178178 const dataEngine = {
@@ -181,26 +181,32 @@ describe('registerDataTools + registerMetadataTools — no collision', () => {
181181 aggregate : vi . fn ( ) ,
182182 } as any ;
183183
184- registerDataTools ( registry , { dataEngine, metadataService } ) ;
184+ registerDataTools ( registry , { dataEngine } ) ;
185185 const sizeAfterData = registry . size ;
186186
187187 registerMetadataTools ( registry , { metadataService } ) ;
188188 const sizeAfterBoth = registry . size ;
189189
190- // Data tools define: list_objects, describe_object, query_records, get_record, aggregate_data
191- // Metadata tools define: create_object, add_field, modify_field, delete_field, list_metadata_objects, describe_metadata_object
192- // No overlap — total should be sum of both
190+ // Data tools define: query_records, get_record, aggregate_data (3)
191+ // Metadata tools define: create_object, add_field, modify_field, delete_field, list_objects, describe_object (6)
192+ // Total should be 3 + 6 = 9
193+ expect ( sizeAfterData ) . toBe ( 3 ) ;
193194 expect ( sizeAfterBoth ) . toBe ( sizeAfterData + 6 ) ;
194195
195- // Data tools should still be present
196+ // Unified list/describe should be present (from metadata tools)
196197 expect ( registry . has ( 'list_objects' ) ) . toBe ( true ) ;
197198 expect ( registry . has ( 'describe_object' ) ) . toBe ( true ) ;
199+
200+ // Data-only tools should be present
198201 expect ( registry . has ( 'query_records' ) ) . toBe ( true ) ;
202+ expect ( registry . has ( 'get_record' ) ) . toBe ( true ) ;
203+ expect ( registry . has ( 'aggregate_data' ) ) . toBe ( true ) ;
199204
200- // Metadata tools should also be present with distinct names
201- expect ( registry . has ( 'list_metadata_objects' ) ) . toBe ( true ) ;
202- expect ( registry . has ( 'describe_metadata_object' ) ) . toBe ( true ) ;
205+ // Metadata-only tools should be present
203206 expect ( registry . has ( 'create_object' ) ) . toBe ( true ) ;
207+ expect ( registry . has ( 'add_field' ) ) . toBe ( true ) ;
208+ expect ( registry . has ( 'modify_field' ) ) . toBe ( true ) ;
209+ expect ( registry . has ( 'delete_field' ) ) . toBe ( true ) ;
204210 } ) ;
205211} ) ;
206212
@@ -752,7 +758,7 @@ describe('list_metadata_objects handler', () => {
752758 const result = await registry . execute ( {
753759 type : 'tool-call' as const ,
754760 toolCallId : 'c1' ,
755- toolName : 'list_metadata_objects ' ,
761+ toolName : 'list_objects ' ,
756762 input : { } ,
757763 } ) ;
758764
@@ -767,7 +773,7 @@ describe('list_metadata_objects handler', () => {
767773 const result = await registry . execute ( {
768774 type : 'tool-call' as const ,
769775 toolCallId : 'c2' ,
770- toolName : 'list_metadata_objects ' ,
776+ toolName : 'list_objects ' ,
771777 input : { filter : 'account' } ,
772778 } ) ;
773779
@@ -780,7 +786,7 @@ describe('list_metadata_objects handler', () => {
780786 const result = await registry . execute ( {
781787 type : 'tool-call' as const ,
782788 toolCallId : 'c3' ,
783- toolName : 'list_metadata_objects ' ,
789+ toolName : 'list_objects ' ,
784790 input : { includeFields : true } ,
785791 } ) ;
786792
@@ -797,7 +803,7 @@ describe('list_metadata_objects handler', () => {
797803 const result = await registry . execute ( {
798804 type : 'tool-call' as const ,
799805 toolCallId : 'c4' ,
800- toolName : 'list_metadata_objects ' ,
806+ toolName : 'list_objects ' ,
801807 input : { } ,
802808 } ) ;
803809
@@ -836,7 +842,7 @@ describe('describe_metadata_object handler', () => {
836842 const result = await registry . execute ( {
837843 type : 'tool-call' as const ,
838844 toolCallId : 'c1' ,
839- toolName : 'describe_metadata_object ' ,
845+ toolName : 'describe_object ' ,
840846 input : { objectName : 'account' } ,
841847 } ) ;
842848
@@ -858,7 +864,7 @@ describe('describe_metadata_object handler', () => {
858864 const result = await registry . execute ( {
859865 type : 'tool-call' as const ,
860866 toolCallId : 'c2' ,
861- toolName : 'describe_metadata_object ' ,
867+ toolName : 'describe_object ' ,
862868 input : { objectName : 'nonexistent' } ,
863869 } ) ;
864870
@@ -909,7 +915,7 @@ describe('Metadata Tools — full lifecycle', () => {
909915 const descResult = await registry . execute ( {
910916 type : 'tool-call' as const ,
911917 toolCallId : 's4' ,
912- toolName : 'describe_metadata_object ' ,
918+ toolName : 'describe_object ' ,
913919 input : { objectName : 'invoice' } ,
914920 } ) ;
915921 const desc = JSON . parse ( ( descResult . output as any ) . value ) ;
@@ -941,7 +947,7 @@ describe('Metadata Tools — full lifecycle', () => {
941947 const descResult2 = await registry . execute ( {
942948 type : 'tool-call' as const ,
943949 toolCallId : 's7' ,
944- toolName : 'describe_metadata_object ' ,
950+ toolName : 'describe_object ' ,
945951 input : { objectName : 'invoice' } ,
946952 } ) ;
947953 const desc2 = JSON . parse ( ( descResult2 . output as any ) . value ) ;
@@ -954,7 +960,7 @@ describe('Metadata Tools — full lifecycle', () => {
954960 const listResult = await registry . execute ( {
955961 type : 'tool-call' as const ,
956962 toolCallId : 's8' ,
957- toolName : 'list_metadata_objects ' ,
963+ toolName : 'list_objects ' ,
958964 input : { } ,
959965 } ) ;
960966 const list = JSON . parse ( ( listResult . output as any ) . value ) ;
0 commit comments