settings.json → mcp_config. must be {transport:"stdio", command: , * enabled:true}; returns false for any deviation. */
| 5560 | /* settings.json → mcp_config.<name> must be {transport:"stdio", command:<binary>, |
| 5561 | * enabled:true}; returns false for any deviation. */ |
| 5562 | static bool openhands_settings_entry_ok(const char *settings_path, const char *name, |
| 5563 | const char *binary) { |
| 5564 | yyjson_doc *doc = openhands_read_doc(settings_path); |
| 5565 | yyjson_val *root = doc ? yyjson_doc_get_root(doc) : NULL; |
| 5566 | yyjson_val *mcp_config = root ? yyjson_obj_get(root, "mcp_config") : NULL; |
| 5567 | yyjson_val *entry = mcp_config ? yyjson_obj_get(mcp_config, name) : NULL; |
| 5568 | bool ok = entry && yyjson_is_obj(entry) && yyjson_obj_size(entry) == 3U; |
| 5569 | yyjson_val *transport = ok ? yyjson_obj_get(entry, "transport") : NULL; |
| 5570 | yyjson_val *command = ok ? yyjson_obj_get(entry, "command") : NULL; |
| 5571 | yyjson_val *enabled = ok ? yyjson_obj_get(entry, "enabled") : NULL; |
| 5572 | ok = ok && transport && yyjson_is_str(transport) && |
| 5573 | strcmp(yyjson_get_str(transport), "stdio") == 0; |
| 5574 | ok = ok && command && yyjson_is_str(command) && strcmp(yyjson_get_str(command), binary) == 0; |
| 5575 | ok = ok && enabled && yyjson_is_true(enabled); |
| 5576 | yyjson_doc_free(doc); |
| 5577 | return ok; |
| 5578 | } |
| 5579 | |
| 5580 | static bool openhands_settings_entry_absent(const char *settings_path, const char *name) { |
| 5581 | yyjson_doc *doc = openhands_read_doc(settings_path); |
no test coverage detected