Fix(mcp): declare conditional tool arguments and surface probe headers
Several tools enforced argument requirements that existed only in prose, so a model had to send a bad call to learn them. A new AppendConditionalRequired helper emits allOf/if/then entries, and the schemas now say: - get_screenshot: mode=region needs width and height; mode=window needs hwnd. monitor keeps its default of 0. - remote_keyboard: action=type needs text; key_down/key_up/key_press need key. - remote_mouse: action=drag needs x2 and y2. - terminal_exec: command or session_id, at least one (anyOf), matching the handler's -32602 when both are missing. http_probe put the response headers only in structuredContent, which a client that reads the text block never sees; Location, Set-Cookie and Content-Type are exactly what a redirect or auth decision needs. The text block now starts with a headers section, bounded to 4096 bytes and 1200 bytes per line, backing off to a UTF-8 boundary when a line has to be cut. The full set stays in structuredContent.headers. mcp/tools.json mirrors the schemas and tools_minimal.json is regenerated. Verified against a fresh Debug build: verify_tools --live reports 49 tools identical. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
31883edc09
commit
a818ace83c
5 files changed
+257
-1
No files matched your search
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <initializer_list>
|
||||
#include <vector>
|
||||
|
||||
class CMy2015RemoteDlg;
|
||||
@@ -178,6 +179,14 @@ void AppendBatchIdsProp(Json::Value& props);
|
||||
// 把 inputSchema 的必填约束改成「id 或 ids 二选一」。
|
||||
void MakeIdOrIdsRequired(Json::Value& schema);
|
||||
|
||||
// 往 inputSchema 追加一条条件必填:当 prop 出现且取值在 values 里(values 为空表示
|
||||
// 只要出现就生效)时,fields 里的字段也必须提供。实现形态是 allOf 里的一条
|
||||
// {"if":{"properties":{prop:{"enum":[...]}},"required":[prop]},"then":{"required":fields}},
|
||||
// 从 schema 层面表达只写在描述里的条件约束,模型发参数前就能看到。
|
||||
void AppendConditionalRequired(Json::Value& schema, const char* prop,
|
||||
std::initializer_list<const char*> values,
|
||||
std::initializer_list<const char*> fields);
|
||||
|
||||
// 统一的提示文字,例如「共 283 个进程,本次返回第 1-100 条(还有更多,可用 offset 继续取)。」
|
||||
std::string PageSummary(const PageWindow& w, const char* unit);
|
||||
|
||||
|
||||
Reference in new issue
Block a user