MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / handle_context_get_anchor

Method handle_context_get_anchor

source/MaaAgentClient/Client/AgentClient.cpp:844–867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

842}
843
844bool AgentClient::handle_context_get_anchor(const json::value& j)
845{
846 if (!j.is<ContextGetAnchorReverseRequest>()) {
847 return false;
848 }
849
850 const ContextGetAnchorReverseRequest& req = j.as<ContextGetAnchorReverseRequest>();
851 LogFunc << VAR(req) << VAR(ipc_addr_);
852
853 MaaContext* context = query_context(req.context_id);
854 if (!context) {
855 LogError << "context not found" << VAR(req.context_id);
856 return false;
857 }
858
859 auto opt = context->get_anchor(req.anchor_name);
860
861 ContextGetAnchorReverseResponse resp {
862 .has_value = opt.has_value(),
863 .node_name = opt.value_or(""),
864 };
865 send(resp);
866 return true;
867}
868
869bool AgentClient::handle_context_get_hit_count(const json::value& j)
870{

Callers

nothing calls this directly

Calls 1

get_anchorMethod · 0.45

Tested by

no test coverage detected