checkpoint
This commit is contained in:
@@ -177,14 +177,14 @@ def execute_agent(role: str, prompt: str, docs: list[str]) -> str:
|
||||
system_directive = "STRICT SYSTEM DIRECTIVE: You are a stateless Tier 3 Worker (Contributor). " \
|
||||
"Your goal is to implement specific code changes or tests based on the provided task. " \
|
||||
"You have access to tools for reading and writing files (e.g., read_file, write_file, replace), " \
|
||||
"codebase investigation (codebase_investigator), and web tools (google_web_search, web_fetch). " \
|
||||
"codebase investigation (codebase_investigator), and web tools (discovered_tool_web_search, discovered_tool_fetch_url). " \
|
||||
"You CAN execute PowerShell scripts via discovered_tool_run_powershell for verification and testing. " \
|
||||
"Follow TDD and return success status or code changes. No pleasantries, no conversational filler."
|
||||
elif role in ['tier4', 'tier4-qa']:
|
||||
system_directive = "STRICT SYSTEM DIRECTIVE: You are a stateless Tier 4 QA Agent. " \
|
||||
"Your goal is to analyze errors, summarize logs, or verify tests. " \
|
||||
"You have access to tools for reading files, exploring the codebase (codebase_investigator), " \
|
||||
"and web tools (google_web_search, web_fetch). " \
|
||||
"and web tools (discovered_tool_web_search, discovered_tool_fetch_url). " \
|
||||
"You CAN execute PowerShell scripts via discovered_tool_run_powershell for diagnostics. " \
|
||||
"ONLY output the requested analysis. No pleasantries."
|
||||
else:
|
||||
@@ -209,7 +209,7 @@ def execute_agent(role: str, prompt: str, docs: list[str]) -> str:
|
||||
# We use -p 'mma_task' to ensure non-interactive (headless) mode and valid parsing.
|
||||
# Whitelist tools to ensure they are available to the model in headless mode.
|
||||
# Using 'discovered_tool_run_powershell' as it's the confirmed name for shell access.
|
||||
allowed_tools = "read_file,write_file,replace,list_directory,glob,grep_search,search_files,get_file_summary,discovered_tool_run_powershell,activate_skill,codebase_investigator,google_web_search,web_fetch"
|
||||
allowed_tools = "read_file,write_file,replace,list_directory,glob,grep_search,discovered_tool_search_files,discovered_tool_get_file_summary,discovered_tool_run_powershell,activate_skill,codebase_investigator,discovered_tool_web_search,discovered_tool_fetch_url"
|
||||
ps_command = (
|
||||
f"if (Test-Path 'C:\\projects\\misc\\setup_gemini.ps1') {{ . 'C:\\projects\\misc\\setup_gemini.ps1' }}; "
|
||||
f"gemini -p 'mma_task' --allowed-tools {allowed_tools} --output-format json --model {model}"
|
||||
|
||||
47
scripts/tool_call.py
Normal file
47
scripts/tool_call.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
|
||||
# Add project root to sys.path
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
try:
|
||||
import mcp_client
|
||||
except ImportError:
|
||||
print(json.dumps({"error": "Failed to import mcp_client"}))
|
||||
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:
|
||||
# Note: mcp_client.configure() is usually called by the GUI before each session,
|
||||
# but for direct CLI calls, we might need a basic configuration.
|
||||
# However, mcp_client tools generally resolve paths relative to CWD if not configured.
|
||||
result = mcp_client.dispatch(tool_name, tool_input)
|
||||
|
||||
# We wrap the result in a JSON object for consistency if needed,
|
||||
# but the CLI often expects just the string result from stdout.
|
||||
# Actually, let's just print the raw result string as that's what mcp_client returns.
|
||||
print(result)
|
||||
except Exception as e:
|
||||
print(f"ERROR executing tool {tool_name}: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user