载入中...
搜索中...
未找到
McpProjectIndexTools.cpp
浏览该文件的文档.
34 const auto oldest = std::min_element(states.begin(), states.end(), [](const auto& left, const auto& right) {
59 const int limit = args->optValue<int>("maxNodes", 64), depth = args->optValue<int>("maxDepth", 8);
62 return mcpFailureObject("invalid_query", "maxNodes 1..256, maxDepth 0..8, maxBytes 1024..65536");
65 auto failure = mcpFailureObject("stale_project_revision", "Refresh project evidence and use the new revision");
76 if (snapshot.automatic) out->set("analyzerHash", std::string(eve::script::scriptStructureProviderHash()));
80 snapshot.automatic ? "compiler-structure+engine-contracts" : "source-metadata+checked-declarations");
84 "Source evidence, not live state or runtime causality; symbol extraction is not compilation. Structural "
90 Array::Ptr nodes = new Array(), edges = new Array(), contracts = new Array(), tests = new Array();
105 if (mode == "eve_task_context" && (seed.empty() || args->optValue<std::string>("task", "").empty()))
145 const auto kind = args->optValue<std::string>("kind", ""), text = args->optValue<std::string>("query", "");
163 for (const auto* field : {"id", "kind", "label", "status", "source", "evidence", "schemaContract"})
183 (!args->optValue<bool>("includeCalls", false) && edge->getValue<std::string>("relation") == "calls"))) &&
209 if (!std::filesystem::is_directory(root) || std::filesystem::is_symlink(root / "game.semantic.json") ||
224 return R"JSON({"name":"eve_project_index_refresh","description":"Index current project source and checked semantic declarations without executing code. Reports revision, incremental parse stats and diagnostics.","inputSchema":{"type":"object","required":["projectDir"],"properties":{"projectDir":{"type":"string"},"maxNodes":{"type":"integer","minimum":1,"maximum":256},"maxBytes":{"type":"integer","minimum":1024,"maximum":65536}}}},
225{"name":"eve_project_index_query","description":"Query compiler-derived project semantics by seed, kind or text. includeCalls expands the full static call neighbourhood. Rejects stale expectedRevision; does not execute project code.","inputSchema":{"type":"object","required":["projectDir"],"properties":{"projectDir":{"type":"string"},"seed":{"type":"string"},"kind":{"type":"string"},"query":{"type":"string"},"includeCalls":{"type":"boolean"},"expectedRevision":{"type":"string"},"maxNodes":{"type":"integer","minimum":1,"maximum":256},"maxDepth":{"type":"integer","minimum":0,"maximum":8},"maxBytes":{"type":"integer","minimum":1024,"maximum":65536}}}})JSON";
230EVE_MCP_TOOL_FAMILY(ProjectIndex, mcpProjectIndexToolSchemas, callMcpProjectIndexTool, ContentEnvelope)
std::map< std::string, std::vector< size_t > > adjacency
Definition McpArchitectureTools.cpp:26
#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
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
Definition BuildingSnapshot.cpp:96
std::string pathText(const std::filesystem::path &path)
UTF-8 source path, including Windows project names.
std::map< std::string, std::shared_ptr< const File > > Files
Definition ProjectIndexInternal.hpp:25
Snapshot project(Files files, Object::Ptr stats, std::string defaultProjectId, std::string projectDir)
Build a candidate evidence graph without touching the published snapshot.
Definition ProjectIndexGraph.cpp:144
Files scan(const std::filesystem::path &root, const Files &previous, Object::Ptr stats)
Bounded filesystem scan. Parses only changed files; symlinks are excluded.
std::string requiredString(Object::Ptr object, const std::string &field)
Strict source string fields; invalid manifest shapes throw a diagnostic exception.
Definition ActionGuideExport.cpp:13
std::string callMcpProjectIndexTool(std::string_view name, Object::Ptr args)
Definition McpProjectIndexTools.cpp:202
@ ContentEnvelope
bool isMcpProjectIndexTool(std::string_view name)
Recognizes project-index discovery/refresh tools; no project code is executed.
Definition McpProjectIndexTools.cpp:199
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_view mcpProjectIndexToolSchemas()
Comma-separated tool schemas without an enclosing array. @ownership Borrowed process-owned immutable ...
Definition McpProjectIndexTools.cpp:223
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
constexpr HexDirection next(HexDirection d) noexcept
The next direction clockwise (NW wraps to NE).
Definition HexMetrics.h:76
bool has(const std::vector< std::reference_wrapper< const HouseComponent > > &values)
Definition HouseGenerationAlgorithms.cpp:18
ForceVector add(ForceVector a, ForceVector b)
Definition ForceMath.h:13
EVENGINE_API_FOUNDATION std::string_view scriptStructureProviderHash()
Build-generated source fingerprint of the structural analyzer and project projection.
enum EVENGINE_API_FOUNDATION Array
OT_ARRAY (editable via Runtime array APIs / ReflectedPropertyModel).
Definition Runtime.h:120
Definition Container.h:602
std::string revision
Definition ProjectIndexInternal.hpp:29
std::string projectId
Definition ProjectIndexInternal.hpp:29
std::map< std::string, Object::Ptr > nodes
Definition ProjectIndexInternal.hpp:30
std::vector< Object::Ptr > diagnostics
Definition ProjectIndexInternal.hpp:31
std::vector< Object::Ptr > edges
Definition ProjectIndexInternal.hpp:31
std::string projectDir
Definition ProjectIndexInternal.hpp:29