updates to tools and mma skills
This commit is contained in:
@@ -11,44 +11,40 @@ sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
try:
|
||||
import mcp_client
|
||||
import shell_runner
|
||||
import mcp_client
|
||||
import shell_runner
|
||||
except ImportError:
|
||||
print(json.dumps({"error": "Failed to import required modules"}))
|
||||
sys.exit(1)
|
||||
print(json.dumps({"error": "Failed to import required modules"}))
|
||||
sys.exit(1)
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
print(json.dumps({"error": "No tool name provided"}))
|
||||
sys.exit(1)
|
||||
|
||||
tool_name = sys.argv[1]
|
||||
|
||||
# Read arguments from stdin
|
||||
try:
|
||||
input_data = sys.stdin.read()
|
||||
if input_data:
|
||||
tool_input = json.loads(input_data)
|
||||
else:
|
||||
tool_input = {}
|
||||
except json.JSONDecodeError:
|
||||
print(json.dumps({"error": "Invalid JSON input"}))
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
if tool_name == "run_powershell":
|
||||
script = tool_input.get("script", "")
|
||||
# We use the current directory as base_dir for CLI calls
|
||||
result = shell_runner.run_powershell(script, os.getcwd())
|
||||
else:
|
||||
# mcp_client tools generally resolve paths relative to CWD if not configured.
|
||||
result = mcp_client.dispatch(tool_name, tool_input)
|
||||
|
||||
# We print the raw result string as that's what gemini-cli expects.
|
||||
print(result)
|
||||
except Exception as e:
|
||||
print(f"ERROR executing tool {tool_name}: {e}")
|
||||
sys.exit(1)
|
||||
if len(sys.argv) < 2:
|
||||
print(json.dumps({"error": "No tool name provided"}))
|
||||
sys.exit(1)
|
||||
tool_name = sys.argv[1]
|
||||
# Read arguments from stdin
|
||||
try:
|
||||
input_data = sys.stdin.read()
|
||||
if input_data:
|
||||
tool_input = json.loads(input_data)
|
||||
else:
|
||||
tool_input = {}
|
||||
except json.JSONDecodeError:
|
||||
print(json.dumps({"error": "Invalid JSON input"}))
|
||||
sys.exit(1)
|
||||
try:
|
||||
if tool_name == "run_powershell":
|
||||
script = tool_input.get("script", "")
|
||||
# We use the current directory as base_dir for CLI calls
|
||||
result = shell_runner.run_powershell(script, os.getcwd())
|
||||
else:
|
||||
# mcp_client tools generally resolve paths relative to CWD if not configured.
|
||||
result = mcp_client.dispatch(tool_name, tool_input)
|
||||
# We print the raw result string as that's what gemini-cli expects.
|
||||
print(result)
|
||||
except Exception as e:
|
||||
print(f"ERROR executing tool {tool_name}: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user