{
  "schemaVersion": "1.0",
  "item": {
    "slug": "swagger-skill",
    "name": "swagger-skill",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/MinusGod/swagger-skill",
    "canonicalUrl": "https://clawhub.ai/MinusGod/swagger-skill",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/swagger-skill",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=swagger-skill",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "index.js",
      "SKILL.md",
      "cli.js"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T17:22:31.273Z",
      "expiresAt": "2026-05-14T17:22:31.273Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=afrexai-annual-report",
        "contentDisposition": "attachment; filename=\"afrexai-annual-report-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/swagger-skill"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/swagger-skill",
    "agentPageUrl": "https://openagent3.xyz/skills/swagger-skill/agent",
    "manifestUrl": "https://openagent3.xyz/skills/swagger-skill/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/swagger-skill/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "功能特性",
        "body": "一键查询: 直接查询接口详情，自动解析参数、请求体、响应模式\n自然语言搜索: 根据自然语言描述找到匹配的接口（如\"保存用户\"、\"获取数据集列表\"），支持 tags 匹配\n智能接口调用: 根据自然语言指令自动匹配并调用相应的 API\n完整信息展示: 自动获取并展示接口的完整信息（参数、请求体、响应、数据模式定义）\n文件上传支持: 支持 multipart/form-data 文件上传\n分层缓存: 轻量索引用于列表/搜索，Map 结构 O(1) 详情查找\nSwagger 2.0 兼容: 同时支持 OpenAPI 3.0 和 Swagger 2.0 规范\n灵活认证: 支持 Token、Cookie 或无需验证的多种认证方式"
      },
      {
        "title": "安装",
        "body": "无需手动安装依赖。首次使用时会自动检测并安装所需依赖（axios、form-data），同时自动初始化 package.json（含 \"type\": \"module\" 配置）。\n\n如需手动安装，可在 skill 目录下执行：\n\nnpm install"
      },
      {
        "title": "基础使用",
        "body": "import SwaggerAPISkill from './index.js';\n\nconst skill = new SwaggerAPISkill();\n\n// 1. 加载 Swagger 规范\nawait skill.fetchSwaggerSpec('https://api.example.com/swagger.json');\n\n// 2. 获取所有接口\nconst allAPIs = skill.getAllAPIs();\n\n// 3. 搜索接口\nconst results = skill.searchAPI('获取用户信息');\n\n// 4. 获取接口详情\nconst detail = skill.getAPIDetail('/users/{id}', 'GET');\n\n// 5. 调用接口\nconst response = await skill.callAPI('/users', 'GET', {\n  query: { page: 1, limit: 10 }\n});\n\n// 6. 通过自然语言指令调用\nconst result = await skill.callAPIByInstruction('获取所有用户', {\n  query: { page: 1 }\n});"
      },
      {
        "title": "方法 1: 使用 Token 认证",
        "body": "import SwaggerAPISkill from './index.js';\n\nconst skill = new SwaggerAPISkill();\n\n// 方式 A: 先设置 Token，再加载规范\nskill.setAuthToken('your-jwt-token');\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs');\n\n// 方式 B: 在加载规范时直接传入 Token\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs', {\n  token: 'your-jwt-token',\n  tokenOptions: {\n    tokenType: 'Bearer',\n    headerName: 'Authorization'\n  }\n});\n\n// 调用 API（会自动添加认证头）\nconst result = await skill.callAPI('/sysUser/list', 'POST', {\n  body: { pageNum: 1, pageSize: 10 }\n});"
      },
      {
        "title": "方法 2: 使用 Cookie 认证",
        "body": "const skill = new SwaggerAPISkill();\n\n// 方式 A: 先设置 Cookie，再加载规范\nskill.setAuthCookies({\n  token: 'your-token',\n  JSESSIONID: 'your-session-id'\n});\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs');\n\n// 方式 B: 在加载规范时直接传入 Cookie\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs', {\n  cookies: {\n    token: 'your-token',\n    JSESSIONID: 'your-session-id'\n  }\n});"
      },
      {
        "title": "方法 3: 无需认证",
        "body": "const skill = new SwaggerAPISkill();\n\n// 直接加载规范\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs');\n\n// 调用 API\nconst result = await skill.callAPI('/users', 'GET', {\n  query: { page: 1, limit: 10 }\n});"
      },
      {
        "title": "方法 4: 使用 CLI 工具（推荐）",
        "body": "node cli.js\n\n交互式 CLI 工具会引导你：\n\n输入 Swagger API 文档 URL\n输入认证 Token（可选）\n通过菜单选择操作（获取接口列表、搜索、调用等）"
      },
      {
        "title": "fetchSwaggerSpec(url, options)",
        "body": "获取并加载 Swagger 规范文件。\n\n参数:\n\nurl (string): Swagger JSON URL 或 API 基础 URL\noptions (object): 可选配置\n\ntoken (string): JWT Token 或其他认证 Token\ncookies (object): Cookie 对象，如 { token: 'xxx', JSESSIONID: 'xxx' }\ntokenOptions (object): Token 选项\n\ntokenType (string): Token 类型，默认为 'Bearer'\nheaderName (string): 请求头名称，默认为 'Authorization'\n\n返回:\n\n{\n  success: boolean,\n  apiCount?: number,    // 接口总数\n  cached?: boolean,     // 仅缓存命中时返回 true\n  error?: string\n}"
      },
      {
        "title": "setAuthToken(token, options)",
        "body": "设置认证 Token。\n\n参数:\n\ntoken (string): JWT Token 或其他认证 Token\noptions (object): 可选配置\n\ntokenType (string): Token 类型，默认为 'Bearer'\nheaderName (string): 请求头名称，默认为 'Authorization'\n\n返回:\n\n{\n  success: boolean,\n  message: string\n}"
      },
      {
        "title": "setAuthCookies(cookies)",
        "body": "设置认证 Cookie。\n\n参数:\n\ncookies (object): Cookie 对象，如 { token: 'xxx', JSESSIONID: 'xxx' }\n\n返回:\n\n{\n  success: boolean,\n  message: string\n}"
      },
      {
        "title": "clearAuth()",
        "body": "清除认证信息。\n\n返回:\n\n{\n  success: boolean,\n  message: string\n}"
      },
      {
        "title": "getAllAPIs()",
        "body": "获取所有接口的基本信息。\n\n返回:\n\n{\n  success: boolean,\n  total: number,\n  apis: Array<{\n    path: string,\n    method: string,\n    summary: string,\n    description: string,\n    operationId: string,\n    tags: string[]\n  }>\n}"
      },
      {
        "title": "searchAPI(query)",
        "body": "根据自然语言查询搜索接口。支持 summary、description、path、operationId 和 tags 匹配。\n\n参数:\n\nquery (string): 自然语言查询字符串\n\n返回:\n\n{\n  success: boolean,\n  query: string,\n  matchCount: number,\n  results: Array<{\n    path: string,\n    method: string,\n    summary: string,\n    description?: string,  // 仅非空时返回\n    score: number\n  }>\n}"
      },
      {
        "title": "getAPIDetail(path, method)",
        "body": "获取特定接口的详细信息。使用 Map O(1) 查找。\n\n参数:\n\npath (string): API 路径，如 /users/{id}\nmethod (string): HTTP 方法，如 GET, POST 等\n\n返回:\n\n{\n  success: boolean,\n  detail?: {\n    path: string,\n    method: string,\n    summary: string,\n    description: string,\n    parameters: Array,\n    requestBody: object,\n    responses: object,\n    tags: Array\n  },\n  error?: string\n}"
      },
      {
        "title": "getFullAPIDetail(path, method)",
        "body": "获取完整的接口详情，包括关联的数据模式定义。兼容 OpenAPI 3.0 和 Swagger 2.0。\n\n参数:\n\npath (string): API 路径\nmethod (string): HTTP 方法\n\n返回:\n\n{\n  success: boolean,\n  detail?: {\n    path: string,\n    method: string,\n    summary: string,\n    description: string,\n    parameters: Array,\n    requestBody: object,\n    responses: object,\n    tags: Array,\n    relatedSchemas: object,  // 关联的数据模式定义\n    schemaCount: number\n  },\n  error?: string\n}"
      },
      {
        "title": "callAPI(path, method, params)",
        "body": "调用 API 接口。支持 JSON 请求和 multipart/form-data 文件上传。\n\n参数:\n\npath (string): API 路径\nmethod (string): HTTP 方法\nparams (object): 请求参数\n\nquery (object): 查询参数\nbody (object): 请求体（JSON 或 FormData）\nheaders (object): 自定义请求头\nisFormData (boolean): 是否为 FormData（文件上传）\n\n返回:\n\n{\n  success: boolean,\n  status?: number,\n  data?: any,\n  error?: string\n}\n\n示例 - JSON 请求:\n\nconst response = await skill.callAPI('/api/users', 'POST', {\n  body: { name: 'John', email: 'john@example.com' }\n});\n\n示例 - 文件上传（使用 FormData）:\n\nimport FormData from 'form-data';\nimport fs from 'fs';\n\nconst form = new FormData();\nform.append('file', fs.createReadStream('./data.jsonl'));\nform.append('name', 'My Dataset');\nform.append('type', 'train_data');\n\nconst response = await skill.callAPI('/api/datasets/', 'POST', {\n  body: form,\n  isFormData: true\n});"
      },
      {
        "title": "callAPIByInstruction(instruction, params)",
        "body": "根据自然语言指令调用 API。\n\n参数:\n\ninstruction (string): 自然语言指令\nparams (object): 请求参数（同 callAPI）\n\n返回:\n\n{\n  success: boolean,\n  instruction: string,\n  matchedAPI?: {\n    path: string,\n    method: string,\n    summary: string,\n    matchScore: number\n  },\n  result: object,\n  error?: string\n}"
      },
      {
        "title": "uploadFile(path, formData, query)",
        "body": "文件上传方法，支持 multipart/form-data。\n\n参数:\n\npath (string): API 路径\nformData (object): 表单数据对象\n\nfile: 文件内容（Buffer）或文件路径（string）\n其他字段: 表单字段（自动转换为字符串）\n\n\nquery (object): 查询参数（可选）\n\n返回:\n\n{\n  success: boolean,\n  status?: number,\n  data?: any,\n  error?: string\n}\n\n示例:\n\nimport SwaggerAPISkill from './index.js';\n\nconst skill = new SwaggerAPISkill();\nawait skill.fetchSwaggerSpec('http://localhost:8000/openapi.json');\n\n// 方式1: 使用文件路径\nconst result1 = await skill.uploadFile('/api/datasets/', {\n  file: './test_dataset.jsonl',\n  name: 'AI知识问答对',\n  type: 'train_data',\n  description: '人工智能相关的问答对数据集'\n});\n\n// 方式2: 使用 Buffer\nimport fs from 'fs';\nconst fileBuffer = fs.readFileSync('./test_dataset.jsonl');\nconst result2 = await skill.uploadFile('/api/datasets/', {\n  file: fileBuffer,\n  name: 'AI知识问答对',\n  type: 'train_data',\n  description: '人工智能相关的问答对数据集'\n});"
      },
      {
        "title": "getSessionId()",
        "body": "获取当前会话ID。\n\n返回:\n\nstring // 唯一的会话ID，格式: session_timestamp_randomId"
      },
      {
        "title": "refreshSession()",
        "body": "刷新会话，清空所有缓存数据。\n\n返回:\n\n{\n  success: boolean,\n  message: string\n}"
      },
      {
        "title": "缓存机制",
        "body": "swagger-skill 实现了分层缓存来优化性能和 token 消耗：\n\n轻量索引 (apiIndex): 仅存储 path/method/summary/description/operationId/tags，用于 getAllAPIs() 和 searchAPI()\n详情 Map (apiDetailMap): \"METHOD /path\" → 完整详情，用于 getAPIDetail() 的 O(1) 查找\n首次加载: 调用 fetchSwaggerSpec() 时从远程获取规范并构建两层缓存\n后续查询: 所有查询操作直接使用内存缓存，无需重新加载\n会话管理: 调用 refreshSession() 可清空缓存"
      },
      {
        "title": "支持的 HTTP 方法",
        "body": "GET\nPOST\nPUT\nDELETE\nPATCH\nHEAD\nOPTIONS"
      },
      {
        "title": "注意事项",
        "body": "需要网络连接来获取 Swagger 规范和调用 API\n某些 API 可能需要身份验证，可通过 headers 参数传递认证信息\n自然语言搜索基于关键词匹配，支持 summary、description、path、operationId 和 tags\n路径参数需要在 query 参数中提供\n文件上传:\n\n使用 uploadFile() 方法是最简单的方式，支持文件路径或 Buffer\n也可以使用 callAPI() 方法配合 FormData 对象进行更灵活的控制\n文件上传时不需要手动设置 Content-Type，会自动设置为 multipart/form-data\n\n\n同时兼容 OpenAPI 3.0 (components.schemas) 和 Swagger 2.0 (definitions)"
      },
      {
        "title": "许可证",
        "body": "MIT"
      }
    ],
    "body": "功能特性\n一键查询: 直接查询接口详情，自动解析参数、请求体、响应模式\n自然语言搜索: 根据自然语言描述找到匹配的接口（如\"保存用户\"、\"获取数据集列表\"），支持 tags 匹配\n智能接口调用: 根据自然语言指令自动匹配并调用相应的 API\n完整信息展示: 自动获取并展示接口的完整信息（参数、请求体、响应、数据模式定义）\n文件上传支持: 支持 multipart/form-data 文件上传\n分层缓存: 轻量索引用于列表/搜索，Map 结构 O(1) 详情查找\nSwagger 2.0 兼容: 同时支持 OpenAPI 3.0 和 Swagger 2.0 规范\n灵活认证: 支持 Token、Cookie 或无需验证的多种认证方式\n安装\n\n无需手动安装依赖。首次使用时会自动检测并安装所需依赖（axios、form-data），同时自动初始化 package.json（含 \"type\": \"module\" 配置）。\n\n如需手动安装，可在 skill 目录下执行：\n\nnpm install\n\n使用方法\n基础使用\nimport SwaggerAPISkill from './index.js';\n\nconst skill = new SwaggerAPISkill();\n\n// 1. 加载 Swagger 规范\nawait skill.fetchSwaggerSpec('https://api.example.com/swagger.json');\n\n// 2. 获取所有接口\nconst allAPIs = skill.getAllAPIs();\n\n// 3. 搜索接口\nconst results = skill.searchAPI('获取用户信息');\n\n// 4. 获取接口详情\nconst detail = skill.getAPIDetail('/users/{id}', 'GET');\n\n// 5. 调用接口\nconst response = await skill.callAPI('/users', 'GET', {\n  query: { page: 1, limit: 10 }\n});\n\n// 6. 通过自然语言指令调用\nconst result = await skill.callAPIByInstruction('获取所有用户', {\n  query: { page: 1 }\n});\n\n认证方法\n方法 1: 使用 Token 认证\nimport SwaggerAPISkill from './index.js';\n\nconst skill = new SwaggerAPISkill();\n\n// 方式 A: 先设置 Token，再加载规范\nskill.setAuthToken('your-jwt-token');\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs');\n\n// 方式 B: 在加载规范时直接传入 Token\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs', {\n  token: 'your-jwt-token',\n  tokenOptions: {\n    tokenType: 'Bearer',\n    headerName: 'Authorization'\n  }\n});\n\n// 调用 API（会自动添加认证头）\nconst result = await skill.callAPI('/sysUser/list', 'POST', {\n  body: { pageNum: 1, pageSize: 10 }\n});\n\n方法 2: 使用 Cookie 认证\nconst skill = new SwaggerAPISkill();\n\n// 方式 A: 先设置 Cookie，再加载规范\nskill.setAuthCookies({\n  token: 'your-token',\n  JSESSIONID: 'your-session-id'\n});\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs');\n\n// 方式 B: 在加载规范时直接传入 Cookie\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs', {\n  cookies: {\n    token: 'your-token',\n    JSESSIONID: 'your-session-id'\n  }\n});\n\n方法 3: 无需认证\nconst skill = new SwaggerAPISkill();\n\n// 直接加载规范\nawait skill.fetchSwaggerSpec('http://localhost:8090/v2/api-docs');\n\n// 调用 API\nconst result = await skill.callAPI('/users', 'GET', {\n  query: { page: 1, limit: 10 }\n});\n\n方法 4: 使用 CLI 工具（推荐）\nnode cli.js\n\n\n交互式 CLI 工具会引导你：\n\n输入 Swagger API 文档 URL\n输入认证 Token（可选）\n通过菜单选择操作（获取接口列表、搜索、调用等）\nAPI 文档\nfetchSwaggerSpec(url, options)\n\n获取并加载 Swagger 规范文件。\n\n参数:\n\nurl (string): Swagger JSON URL 或 API 基础 URL\noptions (object): 可选配置\ntoken (string): JWT Token 或其他认证 Token\ncookies (object): Cookie 对象，如 { token: 'xxx', JSESSIONID: 'xxx' }\ntokenOptions (object): Token 选项\ntokenType (string): Token 类型，默认为 'Bearer'\nheaderName (string): 请求头名称，默认为 'Authorization'\n\n返回:\n\n{\n  success: boolean,\n  apiCount?: number,    // 接口总数\n  cached?: boolean,     // 仅缓存命中时返回 true\n  error?: string\n}\n\nsetAuthToken(token, options)\n\n设置认证 Token。\n\n参数:\n\ntoken (string): JWT Token 或其他认证 Token\noptions (object): 可选配置\ntokenType (string): Token 类型，默认为 'Bearer'\nheaderName (string): 请求头名称，默认为 'Authorization'\n\n返回:\n\n{\n  success: boolean,\n  message: string\n}\n\nsetAuthCookies(cookies)\n\n设置认证 Cookie。\n\n参数:\n\ncookies (object): Cookie 对象，如 { token: 'xxx', JSESSIONID: 'xxx' }\n\n返回:\n\n{\n  success: boolean,\n  message: string\n}\n\nclearAuth()\n\n清除认证信息。\n\n返回:\n\n{\n  success: boolean,\n  message: string\n}\n\ngetAllAPIs()\n\n获取所有接口的基本信息。\n\n返回:\n\n{\n  success: boolean,\n  total: number,\n  apis: Array<{\n    path: string,\n    method: string,\n    summary: string,\n    description: string,\n    operationId: string,\n    tags: string[]\n  }>\n}\n\nsearchAPI(query)\n\n根据自然语言查询搜索接口。支持 summary、description、path、operationId 和 tags 匹配。\n\n参数:\n\nquery (string): 自然语言查询字符串\n\n返回:\n\n{\n  success: boolean,\n  query: string,\n  matchCount: number,\n  results: Array<{\n    path: string,\n    method: string,\n    summary: string,\n    description?: string,  // 仅非空时返回\n    score: number\n  }>\n}\n\ngetAPIDetail(path, method)\n\n获取特定接口的详细信息。使用 Map O(1) 查找。\n\n参数:\n\npath (string): API 路径，如 /users/{id}\nmethod (string): HTTP 方法，如 GET, POST 等\n\n返回:\n\n{\n  success: boolean,\n  detail?: {\n    path: string,\n    method: string,\n    summary: string,\n    description: string,\n    parameters: Array,\n    requestBody: object,\n    responses: object,\n    tags: Array\n  },\n  error?: string\n}\n\ngetFullAPIDetail(path, method)\n\n获取完整的接口详情，包括关联的数据模式定义。兼容 OpenAPI 3.0 和 Swagger 2.0。\n\n参数:\n\npath (string): API 路径\nmethod (string): HTTP 方法\n\n返回:\n\n{\n  success: boolean,\n  detail?: {\n    path: string,\n    method: string,\n    summary: string,\n    description: string,\n    parameters: Array,\n    requestBody: object,\n    responses: object,\n    tags: Array,\n    relatedSchemas: object,  // 关联的数据模式定义\n    schemaCount: number\n  },\n  error?: string\n}\n\ncallAPI(path, method, params)\n\n调用 API 接口。支持 JSON 请求和 multipart/form-data 文件上传。\n\n参数:\n\npath (string): API 路径\nmethod (string): HTTP 方法\nparams (object): 请求参数\nquery (object): 查询参数\nbody (object): 请求体（JSON 或 FormData）\nheaders (object): 自定义请求头\nisFormData (boolean): 是否为 FormData（文件上传）\n\n返回:\n\n{\n  success: boolean,\n  status?: number,\n  data?: any,\n  error?: string\n}\n\n\n示例 - JSON 请求:\n\nconst response = await skill.callAPI('/api/users', 'POST', {\n  body: { name: 'John', email: 'john@example.com' }\n});\n\n\n示例 - 文件上传（使用 FormData）:\n\nimport FormData from 'form-data';\nimport fs from 'fs';\n\nconst form = new FormData();\nform.append('file', fs.createReadStream('./data.jsonl'));\nform.append('name', 'My Dataset');\nform.append('type', 'train_data');\n\nconst response = await skill.callAPI('/api/datasets/', 'POST', {\n  body: form,\n  isFormData: true\n});\n\ncallAPIByInstruction(instruction, params)\n\n根据自然语言指令调用 API。\n\n参数:\n\ninstruction (string): 自然语言指令\nparams (object): 请求参数（同 callAPI）\n\n返回:\n\n{\n  success: boolean,\n  instruction: string,\n  matchedAPI?: {\n    path: string,\n    method: string,\n    summary: string,\n    matchScore: number\n  },\n  result: object,\n  error?: string\n}\n\nuploadFile(path, formData, query)\n\n文件上传方法，支持 multipart/form-data。\n\n参数:\n\npath (string): API 路径\nformData (object): 表单数据对象\nfile: 文件内容（Buffer）或文件路径（string）\n其他字段: 表单字段（自动转换为字符串）\nquery (object): 查询参数（可选）\n\n返回:\n\n{\n  success: boolean,\n  status?: number,\n  data?: any,\n  error?: string\n}\n\n\n示例:\n\nimport SwaggerAPISkill from './index.js';\n\nconst skill = new SwaggerAPISkill();\nawait skill.fetchSwaggerSpec('http://localhost:8000/openapi.json');\n\n// 方式1: 使用文件路径\nconst result1 = await skill.uploadFile('/api/datasets/', {\n  file: './test_dataset.jsonl',\n  name: 'AI知识问答对',\n  type: 'train_data',\n  description: '人工智能相关的问答对数据集'\n});\n\n// 方式2: 使用 Buffer\nimport fs from 'fs';\nconst fileBuffer = fs.readFileSync('./test_dataset.jsonl');\nconst result2 = await skill.uploadFile('/api/datasets/', {\n  file: fileBuffer,\n  name: 'AI知识问答对',\n  type: 'train_data',\n  description: '人工智能相关的问答对数据集'\n});\n\ngetSessionId()\n\n获取当前会话ID。\n\n返回:\n\nstring // 唯一的会话ID，格式: session_timestamp_randomId\n\nrefreshSession()\n\n刷新会话，清空所有缓存数据。\n\n返回:\n\n{\n  success: boolean,\n  message: string\n}\n\n缓存机制\n\nswagger-skill 实现了分层缓存来优化性能和 token 消耗：\n\n轻量索引 (apiIndex): 仅存储 path/method/summary/description/operationId/tags，用于 getAllAPIs() 和 searchAPI()\n详情 Map (apiDetailMap): \"METHOD /path\" → 完整详情，用于 getAPIDetail() 的 O(1) 查找\n首次加载: 调用 fetchSwaggerSpec() 时从远程获取规范并构建两层缓存\n后续查询: 所有查询操作直接使用内存缓存，无需重新加载\n会话管理: 调用 refreshSession() 可清空缓存\n支持的 HTTP 方法\nGET\nPOST\nPUT\nDELETE\nPATCH\nHEAD\nOPTIONS\n注意事项\n需要网络连接来获取 Swagger 规范和调用 API\n某些 API 可能需要身份验证，可通过 headers 参数传递认证信息\n自然语言搜索基于关键词匹配，支持 summary、description、path、operationId 和 tags\n路径参数需要在 query 参数中提供\n文件上传:\n使用 uploadFile() 方法是最简单的方式，支持文件路径或 Buffer\n也可以使用 callAPI() 方法配合 FormData 对象进行更灵活的控制\n文件上传时不需要手动设置 Content-Type，会自动设置为 multipart/form-data\n同时兼容 OpenAPI 3.0 (components.schemas) 和 Swagger 2.0 (definitions)\n许可证\n\nMIT"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/MinusGod/swagger-skill",
    "publisherUrl": "https://clawhub.ai/MinusGod/swagger-skill",
    "owner": "MinusGod",
    "version": "1.0.1",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/swagger-skill",
    "downloadUrl": "https://openagent3.xyz/downloads/swagger-skill",
    "agentUrl": "https://openagent3.xyz/skills/swagger-skill/agent",
    "manifestUrl": "https://openagent3.xyz/skills/swagger-skill/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/swagger-skill/agent.md"
  }
}