#2118: annotations drive client auto-approval, so a mis-stamped read tool * is a real integration bug. Walk the REGISTERED tool list (not a mirrored * table) so a newly added tool cannot slip through: every tool must carry * annotations, a read-only tool can never be destructive, and only the tools * whose handlers actually mutate state may be non-read-only. */
| 1490 | * annotations, a read-only tool can never be destructive, and only the tools |
| 1491 | * whose handlers actually mutate state may be non-read-only. */ |
| 1492 | static yyjson_val *find_tool_json(yyjson_val *tools, const char *name) { |
| 1493 | yyjson_arr_iter iter; |
| 1494 | yyjson_arr_iter_init(tools, &iter); |
| 1495 | yyjson_val *tool; |
| 1496 | while ((tool = yyjson_arr_iter_next(&iter)) != NULL) { |
| 1497 | const char *tool_name = yyjson_get_str(yyjson_obj_get(tool, "name")); |
| 1498 | if (tool_name && strcmp(tool_name, name) == 0) { |
| 1499 | return tool; |
| 1500 | } |
| 1501 | } |
| 1502 | return NULL; |
| 1503 | } |
| 1504 | |
| 1505 | static bool tool_in_list(const char *name, const char *const *list, size_t count) { |
| 1506 | for (size_t i = 0; i < count; i++) { |