Skip to content

Commit be95d64

Browse files
authored
Pass all env to tools.py (#140)
1 parent fdf42a0 commit be95d64

2 files changed

Lines changed: 4 additions & 10 deletions

File tree

  • splunklib/ai
  • tests/system/test_apps/ai_agentic_test_local_tools_app/bin

splunklib/ai/tools.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,18 +299,9 @@ async def connect_local_mcp(
299299
server_params = StdioServerParameters(
300300
command=sys.executable,
301301
args=[local_tools_path],
302+
env=dict(os.environ),
302303
)
303304

304-
# Splunk starts processes with a custom LD_LIBRARY_PATH env var, the mcp lib
305-
# does not forward all env, but few restricted ones by default. If we don't do
306-
# so then the shared object that python loads would fail to succeed.
307-
# TODO: If needed we might in future pass all env vars, but we would have to investigate why
308-
# the mcp lib did that filtering in the first place. For now we only allow additionally
309-
# the LD_LIBRARY_PATH.
310-
ld = os.environ.get("LD_LIBRARY_PATH")
311-
if ld is not None:
312-
server_params.env = {"LD_LIBRARY_PATH": ld}
313-
314305
async with stdio_client(server_params) as (read, write):
315306
logging_handler = _MCPLoggingHandler(logger)
316307
async with ClientSession(

tests/system/test_apps/ai_agentic_test_local_tools_app/bin/tools.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
registry = ToolRegistry()
2424

25+
# Asserts that SPLUNK_HOME is available.
26+
assert os.environ["SPLUNK_HOME"] == "/opt/splunk"
27+
2528

2629
@registry.tool(description="Returns the current temperature in the city")
2730
def temperature(ctx: ToolContext, city: str) -> str:

0 commit comments

Comments
 (0)