ms-vite-plugin 1.4.47 → 1.4.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.js +1 -292
- package/dist/cli.js +6 -1234
- package/dist/mcp/device-config.d.ts +0 -47
- package/dist/mcp/device-config.js +1 -183
- package/dist/mcp/device-log.d.ts +0 -8
- package/dist/mcp/device-log.js +3 -27
- package/dist/mcp/doc-tools.d.ts +0 -7
- package/dist/mcp/doc-tools.js +2 -39
- package/dist/mcp/docs-service.d.ts +0 -13
- package/dist/mcp/docs-service.js +1 -63
- package/dist/mcp/httpapi-docs-service.d.ts +0 -31
- package/dist/mcp/httpapi-docs-service.js +1 -122
- package/dist/mcp/httpapi-tools.d.ts +0 -7
- package/dist/mcp/httpapi-tools.js +4 -222
- package/dist/mcp/image-tools.d.ts +0 -62
- package/dist/mcp/image-tools.js +8 -607
- package/dist/mcp/ocr-tools.d.ts +0 -25
- package/dist/mcp/ocr-tools.js +5 -413
- package/dist/mcp/project.d.ts +0 -14
- package/dist/mcp/project.js +1 -74
- package/dist/mcp/runtime-tools.d.ts +0 -7
- package/dist/mcp/runtime-tools.js +11 -308
- package/dist/mcp/tool-utils.d.ts +0 -40
- package/dist/mcp/tool-utils.js +1 -81
- package/dist/mcp/tools.d.ts +0 -12
- package/dist/mcp/tools.js +1 -31
- package/dist/mcp/types.d.ts +0 -12
- package/dist/mcp/types.js +1 -11
- package/dist/mcp-server.js +1 -85
- package/dist/packager.d.ts +0 -7
- package/dist/packager.js +1 -125
- package/dist/project.d.ts +0 -61
- package/dist/project.js +1 -619
- package/dist/stopGuardPlugin.d.ts +0 -6
- package/dist/stopGuardPlugin.js +1 -165
- package/dist/version.d.ts +0 -10
- package/dist/version.js +1 -63
- package/dist/ws-manager.d.ts +0 -95
- package/dist/ws-manager.js +1 -392
- package/docs/api/image.md +249 -25
- package/docs/apicn/image.md +245 -19
- package/docs/apipython/image.md +238 -18
- package/package.json +3 -2
|
@@ -1,222 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.registerHttpApiTools = registerHttpApiTools;
|
|
37
|
-
const z = __importStar(require("zod/v4"));
|
|
38
|
-
const httpapi_docs_service_1 = require("./httpapi-docs-service");
|
|
39
|
-
const tool_utils_1 = require("./tool-utils");
|
|
40
|
-
/**
|
|
41
|
-
* 标准化并校验 HTTP API 路径输入
|
|
42
|
-
* @param apiPath 用户传入路径
|
|
43
|
-
* @returns 返回标准化后的路径
|
|
44
|
-
* @example
|
|
45
|
-
* normalizeHttpApiPath("/api/status")
|
|
46
|
-
*/
|
|
47
|
-
function normalizeHttpApiPath(apiPath) {
|
|
48
|
-
const normalizedPath = apiPath.trim();
|
|
49
|
-
if (/^https?:\/\//i.test(normalizedPath)) {
|
|
50
|
-
throw new Error("path 只能传 HTTP API 相对路径,不能传完整 URL。");
|
|
51
|
-
}
|
|
52
|
-
if (!normalizedPath.startsWith("/")) {
|
|
53
|
-
throw new Error("path 必须以 / 开头,例如 /api/status。");
|
|
54
|
-
}
|
|
55
|
-
if (normalizedPath.includes("?")) {
|
|
56
|
-
throw new Error("path 不能包含 query string,请使用 query 参数传递查询参数。");
|
|
57
|
-
}
|
|
58
|
-
return normalizedPath;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* 将 query 参数追加到 URL
|
|
62
|
-
* @param url 目标 URL
|
|
63
|
-
* @param query 可选 query 参数
|
|
64
|
-
* @returns 无返回值
|
|
65
|
-
* @example
|
|
66
|
-
* appendQueryParams(url, { x: 1 })
|
|
67
|
-
*/
|
|
68
|
-
function appendQueryParams(url, query) {
|
|
69
|
-
if (!query) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
for (const [key, value] of Object.entries(query)) {
|
|
73
|
-
if (value === undefined || value === null) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
url.searchParams.set(key, String(value));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* 构建 JSON HTTP 请求体
|
|
81
|
-
* @param body 工具调用传入的 body
|
|
82
|
-
* @returns 返回可直接用于 fetch 的请求体和头
|
|
83
|
-
* @example
|
|
84
|
-
* createHttpRequestBody({ actions: [] })
|
|
85
|
-
*/
|
|
86
|
-
function createHttpRequestBody(body) {
|
|
87
|
-
if (body === undefined) {
|
|
88
|
-
return {};
|
|
89
|
-
}
|
|
90
|
-
const headers = {
|
|
91
|
-
"Content-Type": "application/json",
|
|
92
|
-
};
|
|
93
|
-
if (typeof body === "string") {
|
|
94
|
-
const trimmedBody = body.trim();
|
|
95
|
-
try {
|
|
96
|
-
JSON.parse(trimmedBody);
|
|
97
|
-
return {
|
|
98
|
-
headers,
|
|
99
|
-
requestBody: trimmedBody,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return {
|
|
104
|
-
headers,
|
|
105
|
-
requestBody: JSON.stringify(body),
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
headers,
|
|
111
|
-
requestBody: JSON.stringify(body),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* 读取响应体并按要求格式化
|
|
116
|
-
* @param response fetch 响应对象
|
|
117
|
-
* @param responseFormat 响应格式
|
|
118
|
-
* @returns 返回格式化文本
|
|
119
|
-
* @example
|
|
120
|
-
* const text = await readHttpApiResponseText(response, "json")
|
|
121
|
-
*/
|
|
122
|
-
async function readHttpApiResponseText(response, responseFormat) {
|
|
123
|
-
const responseText = await response.text();
|
|
124
|
-
if (responseFormat === "text") {
|
|
125
|
-
return responseText;
|
|
126
|
-
}
|
|
127
|
-
try {
|
|
128
|
-
return (0, tool_utils_1.formatRuntimeJsonText)(JSON.parse(responseText));
|
|
129
|
-
}
|
|
130
|
-
catch {
|
|
131
|
-
throw new Error("响应不是有效 JSON;如需读取文本响应,请设置 responseFormat=text。");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* 注册通用 HTTP API 调用工具
|
|
136
|
-
* @param server MCP 服务实例
|
|
137
|
-
* @returns 无返回值
|
|
138
|
-
* @example
|
|
139
|
-
* registerHttpApiTools(server)
|
|
140
|
-
*/
|
|
141
|
-
function registerHttpApiTools(server) {
|
|
142
|
-
server.registerTool("http_api_call", {
|
|
143
|
-
title: "HTTP API Call",
|
|
144
|
-
description: "调用 HTTP API 文档中已声明的接口。使用前应直接读取 get_docs_paths 返回的 HTTP API 文档,确认 method、path、query/body 参数;本工具会拒绝文档中未声明的 method/path。",
|
|
145
|
-
inputSchema: {
|
|
146
|
-
method: z
|
|
147
|
-
.enum(["GET", "POST"])
|
|
148
|
-
.describe("HTTP 方法,必须与 HTTP API 文档一致"),
|
|
149
|
-
path: z
|
|
150
|
-
.string()
|
|
151
|
-
.min(1)
|
|
152
|
-
.describe("HTTP API 相对路径,例如 /api/control/click;不能包含 query string"),
|
|
153
|
-
query: z
|
|
154
|
-
.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()]))
|
|
155
|
-
.optional()
|
|
156
|
-
.describe("query 参数;GET 接口通常使用 query 传参"),
|
|
157
|
-
body: z
|
|
158
|
-
.unknown()
|
|
159
|
-
.optional()
|
|
160
|
-
.describe("POST 请求体;始终按 JSON 提交。推荐传 JSON 对象;JSON 字符串会按原 JSON 提交,普通字符串会作为 JSON 字符串值提交。"),
|
|
161
|
-
responseFormat: z
|
|
162
|
-
.enum(["json", "text"])
|
|
163
|
-
.optional()
|
|
164
|
-
.default("json")
|
|
165
|
-
.describe("响应解析格式,默认 json"),
|
|
166
|
-
timeoutMs: z
|
|
167
|
-
.number()
|
|
168
|
-
.int()
|
|
169
|
-
.min(1000)
|
|
170
|
-
.max(600000)
|
|
171
|
-
.optional()
|
|
172
|
-
.default(30000)
|
|
173
|
-
.describe("请求超时时间,默认 30000 毫秒"),
|
|
174
|
-
},
|
|
175
|
-
}, async ({ method, path, query, body, responseFormat, timeoutMs, }) => {
|
|
176
|
-
const apiPath = normalizeHttpApiPath(path);
|
|
177
|
-
const entry = await (0, httpapi_docs_service_1.findHttpApiDocEntry)(apiPath, method);
|
|
178
|
-
if (!entry) {
|
|
179
|
-
return (0, tool_utils_1.createTextToolResult)([
|
|
180
|
-
`HTTP API 文档中不存在该接口: ${method} ${apiPath}`,
|
|
181
|
-
"请直接读取 get_docs_paths 返回的 HTTP API 文档路径,确认接口 method、path 和参数。",
|
|
182
|
-
].join("\n"), true);
|
|
183
|
-
}
|
|
184
|
-
if (method === "GET" && body !== undefined) {
|
|
185
|
-
return (0, tool_utils_1.createTextToolResult)("GET 接口不能传 body,请使用 query 参数。", true);
|
|
186
|
-
}
|
|
187
|
-
const target = await (0, tool_utils_1.resolveRuntimeHttpTarget)();
|
|
188
|
-
const url = new URL(`http://${target.ip}:${target.port}${apiPath}`);
|
|
189
|
-
appendQueryParams(url, query);
|
|
190
|
-
const controller = new AbortController();
|
|
191
|
-
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
192
|
-
try {
|
|
193
|
-
const { headers, requestBody } = createHttpRequestBody(body);
|
|
194
|
-
const response = await fetch(url.toString(), {
|
|
195
|
-
method,
|
|
196
|
-
signal: controller.signal,
|
|
197
|
-
headers,
|
|
198
|
-
body: requestBody,
|
|
199
|
-
});
|
|
200
|
-
const responseText = await readHttpApiResponseText(response, responseFormat);
|
|
201
|
-
return (0, tool_utils_1.createTextToolResult)([
|
|
202
|
-
`HTTP API 调用${response.ok ? "成功" : "失败"}: ${method} ${apiPath}`,
|
|
203
|
-
`设备: ${target.label}`,
|
|
204
|
-
`文档: ${entry.title} (lines ${entry.startLine}-${entry.endLine})`,
|
|
205
|
-
`状态码: ${response.status}`,
|
|
206
|
-
"",
|
|
207
|
-
responseText,
|
|
208
|
-
].join("\n"), !response.ok);
|
|
209
|
-
}
|
|
210
|
-
catch (error) {
|
|
211
|
-
const message = error instanceof Error && error.name === "AbortError"
|
|
212
|
-
? `请求超时: ${timeoutMs}ms`
|
|
213
|
-
: error instanceof Error
|
|
214
|
-
? error.message
|
|
215
|
-
: String(error);
|
|
216
|
-
return (0, tool_utils_1.createTextToolResult)(`HTTP API 调用失败: ${method} ${apiPath}\n${message}`, true);
|
|
217
|
-
}
|
|
218
|
-
finally {
|
|
219
|
-
clearTimeout(timeout);
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
1
|
+
"use strict";var _=exports&&exports.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),b=exports&&exports.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),m=exports&&exports.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[n.length]=i);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),i=0;i<n.length;i++)n[i]!=="default"&&_(r,t,n[i]);return b(r,t),r}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.registerHttpApiTools=$;const o=m(require("zod/v4")),O=require("./httpapi-docs-service"),a=require("./tool-utils");function w(e){const t=e.trim();if(/^https?:\/\//i.test(t))throw new Error("path \u53EA\u80FD\u4F20 HTTP API \u76F8\u5BF9\u8DEF\u5F84\uFF0C\u4E0D\u80FD\u4F20\u5B8C\u6574 URL\u3002");if(!t.startsWith("/"))throw new Error("path \u5FC5\u987B\u4EE5 / \u5F00\u5934\uFF0C\u4F8B\u5982 /api/status\u3002");if(t.includes("?"))throw new Error("path \u4E0D\u80FD\u5305\u542B query string\uFF0C\u8BF7\u4F7F\u7528 query \u53C2\u6570\u4F20\u9012\u67E5\u8BE2\u53C2\u6570\u3002");return t}function H(e,t){if(t)for(const[r,n]of Object.entries(t))n!=null&&e.searchParams.set(r,String(n))}function S(e){if(e===void 0)return{};const t={"Content-Type":"application/json"};if(typeof e=="string"){const r=e.trim();try{return JSON.parse(r),{headers:t,requestBody:r}}catch{return{headers:t,requestBody:JSON.stringify(e)}}}return{headers:t,requestBody:JSON.stringify(e)}}async function A(e,t){const r=await e.text();if(t==="text")return r;try{return(0,a.formatRuntimeJsonText)(JSON.parse(r))}catch{throw new Error("\u54CD\u5E94\u4E0D\u662F\u6709\u6548 JSON\uFF1B\u5982\u9700\u8BFB\u53D6\u6587\u672C\u54CD\u5E94\uFF0C\u8BF7\u8BBE\u7F6E responseFormat=text\u3002")}}function $(e){e.registerTool("http_api_call",{title:"HTTP API Call",description:"\u8C03\u7528 HTTP API \u6587\u6863\u4E2D\u5DF2\u58F0\u660E\u7684\u63A5\u53E3\u3002\u4F7F\u7528\u524D\u5E94\u76F4\u63A5\u8BFB\u53D6 get_docs_paths \u8FD4\u56DE\u7684 HTTP API \u6587\u6863\uFF0C\u786E\u8BA4 method\u3001path\u3001query/body \u53C2\u6570\uFF1B\u672C\u5DE5\u5177\u4F1A\u62D2\u7EDD\u6587\u6863\u4E2D\u672A\u58F0\u660E\u7684 method/path\u3002",inputSchema:{method:o.enum(["GET","POST"]).describe("HTTP \u65B9\u6CD5\uFF0C\u5FC5\u987B\u4E0E HTTP API \u6587\u6863\u4E00\u81F4"),path:o.string().min(1).describe("HTTP API \u76F8\u5BF9\u8DEF\u5F84\uFF0C\u4F8B\u5982 /api/control/click\uFF1B\u4E0D\u80FD\u5305\u542B query string"),query:o.record(o.string(),o.union([o.string(),o.number(),o.boolean(),o.null()])).optional().describe("query \u53C2\u6570\uFF1BGET \u63A5\u53E3\u901A\u5E38\u4F7F\u7528 query \u4F20\u53C2"),body:o.unknown().optional().describe("POST \u8BF7\u6C42\u4F53\uFF1B\u59CB\u7EC8\u6309 JSON \u63D0\u4EA4\u3002\u63A8\u8350\u4F20 JSON \u5BF9\u8C61\uFF1BJSON \u5B57\u7B26\u4E32\u4F1A\u6309\u539F JSON \u63D0\u4EA4\uFF0C\u666E\u901A\u5B57\u7B26\u4E32\u4F1A\u4F5C\u4E3A JSON \u5B57\u7B26\u4E32\u503C\u63D0\u4EA4\u3002"),responseFormat:o.enum(["json","text"]).optional().default("json").describe("\u54CD\u5E94\u89E3\u6790\u683C\u5F0F\uFF0C\u9ED8\u8BA4 json"),timeoutMs:o.number().int().min(1e3).max(6e5).optional().default(3e4).describe("\u8BF7\u6C42\u8D85\u65F6\u65F6\u95F4\uFF0C\u9ED8\u8BA4 30000 \u6BEB\u79D2")}},async({method:t,path:r,query:n,body:i,responseFormat:y,timeoutMs:T})=>{const u=w(r),c=await(0,O.findHttpApiDocEntry)(u,t);if(!c)return(0,a.createTextToolResult)([`HTTP API \u6587\u6863\u4E2D\u4E0D\u5B58\u5728\u8BE5\u63A5\u53E3: ${t} ${u}`,"\u8BF7\u76F4\u63A5\u8BFB\u53D6 get_docs_paths \u8FD4\u56DE\u7684 HTTP API \u6587\u6863\u8DEF\u5F84\uFF0C\u786E\u8BA4\u63A5\u53E3 method\u3001path \u548C\u53C2\u6570\u3002"].join(`
|
|
2
|
+
`),!0);if(t==="GET"&&i!==void 0)return(0,a.createTextToolResult)("GET \u63A5\u53E3\u4E0D\u80FD\u4F20 body\uFF0C\u8BF7\u4F7F\u7528 query \u53C2\u6570\u3002",!0);const f=await(0,a.resolveRuntimeHttpTarget)(),d=new URL(`http://${f.ip}:${f.port}${u}`);H(d,n);const h=new AbortController,P=setTimeout(()=>h.abort(),T);try{const{headers:s,requestBody:p}=S(i),l=await fetch(d.toString(),{method:t,signal:h.signal,headers:s,body:p}),g=await A(l,y);return(0,a.createTextToolResult)([`HTTP API \u8C03\u7528${l.ok?"\u6210\u529F":"\u5931\u8D25"}: ${t} ${u}`,`\u8BBE\u5907: ${f.label}`,`\u6587\u6863: ${c.title} (lines ${c.startLine}-${c.endLine})`,`\u72B6\u6001\u7801: ${l.status}`,"",g].join(`
|
|
3
|
+
`),!l.ok)}catch(s){const p=s instanceof Error&&s.name==="AbortError"?`\u8BF7\u6C42\u8D85\u65F6: ${T}ms`:s instanceof Error?s.message:String(s);return(0,a.createTextToolResult)(`HTTP API \u8C03\u7528\u5931\u8D25: ${t} ${u}
|
|
4
|
+
${p}`,!0)}finally{clearTimeout(P)}})}
|
|
@@ -1,78 +1,16 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
export type ImageSampleCorner = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
3
|
-
/**
|
|
4
|
-
* 裁切本地图片
|
|
5
|
-
* @param imagePath 输入图片路径
|
|
6
|
-
* @param x 裁切起点 x
|
|
7
|
-
* @param y 裁切起点 y
|
|
8
|
-
* @param width 裁切宽度
|
|
9
|
-
* @param height 裁切高度
|
|
10
|
-
* @param outputPath 可选输出路径
|
|
11
|
-
* @returns 返回操作结果文本
|
|
12
|
-
* @example
|
|
13
|
-
* await cropLocalImage("./screen.jpg", 0, 0, 100, 100)
|
|
14
|
-
*/
|
|
15
3
|
export declare function cropLocalImage(imagePath: string, x: number, y: number, width: number, height: number, outputPath?: string): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* 裁切设备截图
|
|
18
|
-
* @param target 设备 HTTP 地址
|
|
19
|
-
* @param x 裁切起点 x
|
|
20
|
-
* @param y 裁切起点 y
|
|
21
|
-
* @param width 裁切宽度
|
|
22
|
-
* @param height 裁切高度
|
|
23
|
-
* @param outputPath 可选输出路径
|
|
24
|
-
* @returns 返回操作结果文本
|
|
25
|
-
* @example
|
|
26
|
-
* await cropDeviceScreen({ ip: "192.168.1.10", port: "9800", label: "192.168.1.10:9800" }, 0, 0, 100, 100)
|
|
27
|
-
*/
|
|
28
4
|
export declare function cropDeviceScreen(target: {
|
|
29
5
|
ip: string;
|
|
30
6
|
port: string;
|
|
31
7
|
label: string;
|
|
32
8
|
}, x: number, y: number, width: number, height: number, outputPath?: string): Promise<string>;
|
|
33
|
-
/**
|
|
34
|
-
* 读取本地图片颜色
|
|
35
|
-
* @param imagePath 输入图片路径
|
|
36
|
-
* @param x 目标坐标 x
|
|
37
|
-
* @param y 目标坐标 y
|
|
38
|
-
* @param radius 采样半径
|
|
39
|
-
* @returns 返回取色结果文本
|
|
40
|
-
* @example
|
|
41
|
-
* await pickLocalImageColor("./screen.jpg", 10, 10, 0)
|
|
42
|
-
*/
|
|
43
9
|
export declare function pickLocalImageColor(imagePath: string, x: number, y: number, radius: number): Promise<string>;
|
|
44
|
-
/**
|
|
45
|
-
* 读取设备截图颜色
|
|
46
|
-
* @param target 设备 HTTP 地址
|
|
47
|
-
* @param x 目标坐标 x
|
|
48
|
-
* @param y 目标坐标 y
|
|
49
|
-
* @param radius 采样半径
|
|
50
|
-
* @returns 返回取色结果文本
|
|
51
|
-
* @example
|
|
52
|
-
* await pickDeviceScreenColor({ ip: "192.168.1.10", port: "9800", label: "192.168.1.10:9800" }, 10, 10, 0)
|
|
53
|
-
*/
|
|
54
10
|
export declare function pickDeviceScreenColor(target: {
|
|
55
11
|
ip: string;
|
|
56
12
|
port: string;
|
|
57
13
|
label: string;
|
|
58
14
|
}, x: number, y: number, radius: number): Promise<string>;
|
|
59
|
-
/**
|
|
60
|
-
* 制作本地图片透明图
|
|
61
|
-
* @param imagePath 输入图片路径
|
|
62
|
-
* @param outputPath 可选输出路径
|
|
63
|
-
* @param transparentColor 可选透明色
|
|
64
|
-
* @param sampleCorner 未传透明色时采样的角落
|
|
65
|
-
* @param tolerance 颜色容差
|
|
66
|
-
* @returns 返回操作结果文本
|
|
67
|
-
* @example
|
|
68
|
-
* await makeLocalImageTransparent("./button.png", undefined, "#ffffff", "topLeft", 24)
|
|
69
|
-
*/
|
|
70
15
|
export declare function makeLocalImageTransparent(imagePath: string, outputPath: string | undefined, transparentColor: string | undefined, sampleCorner: ImageSampleCorner, tolerance: number): Promise<string>;
|
|
71
|
-
/**
|
|
72
|
-
* 注册图片处理 MCP 工具
|
|
73
|
-
* @param server MCP 服务实例
|
|
74
|
-
* @returns 无返回值
|
|
75
|
-
* @example
|
|
76
|
-
* registerImageTools(server)
|
|
77
|
-
*/
|
|
78
16
|
export declare function registerImageTools(server: McpServer): void;
|