MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / find_tool_json

Function find_tool_json

tests/test_mcp.c:1492–1503  ·  view source on GitHub ↗

#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. */

Source from the content-addressed store, hash-verified

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. */
1492static 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
1505static bool tool_in_list(const char *name, const char *const *list, size_t count) {
1506 for (size_t i = 0; i < count; i++) {

Callers 1

test_mcp.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected