feat(apifox): 为接口查询方法添加projectId参数支持

允许在查询接口详情时指定项目ID,提高多项目环境下的灵活性
This commit is contained in:
zhangguoyun committed 2025-12-02 16:53:17 +08:00
1 parent ae684d83b1
commit 4386beea66
2 files changed
+14 -6

No files matched your search

+6 -4
View File
@@ -32,13 +32,14 @@ server.registerTool(
description: "根据接口path获取Apifox接口定义数据",
inputSchema: z.object({
path: z.string().describe("接口路径"),
projectId: z.number().optional().describe("Apifox项目ID"),
}),
},
async ({ path }) => {
async ({ path, projectId }) => {
try {
const apiData = await apifoxService.getApiDetailByPath(path);
const apiData = await apifoxService.getApiDetailByPath(path, projectId);
return {
content: [
@@ -68,13 +69,14 @@ server.registerTool(
description: "根据接口目录获取Apifox目录下所有接口定义数据",
inputSchema: z.object({
folderName: z.string().describe("接口路径"),
projectId: z.number().optional().describe("Apifox项目ID"),
}),
},
async ({ folderName }) => {
async ({ folderName, projectId }) => {
try {
const apiData = await apifoxService.getApiListByFolderName(folderName);
const apiData = await apifoxService.getApiListByFolderName(folderName, projectId);
return {
content: [