MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / parse_xml_params

Function parse_xml_params

server/src/server/tool_parser.cpp:315–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313 // right after a JSON string boundary and the "identifier" is
314 // probably part of a value continuation (e.g. `"k": foo: 1` would
315 // be malformed JSON anyway, but better to leave it untouched).
316 std::smatch m;
317 std::string tail = payload.substr(i);
318 if (std::regex_search(tail, m, re_bare_key,
319 std::regex_constants::match_continuous) &&
320 (rewritten.empty() || rewritten.back() != '"')) {
321 rewritten += '"';
322 rewritten += m[1].str();
323 rewritten += '"';
324 rewritten += m[2].str();
325 i += m.length();
326 continue;
327 }
328 rewritten += c;
329 i++;
330 }
331
332 json parsed = json::parse(rewritten, nullptr, false);
333 if (parsed.is_discarded()) return false;
334 out = std::move(parsed);
335 return true;
336}
337
338
339// ─── XML parameter parser ───────────────────────────────────────────────
340
341static json parse_xml_params(const std::string & region, const std::string & fn_name,

Callers 1

parse_tool_callsFunction · 0.85

Calls 3

find_tool_propertiesFunction · 0.85
convert_param_valueFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected