mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-09-19 09:40:12 +00:00
docs(mcp): note server.exec reaps the whole process tree
Document in the tool description and protocol comment that the agent kills the entire process group/JobObject on return or timeout, so background jobs must fully detach (setsid/screen/tmux/systemd-run).
This commit is contained in:
@@ -17,6 +17,9 @@ import (
|
|||||||
// - 默认 30s 超时,硬上限 300s
|
// - 默认 30s 超时,硬上限 300s
|
||||||
// - stdout/stderr 各自最多 64KB(默认),硬上限 1MB
|
// - stdout/stderr 各自最多 64KB(默认),硬上限 1MB
|
||||||
// - 受 agent 配置 DisableCommandExecute 影响
|
// - 受 agent 配置 DisableCommandExecute 影响
|
||||||
|
// - 命令返回或超时时,agent 会回收整个进程组/JobObject:'cmd &'、nohup、
|
||||||
|
// disown 这类普通后台进程都会被一并杀掉。要留长驻进程必须脱离会话
|
||||||
|
// (setsid / screen -dmS / tmux new -d / systemd-run;Windows 需 breakaway)。
|
||||||
//
|
//
|
||||||
// LLM 要用 shell 特性(管道、重定向)必须显式传 cmd="sh" args=["-c","..."],
|
// LLM 要用 shell 特性(管道、重定向)必须显式传 cmd="sh" args=["-c","..."],
|
||||||
// 这样审计日志能完整记录被执行的指令。
|
// 这样审计日志能完整记录被执行的指令。
|
||||||
@@ -36,7 +39,7 @@ type execArgs struct {
|
|||||||
func init() {
|
func init() {
|
||||||
registerMCPTool(&mcpTool{
|
registerMCPTool(&mcpTool{
|
||||||
Name: "server.exec",
|
Name: "server.exec",
|
||||||
Description: "Run a non-interactive command on the target server and return stdout/stderr/exit_code. No pty. Use cmd='sh' args=['-c', '...'] for shell features.",
|
Description: "Run a non-interactive command on the target server and return stdout/stderr/exit_code. No pty. Use cmd='sh' args=['-c', '...'] for shell features. The entire process tree is killed when the command returns or times out, so plain background jobs ('cmd &', nohup, disown) do NOT survive; to leave a process running after the call, fully detach it from the session (e.g. setsid, 'screen -dmS', 'tmux new -d', systemd-run; on Windows it must break away from the job object).",
|
||||||
InputSchema: map[string]any{
|
InputSchema: map[string]any{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": map[string]any{
|
"properties": map[string]any{
|
||||||
|
|||||||
Reference in New Issue
Block a user