载入中...
搜索中...
未找到
McpRuntimeTools.cpp
浏览该文件的文档.
40 static const std::vector<std::string> levels{"debug", "info", "warn", "error", "print", "cmd", "result", "engine"};
83 return errorPayload("unknown level '" + level + "'; expected one of " + joined(consoleLevels()));
88 const ConsoleSlice slice = ConsolePanel::instance().read(afterSeq, static_cast<std::size_t>(limit), level);
120 return errorPayload("unknown level '" + level + "'; expected one of " + joined(markerLevels()));
174bool contains(const std::string& haystack, const char* needle) { return haystack.find(needle) != std::string::npos; }
278 "no crash/error log yet; common/CrashLog.h opens it at process start (EVE_LOG_DIR overrides the "
288 std::clamp(getArgInt(args, "maxBytes", kDefaultScreenshotBytes), kMinScreenshotBytes, kMaxScreenshotBytes);
292 if (dataUrl.size() <= kDataUrlPrefix.size() || dataUrl.compare(0, kDataUrlPrefix.size(), kDataUrlPrefix) != 0) {
362 out->set("args", report.args ? Poco::Dynamic::Var(report.args) : Poco::Dynamic::Var(Poco::JSON::Object::Ptr(new Poco::JSON::Object())));
421 return R"json({"name":"eve_console_read","description":"Read retained runtime console lines: Squirrel print/error, engine stderr (level engine), eve.dev.console.* and agent markers. Lines carry a monotonic seq; pass the returned cursor back as sinceSeq for an incremental read (sinceSeq=0 reads the newest lines). truncated=true means lines were dropped before sinceSeq.","inputSchema":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":1000},"sinceSeq":{"type":"integer","minimum":0},"level":{"type":"string","enum":["debug","info","warn","error","print","cmd","result","engine"]}}}},{"name":"eve_console_write","description":"Append one agent marker line to the runtime console so it shares the game's ordered diagnosis stream.","inputSchema":{"type":"object","properties":{"text":{"type":"string"},"level":{"type":"string","enum":["debug","info","warn","error"]}},"required":["text"]}},{"name":"eve_console_clear","description":"Drop retained console lines. The sequence cursor keeps advancing, so an existing sinceSeq never re-reads or stalls.","inputSchema":{"type":"object","properties":{}}},{"name":"eve_screenshot_image","description":"Capture the presented frame and return it as an MCP image content item, so a client without filesystem access can look at the game. After readback is enabled the first call reports ok=false with retryable=true; wait one rendered frame and call again.","inputSchema":{"type":"object","properties":{"maxBytes":{"type":"integer","minimum":1024,"maximum":33554432,"description":"base64 payload budget (default 2097152)"}}}},{"name":"eve_crash_report","description":"Explain why a previous run ended: reads the persistent eve.log written by common/CrashLog.h and returns session/crash counts (window-scoped), the last crash timestamp, whether the session before the current one ended cleanly or crashed, and a bounded tail. Use it after reconnecting to a restarted game, since the MCP server dies with the process it served.","inputSchema":{"type":"object","properties":{"lines":{"type":"integer","minimum":1,"maximum":2000,"description":"tail lines to return (default 200)"}}}},{"name":"eve_restart","description":"Soft-restart the running game without unloading cached resources or killing the process (keeps Vulkan/MCP/ResourceManager). Optional args become eve.restartArgs for eve_init / eve_before_restart / eve_after_restart. Prefer this over relaunching eve when iterating on gameplay.","inputSchema":{"type":"object","properties":{"args":{"type":"object","description":"Game restart parameters (seed, scene, level, ...)"},"reloadScripts":{"type":"boolean","description":"Re-dofile tracked scripts and clear persist roots before eve_init (default true). When false, only reset native providers and call eve_restart(args) if present else eve_init()."}}}},{"name":"eve_game_world","description":"Discover what kind of game world is running at runtime: eve.dev.publishWorldContext, live gameplay domains, and dynamically configured / instantiated modules. Prefer this (or eve://game-world / eve_play op=status.gameWorld) over guessing from screenshots or eve_eval; do not treat on-disk prose as world authority.","inputSchema":{"type":"object","properties":{}}})json";
Persistent, thread-safe record of engine crash and problem events.
Runtime game-world Discover snapshot for MCP / Play Host.
#define EVE_MCP_TOOL_FAMILY(Id, Schemas, Handler, Payload)
Declare one family beside its implementation; CMake derives composition from compiled sources.
Definition McpToolFamilies.hpp:86
Soft-restart a live game without unloading the resource cache.
ConsoleSlice read(std::uint64_t afterSeq, size_t max=64, const std::string &level={}) const
Read retained lines relative to a sequence cursor.
Definition ConsolePanel.cpp:252
Definition DebugAdapter.hpp:16
Files scan(const std::filesystem::path &root, const Files &previous, Object::Ptr stats)
Bounded filesystem scan. Parses only changed files; symlinks are excluded.
Definition ActionGuideExport.cpp:13
bool getArgBool(Poco::JSON::Object::Ptr args, const char *key, bool def=false)
Boolean argument, or def when absent or not convertible.
Definition McpArgs.hpp:65
bool isMcpRuntimeTool(std::string_view name)
Whether name belongs to the MCP runtime console / frame-capture surface.
Definition McpRuntimeTools.cpp:383
@ ContentEnvelope
std::string mcpStringify(const Poco::Dynamic::Var &value)
Compact single-line JSON text for a newline-framed MCP payload.
Definition McpJson.hpp:24
std::string textContentResult(const std::string &text, bool isError=false)
MCP tools/call result object carrying one text content item.
Definition McpJson.hpp:84
std::string imageContentResult(const std::string &base64Png, const std::string &mimeType, const std::string &caption)
MCP tools/call result object carrying one image content item.
Definition McpJson.hpp:102
Result< Value > liveGameWorldSnapshot()
Build the Discover snapshot against the live engine.
Definition GameWorldContext.cpp:292
Result< SoftRestartReport > executeSoftRestart(HSQUIRRELVM vm, SoftRestartRequest request)
Soft-restart the game attached to vm.
Definition SoftRestart.cpp:147
Poco::JSON::Object::Ptr crashLogSummary()
Summary of the persistent crash/error log (eve.log).
Definition McpRuntimeTools.cpp:402
std::string callMcpRuntimeTool(std::string_view name, Poco::JSON::Object::Ptr args)
Execute one runtime tool.
Definition McpRuntimeTools.cpp:390
Poco::JSON::Object::Ptr mcpFailureObject(const std::string &error, const std::string &hint={}, bool retryable=false, const std::vector< std::string > &nextTools={})
Structured tool failure object for agent self-correction.
Definition McpJson.hpp:63
std::string callMcpFrameCaptureTool(std::string_view name, Object::Ptr args)
Definition McpFrameCapture.cpp:174
long long getArgInt64(Poco::JSON::Object::Ptr args, const char *key, long long def=0)
64-bit integer argument (sequence numbers, handles), or def.
Definition McpArgs.hpp:45
std::string_view mcpRuntimeToolSchemas()
Comma-separated MCP tool schema fragments without surrounding array brackets.
Definition McpRuntimeTools.cpp:420
int getArgInt(Poco::JSON::Object::Ptr args, const char *key, int def=0)
Integer argument, or def when absent or not convertible.
Definition McpArgs.hpp:35
bool isMcpFrameCaptureTool(std::string_view name)
True for the frame snapshot MCP family.
Definition McpFrameCapture.cpp:159
std::string getArgString(Poco::JSON::Object::Ptr args, const char *key, const std::string &def={})
String argument, or def when absent or not convertible.
Definition McpArgs.hpp:25
ForceVector add(ForceVector a, ForceVector b)
Definition ForceMath.h:13
WidgetDesc window(std::string title, std::vector< WidgetDesc > children, std::string id)
Top-level window widget with a title bar.
Definition Widget.cpp:326
constexpr const char * kSessionStartMarker
Marker text that opens a session block in eve.log.
Definition CrashLog.h:39
constexpr const char * kSessionEndMarker
Marker text that closes a session block (followed by the exit code). @ownership Borrowed pointer to a...
Definition CrashLog.h:46
constexpr std::string_view statusCodeName(StatusCode code) noexcept
Return the stable protocol spelling of a status code.
Definition Status.h:46
Definition Container.h:602
Render surface / frame state snapshot (value type).
Definition RenderCapture.h:16