feat(tools): add search and map tools
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { tool } from "@opencode-ai/plugin";
|
||||
|
||||
export default tool({
|
||||
description:
|
||||
"在前端地图上缩放定位到坐标。默认坐标为 EPSG:3857;如果来自天地图 geocode 的 lon/lat,传 source_crs='EPSG:4326',前端会转换为 EPSG:3857 后缩放。",
|
||||
args: {
|
||||
reason: tool.schema
|
||||
.string()
|
||||
.describe("Why this map zoom action is needed for the current request."),
|
||||
x: tool.schema
|
||||
.number()
|
||||
.describe("X coordinate. For EPSG:4326 this is longitude; for EPSG:3857 this is meters."),
|
||||
y: tool.schema
|
||||
.number()
|
||||
.describe("Y coordinate. For EPSG:4326 this is latitude; for EPSG:3857 this is meters."),
|
||||
source_crs: tool.schema
|
||||
.enum(["EPSG:3857", "EPSG:4326"])
|
||||
.optional()
|
||||
.describe("Input coordinate CRS. Defaults to EPSG:3857."),
|
||||
zoom: tool.schema
|
||||
.number()
|
||||
.optional()
|
||||
.describe("Optional OpenLayers zoom level. Defaults to 18."),
|
||||
duration_ms: tool.schema
|
||||
.number()
|
||||
.optional()
|
||||
.describe("Optional animation duration in milliseconds. Defaults to 1000."),
|
||||
},
|
||||
async execute() {
|
||||
return "已缩放到指定地图坐标。";
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user