| 69 | } |
| 70 | |
| 71 | static size_t mcp_response_tool_count(const char *response) { |
| 72 | yyjson_doc *doc = response ? yyjson_read(response, strlen(response), 0) : NULL; |
| 73 | yyjson_val *root = doc ? yyjson_doc_get_root(doc) : NULL; |
| 74 | yyjson_val *result = root ? yyjson_obj_get(root, "result") : NULL; |
| 75 | yyjson_val *tools = result ? yyjson_obj_get(result, "tools") : NULL; |
| 76 | size_t count = tools && yyjson_is_arr(tools) ? yyjson_arr_size(tools) : 0U; |
| 77 | yyjson_doc_free(doc); |
| 78 | return count; |
| 79 | } |
| 80 | |
| 81 | static char mcp_log_buf[4096]; |
| 82 | static bool mcp_saw_autoindex_log; |