45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import type { ModelTool } from "../ports/model-port";
|
|
|
|
export const workspaceTools: readonly ModelTool[] = [
|
|
{
|
|
name: "list_directory",
|
|
description:
|
|
"列出当前会话工作区内某个目录的直接子项。路径必须是工作区相对路径。",
|
|
parameters: {
|
|
type: "object",
|
|
properties: {
|
|
path: {
|
|
type: "string",
|
|
description: "目录相对路径,根目录使用空字符串",
|
|
},
|
|
},
|
|
required: ["path"],
|
|
additionalProperties: false,
|
|
},
|
|
},
|
|
{
|
|
name: "search_files",
|
|
description: "按文件名和 UTF-8 文本内容搜索当前会话工作区。",
|
|
parameters: {
|
|
type: "object",
|
|
properties: { query: { type: "string" } },
|
|
required: ["query"],
|
|
additionalProperties: false,
|
|
},
|
|
},
|
|
{
|
|
name: "read_text_file",
|
|
description: "读取当前会话工作区内不超过 2 MiB 的 UTF-8 文本文件。",
|
|
parameters: {
|
|
type: "object",
|
|
properties: { path: { type: "string" } },
|
|
required: ["path"],
|
|
additionalProperties: false,
|
|
},
|
|
},
|
|
];
|
|
|
|
export function isWorkspaceTool(name: string): boolean {
|
|
return workspaceTools.some((tool) => tool.name === name);
|
|
}
|