fix bugs in passing env variables

main
hkr04 2025-03-24 04:25:22 +08:00
parent ec0d299833
commit 47cc44f717
2 changed files with 3 additions and 4 deletions

2
mcp

@ -1 +1 @@
Subproject commit 5e9ff48b070a11ba20529feb22c68d0e9ef46f3d Subproject commit 3fe1e049fb877399380df00bbd8db9f42f687ff1

View File

@ -65,9 +65,8 @@ struct MCPToolConfig {
} }
// Read environment variables // Read environment variables
std::string env_section = tool_name + ".env"; if (tool_table.contains("env") && tool_table["env"].is_table()) {
if (data.contains(env_section) && data[env_section].is_table()) { const auto& env_table = *tool_table["env"].as_table();
const auto& env_table = *data[env_section].as_table();
for (const auto& [key, value] : env_table) { for (const auto& [key, value] : env_table) {
if (value.is_string()) { if (value.is_string()) {
config.env_vars[key] = value.as_string()->get(); config.env_vars[key] = value.as_string()->get();