MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / appendCommandMetaTools

Function appendCommandMetaTools

app/src/AI/Conversation.cpp:2139–2202  ·  view source on GitHub ↗

* @brief Appends meta.describeCommand, meta.executeCommand, meta.fetchHelp tools. */

Source from the content-addressed store, hash-verified

2137 * @brief Appends meta.describeCommand, meta.executeCommand, meta.fetchHelp tools.
2138 */
2139static void appendCommandMetaTools(QJsonArray& out)
2140{
2141 {
2142 auto schema = objectSchemaWithProperty(
2143 QStringLiteral("name"),
2144 stringProp(QStringLiteral("Exact command name as returned by meta.listCommands.")),
2145 true);
2146 out.append(makeMetaTool(
2147 QStringLiteral("meta.describeCommand"),
2148 QStringLiteral("Fetch the full input schema and description for one command. "
2149 "Call this before meta.executeCommand on any unfamiliar command."),
2150 schema));
2151 }
2152
2153 {
2154 QJsonObject schema;
2155 schema[QStringLiteral("type")] = QStringLiteral("object");
2156 QJsonObject props;
2157 props[QStringLiteral("name")] = stringProp(QStringLiteral("Command name to invoke."));
2158 QJsonObject argsProp;
2159 argsProp[QStringLiteral("type")] = QStringLiteral("object");
2160 argsProp[QStringLiteral("description")] =
2161 QStringLiteral("Arguments object matching the command's input schema.");
2162 props[QStringLiteral("arguments")] = argsProp;
2163 schema[QStringLiteral("properties")] = props;
2164 schema[QStringLiteral("required")] = QJsonArray{QStringLiteral("name")};
2165 out.append(makeMetaTool(QStringLiteral("meta.executeCommand"),
2166 QStringLiteral("Execute any command by name with an arguments object. "
2167 "Use this for commands that aren't directly in your "
2168 "tool list."),
2169 schema));
2170 }
2171
2172 {
2173 auto schema = objectSchemaWithProperty(
2174 QStringLiteral("path"),
2175 stringProp(QStringLiteral("A bare page name without the .md extension (e.g. "
2176 "\"About\", \"FAQ\", \"Getting-Started\", "
2177 "\"API-Reference\", \"Painter-Widget\", "
2178 "\"Drivers-UART\"), or \"help.json\" to fetch the "
2179 "index (a JSON array of {id, title, section, file}). "
2180 "Multi-word names use hyphens. Full URLs on "
2181 "github.com / raw.githubusercontent.com / "
2182 "serial-studio.com are also accepted. **A 404 "
2183 "auto-redirects to help.json**, so if you can name "
2184 "the page in plain English with high confidence "
2185 "(About, FAQ, Troubleshooting, Pro-vs-Free, etc.) "
2186 "just try it directly -- the index fallback catches "
2187 "you for free. Fetch help.json first only when the "
2188 "page name isn't obvious from the user's question.")),
2189 true);
2190 out.append(makeMetaTool(QStringLiteral("meta.fetchHelp"),
2191 QStringLiteral("Fetch a Serial Studio documentation page from "
2192 "the canonical doc/help markdown source. Use "
2193 "whenever the user asks about features, "
2194 "concepts, or workflows -- always cite from the "
2195 "fetched page, never synthesize content from "
2196 "training data. If the response indicates a 404 "

Callers 1

appendCoreMetaToolsFunction · 0.85

Calls 4

objectSchemaWithPropertyFunction · 0.85
makeMetaToolFunction · 0.85
stringPropFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected