Project-script → MCP export registry. 更多...
#include <Poco/JSON/Object.h>#include "common/Export.h"#include <squirrel.h>#include <string>#include <vector>命名空间 | |
| namespace | ssq |
| EVEngine ECS 集成层:底层实现使用 sunxfancy/ECS.hpp https://github.com/sunxfancy/ECS.hpp | |
| namespace | eve |
| Build metadata (engine git commit, build time, third-party version). | |
| namespace | eve::dev |
函数 | |
| bool | eve::dev::isScriptTool (const std::string &name) |
Whether name is exported by the project script registry. | |
| std::vector< std::string > | eve::dev::scriptToolNames () |
| Exported tool names in registration order. | |
| int | eve::dev::scriptToolCount () |
Number of exported tools (for eve_status). | |
| std::string | eve::dev::scriptToolSchemas () |
| Comma-free MCP tool schema fragments for every exported tool. | |
| std::string | eve::dev::callScriptTool (const std::string &name, Poco::JSON::Object::Ptr args) |
| Invoke one exported tool. | |
| void | eve::dev::clearScriptTools (HSQUIRRELVM owner) |
Drop registry entries owned by owner. | |
| void | eve::dev::exposeMcpScriptApi (ssq::VM &vm) |
Expose eve.mcp.tool/remove/tools/clear on a VM. | |
| bool | eve::dev::isValidScriptToolName (const std::string &name) |
| Validate an exported tool name. | |
详细描述
Project-script → MCP export registry.
Game developers describe their own domain models in Squirrel. Without an export path those models are only reachable through generic escape hatches (eve_run_script, eve_host_script), which an agent cannot discover from tools/list and cannot call by name. This registry lets a project publish a named, described, schema-carrying endpoint that the embedded server advertises exactly like a built-in tool.
@ownership Registered handlers and schemas are borrowed Squirrel objects owned by the host VM; the registry owns no closure and never frees one. @lifetime A registration stays valid until it is removed, replaced, shadowed by a built-in name, or the owning VM detaches. @thread Game-loop thread only, like the MCP server poll that dispatches them. Registration and dispatch are mutex-guarded so a handler may re-enter the registry (for example to register another tool) without deadlocking.
Boundary: this is for observing and actuating game-domain state. Mutating an editable document still belongs to the editor command protocol (editor.registerScriptCommand + eve_editor_execute), which owns transactions, validation and undo. Publishing a second write path for the same document would break that authority.
在文件 McpScriptTools.hpp 中定义.