@@ -1169,22 +1169,31 @@ TEST(ui_server_mutations_require_json_content_type) {
11691169TEST (ui_server_rpc_allows_only_ui_read_tools ) {
11701170 th_server_t ts ;
11711171 ASSERT_EQ (th_server_start (& ts ), 0 );
1172- const char * body = "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\","
1173- "\"params\":{\"name\":\"list_projects\",\"arguments\":{}}}" ;
11741172 char req [1024 ];
1175- snprintf (req , sizeof (req ),
1176- "POST /rpc HTTP/1.1\r\n"
1177- "Content-Type: application/json\r\n"
1178- "Content-Length: %d\r\n\r\n%s" ,
1179- (int )strlen (body ), body );
11801173 char resp [8192 ];
1181- int n = th_http (cbm_http_server_port (ts .srv ), req , resp , sizeof (resp ));
1182- ASSERT_GT (n , 0 );
1183- ASSERT_EQ (th_status (resp ), 200 );
1184- ASSERT_NOT_NULL (strstr (resp , "\"jsonrpc\"" ));
1174+ int n ;
1175+
1176+ static const char * allowed_tools [] = {"list_projects" , "get_code_snippet" , "get_graph_schema" };
1177+ for (size_t i = 0 ; i < sizeof (allowed_tools ) / sizeof (allowed_tools [0 ]); i ++ ) {
1178+ char allowed_body [512 ];
1179+ snprintf (allowed_body , sizeof (allowed_body ),
1180+ "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\","
1181+ "\"params\":{\"name\":\"%s\",\"arguments\":{}}}" ,
1182+ allowed_tools [i ]);
1183+ snprintf (req , sizeof (req ),
1184+ "POST /rpc HTTP/1.1\r\n"
1185+ "Content-Type: application/json\r\n"
1186+ "Content-Length: %zu\r\n\r\n%s" ,
1187+ strlen (allowed_body ), allowed_body );
1188+ n = th_http (cbm_http_server_port (ts .srv ), req , resp , sizeof (resp ));
1189+ ASSERT_GT (n , 0 );
1190+ ASSERT_EQ (th_status (resp ), 200 );
1191+ ASSERT_NOT_NULL (strstr (resp , "\"jsonrpc\"" ));
1192+ ASSERT_NULL (strstr (resp , "UI RPC method is not allowed" ));
1193+ }
11851194
1186- static const char * blocked_tools [] = {"delete_project " , "manage_adr " , "ingest_traces " ,
1187- "index_repository" };
1195+ static const char * blocked_tools [] = {"search_graph " , "delete_project " , "manage_adr " ,
1196+ "ingest_traces" , " index_repository" };
11881197 for (size_t i = 0 ; i < sizeof (blocked_tools ) / sizeof (blocked_tools [0 ]); i ++ ) {
11891198 char blocked_body [512 ];
11901199 snprintf (blocked_body , sizeof (blocked_body ),
0 commit comments