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

Function find_tool_properties

server/src/server/tool_parser.cpp:55–68  ·  view source on GitHub ↗

Find parameter schema properties for a function.

Source from the content-addressed store, hash-verified

53// Check if a function name is in the allowed tools list.
54static bool tool_allowed(const json & tools, const std::string & name) {
55 if (tools.is_null() || !tools.is_array() || tools.empty()) return true;
56 for (const auto & t : tools) {
57 const auto & fn = t.contains("function") ? t["function"] : t;
58 if (fn.is_object() && fn.value("name", "") == name) return true;
59 }
60 return false;
61}
62
63// Find parameter schema properties for a function.
64static json find_tool_properties(const json & tools, const std::string & name) {
65 if (tools.is_null() || !tools.is_array()) return json::object();
66 for (const auto & t : tools) {
67 const auto & fn = t.contains("function") ? t["function"] : t;
68 if (!fn.is_object() || fn.value("name", "") != name) continue;
69 if (fn.contains("parameters") && fn["parameters"].is_object()) {
70 const auto & params = fn["parameters"];
71 if (params.contains("properties") && params["properties"].is_object()) {

Callers 1

parse_xml_paramsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected