@@ -5,20 +5,21 @@ import { checkFactuality } from '@repo/eval-tools/src/scorers'
55import { eachModel } from '@repo/eval-tools/src/test-models'
66
77import { initializeClient , runTask } from './utils' // Assuming utils.ts will exist here
8+ import { KV_NAMESPACE_TOOLS } from '@repo/mcp-common/src/tools/kv_namespace'
89
910eachModel ( '$modelName' , ( { model } ) => {
1011 describeEval ( 'Create Cloudflare KV Namespace' , {
1112 data : async ( ) => [
1213 {
1314 input : 'Create a new Cloudflare KV Namespace called "my-test-namespace".' ,
14- expected : ' The kv_namespaces_create tool should be called to create a new kv namespace.' ,
15+ expected : ` The ${ KV_NAMESPACE_TOOLS . kv_namespace_create } tool should be called to create a new kv namespace.` ,
1516 } ,
1617 ] ,
1718 task : async ( input : string ) => {
1819 const client = await initializeClient ( /* Pass necessary mocks/config */ )
1920 const { promptOutput, toolCalls } = await runTask ( client , model , input )
2021
21- const toolCall = toolCalls . find ( ( call ) => call . toolName === ' kv_namespace_create' )
22+ const toolCall = toolCalls . find ( ( call ) => call . toolName === KV_NAMESPACE_TOOLS . kv_namespace_create )
2223 expect ( toolCall , 'Tool kv_namespace_create was not called' ) . toBeDefined ( )
2324
2425 return promptOutput
@@ -32,14 +33,14 @@ eachModel('$modelName', ({ model }) => {
3233 {
3334 input : 'List all my Cloudflare KV Namespaces.' ,
3435 expected :
35- ' The kv_namespaces_list tool should be called to retrieve the list of kv namespaces. There should be at least one kv namespace in the list.' ,
36+ ` The ${ KV_NAMESPACE_TOOLS . kv_namespaces_list } tool should be called to retrieve the list of kv namespaces. There should be at least one kv namespace in the list.` ,
3637 } ,
3738 ] ,
3839 task : async ( input : string ) => {
3940 const client = await initializeClient ( /* Pass necessary mocks/config */ )
4041 const { promptOutput, toolCalls } = await runTask ( client , model , input )
4142
42- const toolCall = toolCalls . find ( ( call ) => call . toolName === ' kv_namespaces_list' )
43+ const toolCall = toolCalls . find ( ( call ) => call . toolName === KV_NAMESPACE_TOOLS . kv_namespaces_list )
4344 expect ( toolCall , 'Tool kv_namespaces_list was not called' ) . toBeDefined ( )
4445
4546 return promptOutput
@@ -53,14 +54,14 @@ eachModel('$modelName', ({ model }) => {
5354 {
5455 input :
5556 'Rename my Cloudflare KV Namespace called "my-test-namespace" to "my-new-test-namespace".' ,
56- expected : ' The kv_namespace_update tool should be called to rename the kv namespace.' ,
57+ expected : ` The ${ KV_NAMESPACE_TOOLS . kv_namespace_update } tool should be called to rename the kv namespace.` ,
5758 } ,
5859 ] ,
5960 task : async ( input : string ) => {
6061 const client = await initializeClient ( /* Pass necessary mocks/config */ )
6162 const { promptOutput, toolCalls } = await runTask ( client , model , input )
6263
63- const toolCall = toolCalls . find ( ( call ) => call . toolName === ' kv_namespace_update' )
64+ const toolCall = toolCalls . find ( ( call ) => call . toolName === KV_NAMESPACE_TOOLS . kv_namespace_update )
6465 expect ( toolCall , 'Tool kv_namespace_update was not called' ) . toBeDefined ( )
6566
6667 return promptOutput
@@ -74,15 +75,14 @@ eachModel('$modelName', ({ model }) => {
7475 {
7576 input : 'Get details of my Cloudflare KV Namespace called "my-new-test-namespace".' ,
7677 expected :
77- ' The kv_namespace_get tool should be called to retrieve the details of the kv namespace.' ,
78+ ` The ${ KV_NAMESPACE_TOOLS . kv_namespace_get } tool should be called to retrieve the details of the kv namespace.` ,
7879 } ,
7980 ] ,
8081 task : async ( input : string ) => {
8182 const client = await initializeClient ( /* Pass necessary mocks/config */ )
82- const { promptOutput, toolCalls, fullResult } = await runTask ( client , model , input )
83+ const { promptOutput, toolCalls } = await runTask ( client , model , input )
8384
84- console . log ( 'fullResult' , JSON . stringify ( await fullResult . response , null , 2 ) )
85- const toolCall = toolCalls . find ( ( call ) => call . toolName === 'kv_namespace_get' )
85+ const toolCall = toolCalls . find ( ( call ) => call . toolName === KV_NAMESPACE_TOOLS . kv_namespace_get )
8686 expect ( toolCall , 'Tool kv_namespace_get was not called' ) . toBeDefined ( )
8787
8888 return promptOutput
@@ -95,14 +95,14 @@ eachModel('$modelName', ({ model }) => {
9595 data : async ( ) => [
9696 {
9797 input : 'Look up the id of my only KV namespace and delete it.' ,
98- expected : ' The kv_namespace_delete tool should be called to delete the kv namespace.' ,
98+ expected : ` The ${ KV_NAMESPACE_TOOLS . kv_namespace_delete } tool should be called to delete the kv namespace.` ,
9999 } ,
100100 ] ,
101101 task : async ( input : string ) => {
102102 const client = await initializeClient ( /* Pass necessary mocks/config */ )
103103 const { promptOutput, toolCalls } = await runTask ( client , model , input )
104104
105- const toolCall = toolCalls . find ( ( call ) => call . toolName === ' kv_namespace_delete' )
105+ const toolCall = toolCalls . find ( ( call ) => call . toolName === KV_NAMESPACE_TOOLS . kv_namespace_delete )
106106 expect ( toolCall , 'Tool kv_namespace_delete was not called' ) . toBeDefined ( )
107107
108108 return promptOutput
0 commit comments