feat: tui_command tool i opax-mcp — toveis shell via /tui-command
This commit is contained in:
parent
434f591f9c
commit
56e1f61753
|
|
@ -271,6 +271,14 @@ async def get_telemetry(p): return await _opax_get("/telemetry/history")
|
|||
async def run_terminal(p):
|
||||
return await _opax_post("/terminal/exec", {"cmd": p.get("command", p.get("cmd", "help"))})
|
||||
|
||||
|
||||
|
||||
async def tui_command(p):
|
||||
"""Kjør én sekvensiert shell-kommando via TUI-broen og returner stdout/stderr/exit_code."""
|
||||
return await _opax_post("/tui-command", {
|
||||
"command": p.get("command", ""),
|
||||
"timeout": p.get("timeout", 30),
|
||||
})
|
||||
async def list_commits(p):
|
||||
return await _gitea_get(f"/repos/{p.get('repo', GITEA_REPO)}/commits?limit={p.get('limit', 10)}")
|
||||
|
||||
|
|
@ -284,6 +292,10 @@ async def create_issue(p):
|
|||
return await _gitea_post(f"/repos/{p.get('repo', GITEA_REPO)}/issues", {"title": p.get("title"), "body": p.get("body", "")})
|
||||
|
||||
async def push_file(p):
|
||||
|
||||
async def tui_command(p):
|
||||
"""Kjør én shell-kommando via /tui-command og returner stdout/stderr/exit_code."""
|
||||
return await _opax_post("/tui-command", p)
|
||||
repo = p.get("repo", GITEA_REPO)
|
||||
path = p.get("path")
|
||||
content = base64.b64encode(p.get("content", "").encode()).decode()
|
||||
|
|
@ -336,6 +348,7 @@ TOOLS = {
|
|||
"get_build_status": (get_build_status, "Hent siste build-status", {}),
|
||||
"get_state": (get_state, "Hent platform-tilstand", {}),
|
||||
"get_telemetry": (get_telemetry, "Hent telemetri-historikk", {}),
|
||||
"tui_command": (tui_command, "Kjør shell-kommando via TUI-bro og få stdout/stderr/exit_code tilbake", {"type":"object","properties":{"command":{"type":"string","description":"Shell-kommando å kjøre"},"timeout":{"type":"integer","description":"Timeout i sekunder, default 30"}},"required":["command"]}),
|
||||
"run_terminal": (run_terminal, "Kjør terminalkommando på VM", {"type":"object","properties":{"command":{"type":"string"}},"required":["command"]}),
|
||||
"list_commits": (list_commits, "List siste commits i Gitea-repo", {}),
|
||||
"get_file": (get_file, "Hent fil fra Gitea-repo", {"type":"object","properties":{"path":{"type":"string"}},"required":["path"]}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user