Conversation
When MCP tool scripts run system commands by bare name (e.g. xclock), prepending llm-functions/bin to PATH caused recursive agent invocation when an agent shared the same name. - Spawn MCP tools via absolute bin path instead of PATH lookup - Export LLM_BIN from all run-tool/run-agent entry points - Handle Windows .cmd shims when spawning - Document LLM_BIN in environment variable docs Fixes sigoden#225
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop prepending
llm-functions/bintoPATHduring MCP tool execution. ExportLLM_BINinstead and spawn tools via absolute bin paths.Motivation
When an agent tool script runs a system command by bare name (e.g.
xclock), prependingbin/toPATHcauses the shell to resolvellm-functions/bin/xclockinstead of the real system binary if an agent shares that name. This leads to recursive agent invocation or confusing failures (#225).Changes
mcp/server/index.js: removePATHprepend; addresolveBinCommand()and spawn via absolute bin path; handle Windows.cmdshimsscripts/run-tool.*/run-agent.*: exportLLM_BINfor nested llm-functions invocationsLLM_BINindocs/environment-variables.mdandmcp/server/README.mdTests
argc link-web-search web_search_perplexity.sh argc link-code-interpreter execute_js_code.js argc testdemo_shanddemo_jstests pass; output confirmsLLM_BINis exporteddemo_py.pytest skipped by project tool list (pre-existing)Notes
$LLM_BIN/<name>explicitlyPATHmutation requiredFixes #225