{ "name": "cloudbase-mcp", "version": "1.8.1", "description": "腾讯云开发 MCP Server,支持静态托管/环境查询/云函数/云数据库等功能", "tools": [ { "name": "auth", "description": "CloudBase(腾讯云开发)开发阶段登录与环境绑定。登录后即可访问云资源;环境(env)是云函数、数据库、静态托管等资源的隔离单元,绑定环境后其他 MCP 工具才能操作该环境。支持:查询状态、发起登录、API Key登录、绑定环境(set_env)、退出登录。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "status", "start_auth", "set_env", "logout", "get_temp_credentials", "login_by_api_key" ], "description": "动作:status=查询状态,start_auth=发起登录,login_by_api_key=API Key登录,set_env=绑定环境(传envId),logout=退出登录" }, "authMode": { "type": "string", "enum": [ "device", "web" ], "description": "认证模式:device=设备码授权,web=浏览器回调授权" }, "oauthEndpoint": { "type": "string", "description": "高级可选:自定义 device-code 登录 endpoint。配置后 oauthCustom 默认按 true 处理" }, "clientId": { "type": "string", "description": "高级可选:自定义 device-code 登录 client_id,不传则使用默认值" }, "oauthCustom": { "type": "boolean", "description": "高级可选:自定义 endpoint 返回格式开关。未配置 endpoint 时默认 false;配置 endpoint 后默认 true,且不能设为 false" }, "envId": { "type": "string", "description": "环境ID(CloudBase 环境唯一标识),绑定后工具将操作该环境。action=set_env 时必填" }, "apiKey": { "type": "string", "description": "CloudBase API Key,action=login_by_api_key 时必填" }, "apiKeyEnvId": { "type": "string", "description": "CloudBase 环境ID(EnvId),action=login_by_api_key 时必填,用于指定 API Key 所属环境" }, "confirm": { "type": "string", "const": "yes", "description": "action=logout 时确认操作,传 yes" }, "reveal": { "type": "boolean", "description": "action=get_temp_credentials 时可选。true=返回明文临时密钥;默认 false 仅返回脱敏结果" } }, "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryEnv", "description": "查询 CloudBase 环境相关信息,支持查询环境列表、指定环境详情、安全域名、资源用量与监控指标。(曾用名:envQuery、listEnvs、getEnvInfo、getEnvAuthDomains)当 action=list 时,会按 DescribeEnvs 语义做列表/筛选,标准返回字段为 EnvId、Alias、Status、EnvType、Region、PackageId、PackageName、IsDefault,并支持通过 fields 白名单裁剪这些字段;aliasExact=true 时会按别名精确筛选,避免把前缀相近的环境误当作候选;即使传入 envId,action=list 也只返回摘要,不会返回完整资源明细或 expiry。如需查询某个已知 EnvId 对应环境的详细信息(包括资源字段和计费信息),必须使用 action=info 并传入目标环境的 envId 参数。action=info 会在可用时补充 BillingInfo(如 ExpireTime、PayMode、IsAutoRenew 等计费字段)。\n\n📊 action=usage 对齐 tcb env usage/info:透传 Manager SDK describeEnvAccountCircle + describeCreditsUsageDetail,返回计费周期与各模块资源点用量(FLEXDB/SCF/COS 等)。envId 必填;type 可选过滤模块;未传 startDate/endDate 时自动使用当前计费周期。\n\n📈 action=metrics 对齐 TCB DescribeCurveData(manager.monitor.describeCurveData,不是云监控 GetMonitorData):查询环境/网关 QPS、云函数调用与错误、数据库 CPU/内存/磁盘、云托管 CPU/QPS 等时序。envId 与 metricName 必填;startTime/endTime 格式 YYYY-MM-DD HH:mm:ss,须成对传入,不传则默认最近 24 小时;period 仅 300/3600/86400。GatewayTraceEnvQPS 未传 resourceID 时自动填环境级 all|:|all|:|all|:|all;云托管 Tke* 指标必须传服务名 resourceID。禁止用 callCloudApi 猜测监控 Action。\n\n🔍 action=info 还会派生三个用于后端选型的字段:\n- `EnvInfo.RuntimeMode`:'postgresql' 或 'nosql',表示新业务建议默认使用的后端(PG 已开通时为 postgresql,否则为 nosql)。\n- `EnvInfo.RuntimeBackends`:`{postgresql, nosql, mysql}` 三个布尔值,描述当前环境实际并存的后端。\n- `EnvInfo.RuntimeModeHints`:每个后端对应的 API/工具/skill 提示。\n\n🌐 action=info 还会在不改写 `StaticStorages[].StaticDomain`(云 API 名义域名)的前提下,投影网关路由 Enable 状态:`StaticStorages[].staticDomainRouteEnabled` 与 `EnvInfo.staticDomainRouteEnabled`(与 queryHosting websiteConfig 同源)。`false` 表示默认静态域名根路由已禁用(访问会返回 GATEWAY_ROUTE_DISABLED),勿把名义域名当成可达 URL。\n\nAI 在写业务/权限/存储代码前必须先看这三项:PG 模式下新业务推荐 `app.rdb()` + RLS(`managePgDatabase action=execute` 跑 `CREATE POLICY`)+ pgstore;已存在的 NoSQL 集合 / 旧 storage / `managePermissions(resourceType=\"noSqlDatabase\")` 在 PG 环境下仍然有效。真正不适用的是 MySQL:当 `RuntimeBackends.mysql === false` 时,`manageMysqlDatabase` / `queryMysqlDatabase` / `relational-database-mcp-cloudbase` skill 都不该使用。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "list", "info", "domains", "usage", "metrics" ], "description": "查询类型:list=环境列表/摘要筛选(按 DescribeEnvs 语义筛选,支持通过 envId 筛选,返回 EnvId、Alias、Status、EnvType、Region、PackageId、PackageName、IsDefault,不支持 expiry),info=指定环境的详细信息(必须传入 envId,返回资源字段和计费信息),domains=安全域名列表,usage=环境资源用量(必须传入 envId,对齐 tcb env usage/info),metrics=环境监控时序(必须传入 envId 与 metricName,对齐 TCB DescribeCurveData)" }, "alias": { "type": "string", "description": "按环境别名筛选。action=list 时可选" }, "aliasExact": { "type": "boolean", "description": "按环境别名精确筛选。action=list 时可选;与 alias 配合使用" }, "envId": { "type": "string", "description": "环境 ID。action=list 时可选(仅按 DescribeEnvs 语义做筛选,仍返回摘要);action=info / action=usage / action=metrics 时必填。" }, "limit": { "type": "integer", "exclusiveMinimum": 0, "description": "返回数量上限。action=list 时可选" }, "offset": { "type": "integer", "minimum": 0, "description": "分页偏移。action=list 时可选" }, "fields": { "type": "array", "items": { "type": "string", "enum": [ "EnvId", "Alias", "Status", "EnvType", "Region", "PackageId", "PackageName", "IsDefault" ] }, "description": "返回字段白名单。仅支持 EnvId、Alias、Status、EnvType、Region、PackageId、PackageName、IsDefault。action=list 时可选" }, "type": { "type": "array", "items": { "type": "string", "enum": [ "FLEXDB", "TDSQL", "SCF", "EKS", "COS", "AI", "HOSTING", "Auth", "APIInvocation", "HTTPInvocation", "VM", "Workflow", "Other" ] }, "description": "用量模块过滤。仅 action=usage 时有效;不传则查询全部模块。可选值对齐 tcb CLI:FLEXDB、TDSQL、SCF、EKS、COS、AI、HOSTING、Auth、APIInvocation、HTTPInvocation、VM、Workflow、Other。" }, "startDate": { "type": "string", "description": "用量开始日期(YYYY-MM-DD)。仅 action=usage 时有效;与 endDate 成对传入。不传则使用当前计费周期。" }, "endDate": { "type": "string", "description": "用量结束日期(YYYY-MM-DD)。仅 action=usage 时有效;与 startDate 成对传入。不传则使用当前计费周期。" }, "needUsageDetails": { "type": "boolean", "description": "是否返回每日用量明细。仅 action=usage 时有效;默认 true。" }, "metricName": { "type": "string", "enum": [ "GatewayTraceEnvQPS", "EnvQPSAll", "FunctionInvocation", "FunctionError", "FunctionTimeout", "FunctionThrottle", "FunctionDuration", "FunctionConcurrentExecutions", "DbRead", "DbWrite", "DbSizepkg", "MysqlCpuUsageRate", "MysqlMemoryUse", "MysqlStorageUsage", "MysqlQps", "MysqlSlowQueries", "MysqlDbConnections", "TkeCpuUsedService", "TkeMemUsedService", "TkeQPSService", "TkeHttpErrorService", "TkeInvokeNumService" ], "description": "监控指标名。仅 action=metrics 时有效且必填。GatewayTraceEnvQPS/EnvQPSAll=环境与网关 QPS;FunctionInvocation/FunctionError/FunctionTimeout/FunctionThrottle=云函数调用、错误、超时、限流;DbRead/DbWrite/DbSizepkg=文档库读写与容量;MysqlCpuUsageRate/MysqlMemoryUse/MysqlStorageUsage=SQL 库 CPU/内存/磁盘;TkeCpuUsedService/TkeQPSService/TkeHttpErrorService=云托管 CPU/QPS/错误。" }, "startTime": { "type": "string", "description": "监控开始时间(YYYY-MM-DD HH:mm:ss)。仅 action=metrics 时有效;与 endTime 成对传入。不传则默认最近 24 小时。结束时间须晚于开始时间至少五分钟。" }, "endTime": { "type": "string", "description": "监控结束时间(YYYY-MM-DD HH:mm:ss)。仅 action=metrics 时有效;与 startTime 成对传入。不传则默认最近 24 小时。" }, "period": { "type": "number", "enum": [ 300, 3600, 86400 ], "description": "统计周期(秒)。仅 action=metrics 时有效;仅支持 300、3600、86400。不传则由后端按时间范围自动选择。时间范围 ≤1 天不可用 86400;>3 天不可用 300。" }, "resourceID": { "type": "string", "description": "资源 ID。仅 action=metrics 时有效。云函数传函数名,文档库传集合名,云托管必须传服务名;GatewayTraceEnvQPS 不传则使用环境级 all|:|all|:|all|:|all。" }, "subresourceID": { "type": "string", "description": "子资源 ID。仅 action=metrics 时有效;查询云托管某版本监控时传入版本名。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "envQuery", "description": "查询 CloudBase 环境相关信息,支持查询环境列表、指定环境详情、安全域名、资源用量与监控指标。(曾用名:envQuery、listEnvs、getEnvInfo、getEnvAuthDomains)当 action=list 时,会按 DescribeEnvs 语义做列表/筛选,标准返回字段为 EnvId、Alias、Status、EnvType、Region、PackageId、PackageName、IsDefault,并支持通过 fields 白名单裁剪这些字段;aliasExact=true 时会按别名精确筛选,避免把前缀相近的环境误当作候选;即使传入 envId,action=list 也只返回摘要,不会返回完整资源明细或 expiry。如需查询某个已知 EnvId 对应环境的详细信息(包括资源字段和计费信息),必须使用 action=info 并传入目标环境的 envId 参数。action=info 会在可用时补充 BillingInfo(如 ExpireTime、PayMode、IsAutoRenew 等计费字段)。\n\n📊 action=usage 对齐 tcb env usage/info:透传 Manager SDK describeEnvAccountCircle + describeCreditsUsageDetail,返回计费周期与各模块资源点用量(FLEXDB/SCF/COS 等)。envId 必填;type 可选过滤模块;未传 startDate/endDate 时自动使用当前计费周期。\n\n📈 action=metrics 对齐 TCB DescribeCurveData(manager.monitor.describeCurveData,不是云监控 GetMonitorData):查询环境/网关 QPS、云函数调用与错误、数据库 CPU/内存/磁盘、云托管 CPU/QPS 等时序。envId 与 metricName 必填;startTime/endTime 格式 YYYY-MM-DD HH:mm:ss,须成对传入,不传则默认最近 24 小时;period 仅 300/3600/86400。GatewayTraceEnvQPS 未传 resourceID 时自动填环境级 all|:|all|:|all|:|all;云托管 Tke* 指标必须传服务名 resourceID。禁止用 callCloudApi 猜测监控 Action。\n\n🔍 action=info 还会派生三个用于后端选型的字段:\n- `EnvInfo.RuntimeMode`:'postgresql' 或 'nosql',表示新业务建议默认使用的后端(PG 已开通时为 postgresql,否则为 nosql)。\n- `EnvInfo.RuntimeBackends`:`{postgresql, nosql, mysql}` 三个布尔值,描述当前环境实际并存的后端。\n- `EnvInfo.RuntimeModeHints`:每个后端对应的 API/工具/skill 提示。\n\n🌐 action=info 还会在不改写 `StaticStorages[].StaticDomain`(云 API 名义域名)的前提下,投影网关路由 Enable 状态:`StaticStorages[].staticDomainRouteEnabled` 与 `EnvInfo.staticDomainRouteEnabled`(与 queryHosting websiteConfig 同源)。`false` 表示默认静态域名根路由已禁用(访问会返回 GATEWAY_ROUTE_DISABLED),勿把名义域名当成可达 URL。\n\nAI 在写业务/权限/存储代码前必须先看这三项:PG 模式下新业务推荐 `app.rdb()` + RLS(`managePgDatabase action=execute` 跑 `CREATE POLICY`)+ pgstore;已存在的 NoSQL 集合 / 旧 storage / `managePermissions(resourceType=\"noSqlDatabase\")` 在 PG 环境下仍然有效。真正不适用的是 MySQL:当 `RuntimeBackends.mysql === false` 时,`manageMysqlDatabase` / `queryMysqlDatabase` / `relational-database-mcp-cloudbase` skill 都不该使用。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "list", "info", "domains", "usage", "metrics" ], "description": "查询类型:list=环境列表/摘要筛选(按 DescribeEnvs 语义筛选,支持通过 envId 筛选,返回 EnvId、Alias、Status、EnvType、Region、PackageId、PackageName、IsDefault,不支持 expiry),info=指定环境的详细信息(必须传入 envId,返回资源字段和计费信息),domains=安全域名列表,usage=环境资源用量(必须传入 envId,对齐 tcb env usage/info),metrics=环境监控时序(必须传入 envId 与 metricName,对齐 TCB DescribeCurveData)" }, "alias": { "type": "string", "description": "按环境别名筛选。action=list 时可选" }, "aliasExact": { "type": "boolean", "description": "按环境别名精确筛选。action=list 时可选;与 alias 配合使用" }, "envId": { "type": "string", "description": "环境 ID。action=list 时可选(仅按 DescribeEnvs 语义做筛选,仍返回摘要);action=info / action=usage / action=metrics 时必填。" }, "limit": { "type": "integer", "exclusiveMinimum": 0, "description": "返回数量上限。action=list 时可选" }, "offset": { "type": "integer", "minimum": 0, "description": "分页偏移。action=list 时可选" }, "fields": { "type": "array", "items": { "type": "string", "enum": [ "EnvId", "Alias", "Status", "EnvType", "Region", "PackageId", "PackageName", "IsDefault" ] }, "description": "返回字段白名单。仅支持 EnvId、Alias、Status、EnvType、Region、PackageId、PackageName、IsDefault。action=list 时可选" }, "type": { "type": "array", "items": { "type": "string", "enum": [ "FLEXDB", "TDSQL", "SCF", "EKS", "COS", "AI", "HOSTING", "Auth", "APIInvocation", "HTTPInvocation", "VM", "Workflow", "Other" ] }, "description": "用量模块过滤。仅 action=usage 时有效;不传则查询全部模块。可选值对齐 tcb CLI:FLEXDB、TDSQL、SCF、EKS、COS、AI、HOSTING、Auth、APIInvocation、HTTPInvocation、VM、Workflow、Other。" }, "startDate": { "type": "string", "description": "用量开始日期(YYYY-MM-DD)。仅 action=usage 时有效;与 endDate 成对传入。不传则使用当前计费周期。" }, "endDate": { "type": "string", "description": "用量结束日期(YYYY-MM-DD)。仅 action=usage 时有效;与 startDate 成对传入。不传则使用当前计费周期。" }, "needUsageDetails": { "type": "boolean", "description": "是否返回每日用量明细。仅 action=usage 时有效;默认 true。" }, "metricName": { "type": "string", "enum": [ "GatewayTraceEnvQPS", "EnvQPSAll", "FunctionInvocation", "FunctionError", "FunctionTimeout", "FunctionThrottle", "FunctionDuration", "FunctionConcurrentExecutions", "DbRead", "DbWrite", "DbSizepkg", "MysqlCpuUsageRate", "MysqlMemoryUse", "MysqlStorageUsage", "MysqlQps", "MysqlSlowQueries", "MysqlDbConnections", "TkeCpuUsedService", "TkeMemUsedService", "TkeQPSService", "TkeHttpErrorService", "TkeInvokeNumService" ], "description": "监控指标名。仅 action=metrics 时有效且必填。GatewayTraceEnvQPS/EnvQPSAll=环境与网关 QPS;FunctionInvocation/FunctionError/FunctionTimeout/FunctionThrottle=云函数调用、错误、超时、限流;DbRead/DbWrite/DbSizepkg=文档库读写与容量;MysqlCpuUsageRate/MysqlMemoryUse/MysqlStorageUsage=SQL 库 CPU/内存/磁盘;TkeCpuUsedService/TkeQPSService/TkeHttpErrorService=云托管 CPU/QPS/错误。" }, "startTime": { "type": "string", "description": "监控开始时间(YYYY-MM-DD HH:mm:ss)。仅 action=metrics 时有效;与 endTime 成对传入。不传则默认最近 24 小时。结束时间须晚于开始时间至少五分钟。" }, "endTime": { "type": "string", "description": "监控结束时间(YYYY-MM-DD HH:mm:ss)。仅 action=metrics 时有效;与 startTime 成对传入。不传则默认最近 24 小时。" }, "period": { "type": "number", "enum": [ 300, 3600, 86400 ], "description": "统计周期(秒)。仅 action=metrics 时有效;仅支持 300、3600、86400。不传则由后端按时间范围自动选择。时间范围 ≤1 天不可用 86400;>3 天不可用 300。" }, "resourceID": { "type": "string", "description": "资源 ID。仅 action=metrics 时有效。云函数传函数名,文档库传集合名,云托管必须传服务名;GatewayTraceEnvQPS 不传则使用环境级 all|:|all|:|all|:|all。" }, "subresourceID": { "type": "string", "description": "子资源 ID。仅 action=metrics 时有效;查询云托管某版本监控时传入版本名。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "envDomainManagement", "description": "管理 CloudBase 环境的安全域名(安全域名 / CORS 白名单),支持添加和删除操作。(原工具名:createEnvDomain/deleteEnvDomain,为兼容旧AI规则可继续使用这些名称)当浏览器 Web 应用需要从本地 Vite / dev server 直接访问 CloudBase 资源时,应先用 queryEnv(action=domains) 检查当前实际浏览器 origin 对应的 host:port 是否已在白名单中,再按该实际值添加。新增或删除后请每约 10 秒轮询 queryEnv(action=domains) 确认状态收敛,勿一次 sleep 满 10 分钟;多数环境数分钟内可收敛。⚠️ 重要:此工具仅用于 CORS/请求来源验证,不涉及 SSL 证书。自定义域名公网 HTTPS:先 queryGateway(listCustomDomains);已有域名则 manageGateway(createRoute) 显式传 domain(无需证书);仅首次绑定新域名才用 bindCustomDomain(需 certificateId)。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "create", "delete" ], "description": "操作类型:create=添加安全域名,delete=删除安全域名" }, "domains": { "type": "array", "items": { "type": "string" }, "description": "安全域名数组(格式:host:port,例如 localhost:5173 或 127.0.0.1:4173)。注意:不是自定义域名,不需要证书。" } }, "required": [ "action", "domains" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageEnv", "description": "管理 CloudBase 环境,支持:listPackages=查询可选套餐列表,create=创建新环境(需确认),modifyPlan=变更套餐(升降配,需确认),renew=续费环境(需确认)。\n\n⚠️ 所有涉及费用的操作(create/modifyPlan/renew),执行前必须展示配置摘要并等待用户通过 confirm=\"yes\" 确认。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "listPackages", "create", "modifyPlan", "renew" ], "description": "操作类型:listPackages=查询可选套餐,create=创建环境,modifyPlan=变更套餐,renew=续费" }, "alias": { "type": "string", "description": "环境别名(action=create 时必填)。要求:小写字母/数字/减号,不能以减号开头或结尾,最长 20 位" }, "packageId": { "type": "string", "description": "套餐 ID(action=create/modifyPlan 时必填)。可选值如 baas_personal(个人版)、baas_pf_standard(标准版)、baas_pf_enterprise(企业版)" }, "resources": { "type": "array", "items": { "type": "string", "enum": [ "flexdb", "storage", "function", "postgresql" ] }, "description": "启用的资源类型(action=create 时可选)。省略时默认全部四项:flexdb(文档数据库)、storage(存储)、function(云函数)、postgresql(PostgreSQL)。CreateEnv 要求 Resources 非空,MCP 会始终下发该字段。" }, "duration": { "type": "integer", "minimum": 1, "maximum": 36, "description": "购买或续费时长(月),action=create/renew 时可选,默认 1" }, "envId": { "type": "string", "description": "环境 ID(action=modifyPlan/renew 时必填)" }, "confirm": { "type": "string", "const": "yes", "description": "确认操作。所有付费操作(create/modifyPlan/renew)必须传 \"yes\" 确认" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "readNoSqlDatabaseStructure", "description": "读取 CloudBase NoSQL 数据库集合与索引结构,支持列出集合、查看集合详情、列出索引以及检查索引是否存在。本工具为服务端管理工具,用于管理端查询数据库结构,不用于编写客户端代码。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "listCollections", "describeCollection", "checkCollection", "listIndexes", "checkIndex" ], "description": "listCollections: 列出集合列表\ndescribeCollection: 描述集合详情(会返回索引摘要)\ncheckCollection: 检查集合是否存在\nlistIndexes: 列出指定集合的索引列表\ncheckIndex: 检查指定索引是否存在" }, "limit": { "type": "number", "description": "返回数量限制(listCollections 操作时可选)" }, "offset": { "type": "number", "description": "偏移量(listCollections 操作时可选)" }, "collectionName": { "type": "string", "description": "集合名称(describeCollection、listIndexes、checkIndex 操作时必填)" }, "indexName": { "type": "string", "description": "索引名称(checkIndex 操作时必填)" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "writeNoSqlDatabaseStructure", "description": "创建、删除和管理 CloudBase NoSQL 数据库集合(collection)。支持创建新集合、删除现有集合,以及通过 updateCollection 的 updateOptions.CreateIndexes / updateOptions.DropIndexes 添加索引和删除索引。当需要新建集合时,使用 action=createCollection。本工具为服务端管理工具,用于管理端操作集合和索引结构,不用于编写客户端代码。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "createCollection", "updateCollection", "deleteCollection" ], "description": "createCollection: 创建集合\nupdateCollection: 更新集合配置;添加索引请传 updateOptions.CreateIndexes,删除索引请传 updateOptions.DropIndexes\ndeleteCollection: 删除集合" }, "collectionName": { "type": "string", "minLength": 1, "description": "集合名称" }, "updateOptions": { "type": "object", "properties": { "CreateIndexes": { "type": "array", "items": { "type": "object", "properties": { "IndexName": { "type": "string", "description": "要创建的索引名称" }, "MgoKeySchema": { "type": "object", "properties": { "MgoIsUnique": { "type": "boolean", "description": "是否唯一索引" }, "MgoIndexKeys": { "type": "array", "items": { "type": "object", "properties": { "Name": { "type": "string", "description": "索引字段名" }, "Direction": { "type": "string", "description": "索引方向,通常 1 表示升序,-1 表示降序" } }, "required": [ "Name", "Direction" ], "additionalProperties": false }, "description": "索引字段列表,支持单字段或复合索引" } }, "required": [ "MgoIsUnique", "MgoIndexKeys" ], "additionalProperties": false, "description": "待创建索引的字段与约束配置" } }, "required": [ "IndexName", "MgoKeySchema" ], "additionalProperties": false }, "description": "要添加的索引列表" }, "DropIndexes": { "type": "array", "items": { "type": "object", "properties": { "IndexName": { "type": "string", "description": "要删除的索引名称" } }, "required": [ "IndexName" ], "additionalProperties": false }, "description": "要删除的索引列表" } }, "additionalProperties": false, "description": "更新选项(updateCollection 时使用)。CreateIndexes 用于添加索引,DropIndexes 用于删除索引。" } }, "required": [ "action", "collectionName" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "readNoSqlDatabaseContent", "description": "查询 CloudBase NoSQL 数据库中的数据记录。支持按条件筛选、分页、排序,适用于管理端数据查询与运维。limit 默认 100、最大 1000;超出请用 offset 分页。projection 仅支持 { field: 1|0 } 对象(示例 {\"_id\":1,\"name\":1,\"createdAt\":1}),不要传字段数组。", "inputSchema": { "type": "object", "properties": { "collectionName": { "type": "string", "description": "集合名称" }, "instanceId": { "type": "string", "description": "可选:显式指定数据库实例ID;未传时会自动解析并缓存" }, "query": { "anyOf": [ { "type": "object", "properties": {}, "additionalProperties": true }, { "type": "string" } ], "description": "查询条件(对象或字符串,推荐对象)" }, "projection": { "anyOf": [ { "type": "object", "properties": {}, "additionalProperties": true }, { "type": "string" } ], "description": "返回字段投影,仅支持对象或对应 JSON 字符串,值只能是 1/0/true/false。合法示例:{\"_id\":1,\"name\":1,\"createdAt\":1}(包含)或 {\"password\":0}(排除)。不要传 [\"name\",\"age\"] 这类字段数组,也不要混用包含与排除(_id 除外)。" }, "sort": { "anyOf": [ { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string", "description": "sort 字段名" }, "direction": { "type": "number", "description": "排序方向,1:升序,-1:降序" } }, "required": [ "key", "direction" ], "additionalProperties": true } }, { "type": "string" } ], "description": "排序条件,仅支持数组 [{\"key\":\"createdAt\",\"direction\":-1}] 或对应 JSON 字符串。" }, "limit": { "type": "number", "description": "返回数量限制,整数,范围 1-1000,默认 100。超过 1000 会被 Cloud API MgoLimit lte 校验拒绝;请用 offset 分页。" }, "offset": { "type": "number", "description": "跳过的记录数" } }, "required": [ "collectionName" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "writeNoSqlDatabaseContent", "description": "修改 CloudBase NoSQL 数据库中的数据记录。支持插入、更新(含 $set/$inc/$push 等操作符)、删除、upsert 等操作,适用于管理端数据写入与运维。⚠️ 服务端写入不含 _openid:若集合依赖客户端 SDK(@cloudbase/js-sdk 或微信小程序 wx.cloud.database())的行级安全规则(如 doc._openid == auth.openid),服务端写入时需手动补充 _openid 字段,否则客户端将无法读取到该数据。⚠️ 部分更新嵌套字段须使用点号路径,如 `$set: {\"shipping.city\": \"guangzhou\"}`,直接传嵌套对象会覆盖整个字段。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "insert", "update", "delete" ], "description": "insert: 插入数据(新增文档)\nupdate: 更新数据\ndelete: 删除数据" }, "collectionName": { "type": "string", "description": "集合名称" }, "instanceId": { "type": "string", "description": "可选:显式指定数据库实例ID;未传时会自动解析并缓存" }, "documents": { "type": "array", "items": { "type": "object", "properties": {}, "additionalProperties": true }, "description": "要插入的文档对象数组,每个文档都是对象(insert 操作必填)" }, "query": { "anyOf": [ { "type": "object", "properties": {}, "additionalProperties": true }, { "type": "string" } ], "description": "查询条件(对象或字符串,推荐对象)(update/delete 操作必填)" }, "update": { "anyOf": [ { "type": "object", "properties": {}, "additionalProperties": true }, { "type": "string" } ], "description": "更新内容(对象或字符串,推荐对象)(update 操作必填)。按 MongoDB 更新语义传入 MgoUpdate:部分更新请使用 `$set`、`$inc`、`$unset`、`$push` 等操作符,例如使用 `$set` 更新 `status`;不要直接传\"字段到值的普通对象\",否则可能替换整条文档。\n\n⚠️ 嵌套字段必须用点号路径(如 `shipping.city`),禁止整对象替换:\n- ❌ 错误:{ \"$set\": { \"shipping\": { \"city\": \"guangzhou\" } } } — shipping 被整块替换,原有 address/province 等字段全部丢失\n- ✅ 正确:{ \"$set\": { \"shipping.city\": \"guangzhou\" } } — 仅更新 city,shipping 下其他字段保留" }, "isMulti": { "type": "boolean", "description": "是否更新多条记录(update/delete 操作可选)" }, "upsert": { "type": "boolean", "description": "是否在不存在时插入(update 操作可选)" } }, "required": [ "action", "collectionName" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageDataModel", "description": "数据模型查询工具,支持查询和列表数据模型(只读操作)。通过 action 参数区分操作类型:list=获取模型列表(不含Schema,可选 names 参数过滤),get=查询单个模型详情(含Schema字段列表、格式、关联关系等,需要提供 name 参数),docs=生成SDK使用文档(需要提供 name 参数)", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "get", "list", "docs" ], "description": "操作类型:get=查询单个模型(含Schema字段列表、格式、关联关系,需要提供 name 参数),list=获取模型列表(不含Schema,可选 names 参数过滤),docs=生成SDK使用文档(需要提供 name 参数)" }, "name": { "type": "string", "description": "要查询的数据模型名称。当 action='get' 或 action='docs' 时,此参数为必填项,必须提供已存在的数据模型名称。可通过 action='list' 操作获取可用的模型名称列表" }, "names": { "type": "array", "items": { "type": "string" }, "description": "模型名称数组(list操作时可选,用于过滤)" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "modifyDataModel", "description": "基于Mermaid classDiagram创建数据模型。为保持兼容性,工具名仍为 modifyDataModel;当前仅支持创建新模型,不支持更新现有模型结构。内置异步任务监控,自动轮询直至完成或超时。", "inputSchema": { "type": "object", "properties": { "mermaidDiagram": { "type": "string", "description": "Mermaid classDiagram代码,描述数据模型结构。\n示例:\nclassDiagram\n class Student {\n name: string <<姓名>>\n age: number = 18 <<年龄>>\n gender: x-enum = \"男\" <<性别>>\n classId: string <<班级ID>>\n identityId: string <<身份ID>>\n course: Course[] <<课程>>\n required() [\"name\"]\n unique() [\"name\"]\n enum_gender() [\"男\", \"女\"]\n display_field() \"name\"\n }\n class Class {\n className: string <<班级名称>>\n display_field() \"className\"\n }\n class Course {\n name: string <<课程名称>>\n students: Student[] <<学生>>\n display_field() \"name\"\n }\n class Identity {\n number: string <<证件号码>>\n display_field() \"number\"\n }\n\n %% 关联关系\n Student \"1\" --> \"1\" Identity : studentId\n Student \"n\" --> \"1\" Class : student2class\n Student \"n\" --> \"m\" Course : course\n Student \"n\" <-- \"m\" Course : students\n %% 类的命名\n note for Student \"学生模型\"\n note for Class \"班级模型\"\n note for Course \"课程模型\"\n note for Identity \"身份模型\"\n" }, "action": { "type": "string", "enum": [ "create" ], "default": "create", "description": "操作类型:create=创建新模型" }, "publish": { "type": "boolean", "default": false, "description": "是否立即发布模型" }, "dbInstanceType": { "type": "string", "enum": [ "MYSQL", "FLEXDB" ], "default": "MYSQL", "description": "数据库实例类型,可选值:MYSQL=MySQL 数据库,FLEXDB=文档型数据库(NoSQL)" } }, "required": [ "mermaidDiagram" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryPgDatabase", "description": "查询 CloudBase PostgreSQL 数据库。支持获取当前 PG 上下文、列出带 schema 的数据库对象、读取轻量元数据、检查单个对象结构,以及执行只读 SQL。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "context", "objects", "metadata", "schema", "sql" ], "description": "操作类型:context=获取当前 PostgreSQL 上下文;objects=列出带 schema 的数据库对象;metadata=获取轻量表元数据;schema=检查单个带 schema 的对象结构;sql=执行只读 SQL" }, "sql": { "type": "string", "description": "action=sql 时使用的只读 SQL" }, "objectName": { "type": "string", "description": "action=schema 时使用的带 schema 的 PostgreSQL 对象名,例如 public.users" }, "schema": { "type": "string", "description": "可选的 schema 过滤条件,用于 action=objects 或 action=metadata" }, "limit": { "type": "integer", "minimum": 1, "maximum": 200, "description": "可选的摘要数量上限,用于对象、元数据或 SQL 返回行数,默认 20,最大 200。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "managePgDatabase", "description": "管理 CloudBase PostgreSQL:执行已确认的写入 SQL、SQL 风险预检、迁移管理。建表/ALTER/DROP 等 schema 变更必须使用 applyMigration(显式 migrationVersion;成功前自动写入或校验本地 cloudbase/migrations/_.sql,与 CLI tcb db pg migration 一致),不要默认用 execute。execute 主要用于 DML 与 GRANT/RLS 等运维 SQL。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "execute", "dryRun", "planMigration", "applyMigration", "listMigrations", "migrationDetail", "describeMigrationTask", "fetchMigration", "rollbackMigration", "repairMigration" ], "description": "操作类型:execute=执行已确认的写入 SQL(DML/GRANT/RLS;schema DDL 默认拒绝,需 allowDdlViaExecute=true);dryRun=只分析 SQL 风险不执行;planMigration=预览迁移计划(需 migrationName + migrationVersion + sql;可选 includeAll=true 允许乱序,对齐 CLI --include-all);applyMigration=应用迁移,建表/改 schema 首选(需 migrationName + migrationVersion + sql + confirm=true;可选 includeAll;本地 SQL 缺失则自动写入 cloudbase/migrations/,内容不一致则 LOCAL_MIGRATION_FILE_MISMATCH fail-closed;成功返回前会轮询 DescribeTaskResult(默认最长 10 分钟,可用 taskPollTimeoutMs / waitForTask 调整)并校验 migrationVersion 已落入远端历史;超时返回 MIGRATION_TASK_TIMEOUT,必须先 describeMigrationTask 再 listMigrations,禁止立刻重推同 version;未落库时返回 success=false 且 errorCode=MIGRATION_NOT_APPLIED);listMigrations=查询已应用的 Migration 列表(可传 limit/offset 分页);migrationDetail=查看单条 Migration 详情(需 migrationVersion);describeMigrationTask=按 TaskId 查询 Push 异步任务状态(DescribeTaskResult:Status/Phase/Reason;需 taskId;用于 waitForTask=false / MIGRATION_TASK_TIMEOUT / 失败诊断,listMigrations 看不到 Reason);fetchMigration=从远端 history 拉取 SQL 写入本地 cloudbase/migrations/(对齐 CLI tcb db pg migration fetch;可选 migrationVersion 拉单条,省略则全量;force=true 覆盖已存在文件,默认跳过);rollbackMigration=回滚最近 N 条 Migration(需 lastN + confirm=true);repairMigration=修复 Migration 历史记录(需 migrationVersion + migrationName + repairStatus + repairReason)" }, "sql": { "type": "string", "description": "action=execute、dryRun、planMigration、applyMigration 或 repairMigration(applied) 使用的 SQL 语句" }, "confirm": { "type": "boolean", "description": "执行任何写入 SQL 前都需要显式设置为 true。" }, "envId": { "type": "string", "description": "可选的 CloudBase 环境 ID,不传时使用当前 MCP 环境。" }, "instanceId": { "type": "string", "description": "可选的 PostgreSQL 逻辑实例标识,默认 cloudbase-pg。" }, "defaultSchema": { "type": "string", "description": "可选的默认 schema,默认 public。" }, "role": { "type": "string", "description": "可选的 PostgreSQL role,传给 Manager SDK executePGSql 的 Role(平台会 SET ROLE)。默认 cloudbase_admin。推荐取值:cloudbase_admin / anon / authenticated / service_role。不要传 postgres、postgres_pgdb_* 或从环境名臆造的角色;不确定时省略本字段,或先用 cloudbase_admin 执行 SELECT rolname FROM pg_roles。" }, "objectName": { "type": "string", "description": "可选的对象名,当前仅用于非 migration 场景。migration 相关操作请使用 migrationName / migrationVersion / lastN。" }, "migrationName": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$", "description": "plan/apply/repair 必填:migration 名称,小写字母开头,仅允许小写字母、数字和下划线。" }, "migrationVersion": { "type": "string", "pattern": "^\\d{14}$", "description": "14 位时间戳 YYYYMMDDHHMMSS。plan/apply/detail/repair 必填;fetchMigration 可选(传入则只拉该条,省略则拉全量远端 history);禁止由服务端静默生成,避免与本地 cloudbase/migrations/_.sql 分叉。" }, "rollbackSql": { "type": "string", "description": "plan/apply 可选:回滚 SQL 语句。" }, "lastN": { "type": "integer", "exclusiveMinimum": 0, "description": "rollback 必填:回滚最近 N 条已应用的 Migration,正整数。" }, "limit": { "type": "integer", "minimum": 1, "maximum": 500, "description": "list 可选:返回数量上限,1-500,默认 100。" }, "offset": { "type": "integer", "minimum": 0, "description": "list 可选:分页偏移,默认 0。" }, "lockTimeoutMs": { "type": "integer", "description": "apply 可选:获取数据库锁的最长时间(毫秒),默认 5000。" }, "statementTimeoutMs": { "type": "integer", "description": "apply 可选:单条 SQL 执行最长时间(毫秒),默认 300000。" }, "taskPollTimeoutMs": { "type": "integer", "minimum": 5000, "maximum": 600000, "description": "apply 可选:轮询 DescribeTaskResult 的最长等待(毫秒)。默认 600000(与 CLI tcb db pg migration up 的 10 分钟对齐)。范围 5000-600000。超时后务必先 describeMigrationTask(taskId) 再 listMigrations,禁止立刻重推同 version。" }, "waitForTask": { "type": "boolean", "description": "apply 可选,默认 true。设为 false 时 Push 后立即返回 TaskId(errorCode=MIGRATION_TASK_PENDING),由调用方用 describeMigrationTask 轮询任务终态,再用 listMigrations 确认是否落库;适合 MCP host 工具调用超时较短的场景。默认 true 会同步等到任务终态。" }, "taskId": { "type": "string", "description": "describeMigrationTask 必填:PushPGUserMigrations / applyMigration 返回的 TaskId。用于一次性查询 DescribeTaskResult(Status/Phase/Reason),不轮询等待。" }, "repairStatus": { "type": "string", "enum": [ "applied", "reverted" ], "description": "repair 必填:applied=标记为已应用(可补录 Query),reverted=删除 history 记录。" }, "repairReason": { "type": "string", "description": "repair 必填:修复原因。" }, "force": { "type": "boolean", "description": "fetchMigration 可选,默认 false。true=覆盖本地已存在的同名 SQL 文件(对齐 CLI tcb db pg migration fetch --force);false=跳过已存在文件。用于从远端 history 重新对齐 Git checksum。" }, "includeAll": { "type": "boolean", "description": "planMigration / applyMigration 可选,默认 false。true=允许 out-of-order(version 小于远端 LatestVersion)仍可 Preview/Push,对齐 CLI tcb db pg migration up --include-all;仅在确认要补历史/乱序迁移时使用,日常应选更大的 migrationVersion。" }, "allowDdlViaExecute": { "type": "boolean", "description": "可选,默认 false。仅当需要故意绕过 migration history 时设为 true,才允许 schema DDL 走 execute;正常建表/改 schema 必须用 applyMigration。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryPgStorage", "description": "查询 CloudBase PostgreSQL 环境下的云存储能力。返回 bucket/config 能力摘要、对象信息查询方案,以及基于 HTTP API 或 SDK 的上传实现方案;不会读取本地文件,也不会默认输出大量签名 URL。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "buckets", "config", "uploadPlan", "objectInfo", "signUpload", "signDownload", "createBucket" ], "description": "操作类型:buckets/config=查询存储能力摘要;createBucket=生成 bucket 创建方案(SQL/HTTP API/CLI);uploadPlan=生成 HTTP API/SDK 上传方案;objectInfo=生成对象元信息查询方案;signUpload/signDownload=显式的一次性签名 URL 请求占位" }, "bucket": { "type": "string", "description": "云存储 bucket 名称" }, "objectKey": { "type": "string", "description": "单个对象 key" }, "objectKeys": { "type": "array", "items": { "type": "string" }, "description": "多个对象 key,用于对象元信息查询规划" }, "objects": { "type": "array", "items": { "type": "object", "properties": { "objectKey": { "type": "string" }, "contentType": { "type": "string" }, "sizeBytes": { "type": "integer", "minimum": 0 } }, "required": [ "objectKey" ], "additionalProperties": false }, "description": "待上传对象的元信息。文件字节内容不会通过 MCP 传递。" }, "expiresIn": { "type": "integer", "minimum": 60, "maximum": 86400, "description": "签名 URL 有效期,单位秒,范围 60 到 86400。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryMysqlDatabase", "description": "查询 CloudBase MySQL 数据库信息。支持执行只读 SQL、查询 MySQL 开通结果、查询 MySQL 任务状态,以及获取当前实例生命周期上下文。标准 getInstanceInfo/describeInstance 不返回连接凭据;仅 getConnectionInfo 透传原始连接/集群载荷(含可能的凭据),且仅用于显式 TCP 迁移。业务 CRUD 优先使用 SDK 或 runQuery/runStatement。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "runQuery", "describeCreateResult", "describeTaskStatus", "getInstanceInfo", "describeInstance", "getConnectionInfo" ], "description": "runQuery=execute read-only SQL; describeCreateResult=query CreateMySQL result; describeTaskStatus=query MySQL task status; getInstanceInfo=get lifecycle context without connection credentials; describeInstance=alias of getInstanceInfo; getConnectionInfo=passthrough raw connection/cluster payload including possible credentials (TCP migration exception only)" }, "sql": { "type": "string", "description": "Read-only SQL used by action=runQuery" }, "request": { "type": "object", "additionalProperties": {}, "description": "Official request payload used by describeCreateResult/describeTaskStatus" }, "dbInstance": { "type": "object", "properties": { "instanceId": { "type": "string" }, "schema": { "type": "string" } }, "additionalProperties": false, "description": "Optional SQL database instance context for runQuery" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageMysqlDatabase", "description": "管理 CloudBase MySQL 数据库资源。支持开通 MySQL、销毁 MySQL、执行写入 SQL/DDL,以及初始化数据库 Schema。注意:必须先开通 MySQL(action=provisionMySQL,confirm=true)才能执行 runStatement 或 initializeSchema。若 MySQL 尚未开通,工具会返回 MYSQL_NOT_CREATED 并给出开通的 nextAction 提示。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "provisionMySQL", "destroyMySQL", "runStatement", "initializeSchema" ], "description": "provisionMySQL=create MySQL instance; destroyMySQL=destroy MySQL instance; runStatement=execute write SQL or DDL; initializeSchema=run ordered schema initialization statements" }, "confirm": { "type": "boolean", "description": "Explicit confirmation required for action=provisionMySQL or action=destroyMySQL" }, "sql": { "type": "string", "description": "SQL statement used by action=runStatement" }, "request": { "type": "object", "additionalProperties": {}, "description": "Official request payload used by action=provisionMySQL or action=destroyMySQL" }, "statements": { "type": "array", "items": { "type": "string" }, "description": "Ordered schema initialization SQL statements used by action=initializeSchema" }, "requireReady": { "type": "boolean", "description": "Whether initializeSchema should block until MySQL is confirmed ready. Defaults to true." }, "statusContext": { "type": "object", "properties": { "createResultRequest": { "type": "object", "additionalProperties": {} }, "taskStatusRequest": { "type": "object", "additionalProperties": {} } }, "additionalProperties": false, "description": "Optional provisioning status requests used to confirm readiness before initializeSchema" }, "dbInstance": { "type": "object", "properties": { "instanceId": { "type": "string" }, "schema": { "type": "string" } }, "additionalProperties": false, "description": "Optional SQL database instance context for runStatement/initializeSchema" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryFunctions", "description": "CloudBase 云函数统一只读入口。通过更自解释的 action 查询 CloudBase 云函数列表、函数详情、执行日志、层、触发器和代码下载地址。\n\n**分页说明**:`listFunctions`、`listLayers` 支持 `limit` 和 `offset` 参数。\n- `limit`: 分页数量,默认值由后端决定\n- `offset`: 分页偏移,从 0 开始\n- 示例:`queryFunctions(action=\"listFunctions\", offset=10, limit=10)`\n\n**查询 CloudBase 云函数日志**:使用 `action=\"listFunctionLogs\"`,需要提供 `functionName` 参数。\n- 示例:`queryFunctions(action=\"listFunctionLogs\", functionName=\"my-function\")`\n- 如需查看日志详情:`queryFunctions(action=\"getFunctionLogDetail\", requestId=\"xxx\")`\n\n**定时任务 / cron / 定时跑**:使用 `listFunctionTriggers` 查询函数的 timer 触发器配置。\n\n**层(Layer)说明**:\n- 层为 SCF 账号级共享命名空间:不同环境创建同名层会共享同一层的版本序列;删除某版本会影响所有绑定该版本的环境的函数\n- 创建层必须用带环境标识的唯一层名,固定格式:`{layerName}_{当前envId}`(如 `common_cloud1-d9ghadgak3edf6b36`)。不要在不同环境使用相同裸层名,创建前先 `listLayers` 查重\n- `listLayers` / `listLayerVersions` / `getLayerVersionDetail` 返回账号级视图,可能含其他环境创建的层\n\n**区分 `queryLogs` 工具**:\n- 本工具用于查询特定 CloudBase 云函数的执行日志\n- `queryLogs` 工具用于搜索 CLS 日志服务(跨服务日志聚合)", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "listFunctions", "getFunctionDetail", "listFunctionLogs", "getFunctionLogDetail", "listFunctionLayers", "listLayers", "listLayerVersions", "getLayerVersionDetail", "listFunctionTriggers", "getFunctionDownloadUrl" ], "description": "只读操作类型:\n- `listFunctions`: 列出所有 CloudBase 云函数\n- `getFunctionDetail`: 获取 CloudBase 云函数详情(需要 functionName)\n- `listFunctionLogs`: 查询 CloudBase 云函数执行日志(需要 functionName)\n- `getFunctionLogDetail`: 获取日志详情(需要 requestId)\n- `listFunctionLayers`: 列出函数绑定的层\n- `listLayers`: 列出所有层(账号级视图,含其他环境创建的层)\n- `listLayerVersions`: 列出层的版本(注意:是 Versions 不是 Version;账号级视图)\n- `getLayerVersionDetail`: 获取层版本详情(账号级视图)\n- `listFunctionTriggers`: 列出函数触发器(用于查看定时任务 / cron / timer 配置)\n- `getFunctionDownloadUrl`: 获取函数代码下载地址" }, "functionName": { "type": "string", "description": "CloudBase 云函数名称。`getFunctionDetail`、`listFunctionLogs`、`listFunctionLayers`、`listFunctionTriggers`、`getFunctionDownloadUrl` 时必填" }, "limit": { "type": "number", "description": "分页数量(limit)。列表类 action 可选,默认值由后端决定" }, "offset": { "type": "number", "description": "分页偏移(offset)。列表类 action 可选,默认 0" }, "codeSecret": { "type": "string", "description": "代码保护密钥,用于解密函数代码" }, "startTime": { "type": "string", "description": "日志查询开始时间,格式必须为 YYYY-MM-DD HH:mm:ss(如 2024-01-01 00:00:00)。与 endTime 间隔不能超过一天。不传时默认查询最近一天" }, "endTime": { "type": "string", "description": "日志查询结束时间,格式必须为 YYYY-MM-DD HH:mm:ss(如 2024-01-01 23:59:59)。与 startTime 间隔不能超过一天。不传时默认为当前时间" }, "requestId": { "type": "string", "description": "日志请求 ID。`getFunctionLogDetail` 操作必填,可从 `listFunctionLogs` 结果中获取" }, "qualifier": { "type": "string", "description": "函数版本别名,如 $LATEST、$DEFAULT。日志查询时可选" }, "runtime": { "type": "string", "description": "层查询的运行时筛选,如 Nodejs18.15" }, "searchKey": { "type": "string", "description": "层名称搜索关键字" }, "layerName": { "type": "string", "description": "层名称。`listLayerVersions`、`getLayerVersionDetail` 操作必填。层为账号级共享命名空间;推荐固定格式 `{layerName}_{当前envId}`(如 common_cloud1-d9ghadgak3edf6b36)" }, "layerVersion": { "type": "number", "description": "层版本号。`getLayerVersionDetail` 操作必填" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageFunctions", "description": "CloudBase 云函数统一写入口。支持创建函数、更新代码、更新配置、调用函数、管理定时跑 / 定时任务 / scheduled job 的 timer 触发器和层绑定。如果要创建 cron 定时任务,先用 createFunction 创建函数,再用 createFunctionTrigger 创建 timer 触发器(支持7段cron表达式),deleteFunctionTrigger 删除触发器。镜像部署(Runtime=CustomImage):先把代码经 zip→COS→CloudApp custom 构建→TCR 推镜像(这一阶段为裸腾讯云 API,本工具不覆盖),再用 createFunction(func.runtime=\"CustomImage\", imageConfig) 基于 TCR 镜像创建 HTTP 函数;后续迭代用 updateFunctionCode + imageConfig 换镜像 tag。危险操作需要显式 confirm=true。\n\n**层(Layer)说明**:\n- 层为 SCF 账号级共享命名空间:不同环境创建同名层会共享同一层的版本序列;删除某版本会影响所有绑定该版本的环境的函数\n- 创建层必须用带环境标识的唯一层名,固定格式:`{layerName}_{当前envId}`(如 `common_cloud1-d9ghadgak3edf6b36`)。不要在不同环境使用相同裸层名,创建前先 `listLayers` 查重\n- 相关 action:`createLayerVersion` / `deleteLayerVersion` / `attachLayer` / `detachLayer` / `updateFunctionLayers`(只读查询见 queryFunctions 的 listLayers / listLayerVersions / getLayerVersionDetail)", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "createFunction", "updateFunctionCode", "updateFunctionConfig", "invokeFunction", "deleteFunction", "createFunctionTrigger", "deleteFunctionTrigger", "createLayerVersion", "deleteLayerVersion", "attachLayer", "detachLayer", "updateFunctionLayers", "incrementalDeployFunction" ], "description": "写操作类型,例如 createFunction、updateFunctionCode、incrementalDeployFunction、invokeFunction、deleteFunction、createFunctionTrigger(定时任务 / cron / timer)、deleteFunctionTrigger、createLayerVersion、deleteLayerVersion、attachLayer、detachLayer、updateFunctionLayers。层名推荐固定格式 `{layerName}_{当前envId}`(如 common_cloud1-d9ghadgak3edf6b36)" }, "func": { "type": "object", "properties": { "name": { "type": "string", "description": "函数名称" }, "type": { "type": "string", "enum": [ "Event", "HTTP" ], "description": "函数类型" }, "protocolType": { "type": "string", "enum": [ "WS" ], "description": "HTTP 函数访问协议,当前仅支持 WebSockets,取值为 WS(配合 protocolParams.wsParams 使用)。普通 HTTP 函数不要传此字段;传其他值(如 HTTP)会报 InvalidParameterValue.ProtocolType。" }, "protocolParams": { "type": "object", "properties": { "wsParams": { "type": "object", "properties": { "idleTimeOut": { "type": "number", "description": "WebSocket 空闲超时时间(秒)" } }, "additionalProperties": false } }, "additionalProperties": false }, "instanceConcurrencyConfig": { "type": "object", "properties": { "dynamicEnabled": { "type": "boolean" }, "maxConcurrency": { "type": "number" } }, "additionalProperties": false }, "timeout": { "type": "number", "description": "函数超时时间" }, "envVariables": { "type": "object", "additionalProperties": { "type": "string" }, "description": "环境变量。若包含 DATABASE_URL / MYSQL_* / POSTGRES_* / REDIS_* 等传统 TCP 连库变量,必须同时配置 vpc(vpcId+subnetId),且 ID 必须来自真实库/网络信息,禁止猜测。原生 app.rdb()/app.database() 不需要 VPC。" }, "vpc": { "type": "object", "properties": { "vpcId": { "type": "string", "description": "VPC ID from the real database/network console (e.g. vpc-xxxxxxxx). Required for non-native TCP DB access. Do NOT invent or use placeholders." }, "subnetId": { "type": "string", "description": "Subnet ID in the same VPC as the private DB endpoint (e.g. subnet-xxxxxxxx). Do NOT invent or use placeholders." } }, "required": [ "vpcId", "subnetId" ], "additionalProperties": false, "description": "私有网络配置(出网)。非原生 SDK、用 TCP 访问 VPC 内 MySQL/PostgreSQL/Redis 时必填。vpcId/subnetId 必须与数据库内网 VPC 一致;未知时先查控制台或询问用户,禁止填占位符。" }, "runtime": { "type": "string", "description": "运行时环境。Event 函数支持多种运行时:\n Nodejs: Nodejs20.19, Nodejs18.15, Nodejs16.13, Nodejs14.18, Nodejs12.16, Nodejs10.15, Nodejs8.9\n Python: Python3.10, Python3.9, Python3.7, Python3.6, Python2.7\n Php: Php8.0, Php7.4, Php7.2\n Java: Java8, Java11\n Golang: Golang1\n\n推荐运行时:\n Node.js: Nodejs18.15\n Python: Python3.9\n PHP: Php7.4\n Java: Java11\n Go: Golang1\n\n镜像部署(基于 TCR 镜像创建函数)时填 \"CustomImage\",并提供 imageConfig;此时无需 functionRootPath/zipFile。" }, "imageConfig": { "type": "object", "properties": { "imageType": { "type": "string", "enum": [ "enterprise", "personal" ], "description": "镜像仓库类型:enterprise(企业版 TCR)或 personal(个人版)。省略时默认 enterprise。" }, "imageUri": { "type": "string", "description": "完整镜像地址(必须含 tag),格式 {domain}/{namespace}/{image}:{tag},例如 ccr.ccs.tencentyun.com/your-ns/demo-app:demo-app-001。不要使用 :latest。" }, "registryId": { "type": "string", "description": "TCR 实例 ID,形如 tcr-xxxxxxxx。imageType=enterprise 时必填。" }, "command": { "type": "string", "description": "覆盖镜像 ENTRYPOINT。不填则使用 Dockerfile 默认值,例如 python。" }, "args": { "type": "string", "description": "覆盖镜像 CMD,空格分隔,例如 -u app.py。" }, "entryPoint": { "type": "string", "description": "镜像入口点,一般不需要单独设置。" }, "imagePort": { "type": "number", "description": "容器监听端口。Web Server 函数填 9000(默认),Job 型镜像填 -1。" }, "containerImageAccelerate": { "type": "boolean", "description": "是否开启镜像加速。镜像较大时建议开启以缩短冷启动时间。" } }, "required": [ "imageUri" ], "additionalProperties": false, "description": "镜像部署配置(仅 runtime=CustomImage 时使用)。用于 zip→COS→CloudApp custom 构建→TCR→SCF 的「阶段 B」:基于已推送到 TCR 的镜像创建 HTTP 函数。传入 imageConfig 后即按镜像部署处理,函数无需打包本地代码、scf_bootstrap 或 Handler。" }, "triggers": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string", "description": "触发器名称" }, "type": { "type": "string", "enum": [ "timer" ], "description": "触发器类型" }, "config": { "type": "string", "description": "触发器配置。timer 必须使用 CloudBase 7 段 cron 格式:秒 分 时 日 月 星期 年。⚠️ 不支持标准 5 段 cron(如 */5 * * * * 是错误的)。正确示例:0 */5 * * * * *(每5分钟)、0 0 2 1 * * *(每月1号2点)、0 30 9 * * * *(每天9:30)" } }, "required": [ "name", "type", "config" ], "additionalProperties": false }, "description": "触发器配置数组" }, "handler": { "type": "string", "description": "函数入口" }, "ignore": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ], "description": "忽略文件" }, "isWaitInstall": { "type": "boolean", "description": "是否等待依赖安装" }, "layers": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "version": { "type": "number" } }, "required": [ "name", "version" ], "additionalProperties": false }, "description": "Layer 配置" } }, "required": [ "name" ], "additionalProperties": false, "description": "createFunction 操作的函数配置" }, "functionRootPath": { "type": "string", "description": "创建或更新函数代码时默认推荐的本地目录方式。必须是直接包含函数文件夹的目录绝对路径(如 /abs/path/cloudfunctions 或 /abs/path/functions),不要传项目根目录(如 /abs/path),也不要传到函数名子目录(如 /abs/path/cloudfunctions/hello)。本地应按 cloudfunctions//index.js 或 functions//index.js 布局,此参数传 cloudfunctions 或 functions 目录的绝对路径。SDK 会自动拼接函数名子目录,无需预先压缩 zip 或 base64 编码。" }, "force": { "type": "boolean", "description": "createFunction 时是否覆盖" }, "functionName": { "type": "string", "description": "目标函数名称(顶层)。updateFunctionCode / updateFunctionConfig / invokeFunction 等 action 使用此字段。不要只写在 func.name:createFunction 用 func.name,其它 action 用顶层 functionName。若误传 func.name,也会被识别为 functionName。" }, "zipFile": { "type": "string", "description": "仅兼容特殊场景:预先准备好的代码包 base64 编码。普通 createFunction/updateFunctionCode 默认不要先压缩 zip,优先使用 functionRootPath。" }, "handler": { "type": "string", "description": "函数入口" }, "timeout": { "type": "number", "description": "配置更新时的超时时间" }, "envVariables": { "type": "object", "additionalProperties": { "type": "string" }, "description": "配置更新时要合并的环境变量。若含 DATABASE_URL / MYSQL_* / POSTGRES_* / REDIS_* 等 TCP 连库变量,必须同时提供真实 vpc(或函数已绑定完整 VPC)。禁止猜测 vpcId/subnetId。" }, "vpc": { "$ref": "#/properties/func/properties/vpc", "description": "配置更新时的 VPC 信息。非原生 TCP 连库场景必填真实 vpcId+subnetId;不要用占位符。" }, "params": { "type": "object", "additionalProperties": {}, "description": "invokeFunction 的调用参数" }, "triggers": { "type": "array", "items": { "$ref": "#/properties/func/properties/triggers/items" }, "description": "createFunctionTrigger 的触发器列表,用于定时跑 / 定时任务 / scheduled job。timer 触发器使用7段 cron 表达式(秒 分 时 日 月 星期 年),如 \"0 */5 * * * * *\" 表示每5分钟执行一次" }, "triggerName": { "type": "string", "description": "deleteFunctionTrigger 的目标触发器名称" }, "layerName": { "type": "string", "description": "层名称。创建层推荐固定格式 `{layerName}_{当前envId}`(如 common_cloud1-d9ghadgak3edf6b36);不要跨环境复用裸层名。层为账号级共享命名空间" }, "layerVersion": { "type": "number", "description": "层版本号" }, "contentPath": { "type": "string", "description": "层内容路径,可为目录或 ZIP 文件" }, "base64Content": { "type": "string", "description": "层内容的 base64 编码" }, "runtimes": { "type": "array", "items": { "type": "string" }, "description": "层适用的运行时列表" }, "description": { "type": "string", "description": "层版本描述" }, "licenseInfo": { "type": "string", "description": "层许可证信息" }, "layers": { "type": "array", "items": { "type": "object", "properties": { "layerName": { "type": "string", "description": "层名称" }, "layerVersion": { "type": "number", "description": "层版本号" } }, "required": [ "layerName", "layerVersion" ], "additionalProperties": false }, "description": "updateFunctionLayers 的目标层列表,顺序即最终顺序" }, "codeSecret": { "type": "string", "description": "层绑定时的代码保护密钥" }, "imageConfig": { "$ref": "#/properties/func/properties/imageConfig", "description": "镜像部署配置(Runtime=CustomImage)。createFunction 时基于 TCR 镜像创建 HTTP 函数,updateFunctionCode 时仅更换镜像 tag。需提供 imageUri(含 tag),企业版 TCR 还需 registryId。也可在 func.imageConfig 中提供;两处都传时以顶层 imageConfig 优先。" }, "confirm": { "type": "boolean", "description": "危险操作确认开关。deleteFunction、deleteFunctionTrigger、deleteLayerVersion、detachLayer 等删除类操作需要显式传入 confirm=true" }, "incrementalFile": { "type": "string", "description": "incrementalDeployFunction 增量部署时的变更文件路径" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryHosting", "description": "查询 CloudBase 静态托管的只读信息。适合 AI 先做发现再决定下一步:action=websiteConfig 查询首页/错误页/路由规则与站点域名信息;action=status 查询托管服务状态;action=findFiles 按前缀查找文件;action=listFiles 列出全部托管文件;action=domainStatus 查询自定义域名的当前状态与配置。该工具不会产生任何副作用。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "websiteConfig", "status", "findFiles", "listFiles", "domainStatus" ], "description": "查询类型:websiteConfig=查询静态托管网站文档配置与站点域名信息,status=查询静态托管服务状态,findFiles=按前缀查找托管文件,listFiles=列出静态托管中的全部文件,domainStatus=查询自定义域名配置与生效状态。该工具严格只读,不会修改任何资源。" }, "prefix": { "type": "string", "description": "文件前缀过滤条件。仅 action=findFiles 时使用,例如 app/ 或 assets/logo。" }, "marker": { "type": "string", "description": "分页起始标记。仅 action=findFiles 时使用,用于续查上一页之后的结果。" }, "maxKeys": { "type": "integer", "exclusiveMinimum": 0, "description": "单次返回的最大文件条数。仅 action=findFiles 时使用。" }, "domains": { "type": "array", "items": { "type": "string" }, "description": "要查询的自定义域名列表。仅 action=domainStatus 时使用,例如 [\"www.example.com\"]。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageHosting", "description": "管理 CloudBase 静态托管的变更操作。action=upload 上传本地构建产物到共享域名(域名格式:-.tcloudbaseapp.com/);action=delete 删除托管文件或目录(必须 confirm=true);action=setWebsiteDocument 设置首页/错误页/路由规则;action=enableService 开通静态托管;action=bindDomain / unbindDomain / updateDomain 管理自定义域名;action=downloadFile / downloadDirectory 下载托管内容到本地。⚠️ 本工具没有关闭默认域名(*.tcloudbaseapp.com)的 action;要禁用该默认公网域名,请用 manageGateway(action=\"disableRoute\", domain=该 STATIC_STORE IsDefault 域名, path=\"/\")(底层 ModifyHTTPServiceRoute,不是 ModifyGatewayRoute)。⚠️ 新项目部署优先使用 manageApps(部署到独立子域名),本工具适合已有老项目继续使用或作为 manageApps 的 fallback。manageApps 与 manageHosting 域名不同,切换会导致老链接失效。若任务只是查看配置、文件或域名状态,请改用 queryHosting。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "upload", "delete", "setWebsiteDocument", "enableService", "bindDomain", "unbindDomain", "updateDomain", "downloadFile", "downloadDirectory" ], "description": "管理类型:upload=上传本地构建产物到静态托管,delete=删除静态托管文件或目录,setWebsiteDocument=设置首页/错误页/路由规则,enableService=开通静态托管服务,bindDomain=绑定自定义域名,unbindDomain=解绑自定义域名,updateDomain=更新域名缓存/防盗链/IP 规则,downloadFile=下载单个托管文件到本地,downloadDirectory=下载托管目录到本地。" }, "localPath": { "type": "string", "description": "本地路径。action=upload 时表示要上传的本地文件/目录路径;action=downloadFile 或 downloadDirectory 时表示下载到本地的目标路径。建议传绝对路径。" }, "cloudPath": { "type": "string", "description": "静态托管中的目标路径。action=upload 时表示上传后的托管路径;action=delete/downloadFile/downloadDirectory 时表示托管侧文件或目录路径。" }, "files": { "type": "array", "items": { "type": "object", "properties": { "localPath": { "type": "string", "description": "单个待上传文件的本地绝对路径。" }, "cloudPath": { "type": "string", "description": "该文件上传到静态托管后的托管路径。" } }, "required": [ "localPath", "cloudPath" ], "additionalProperties": false }, "default": [], "description": "多文件上传配置。仅 action=upload 时可选;传入后会逐项上传,不再依赖单个 localPath/cloudPath。" }, "ignore": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ], "description": "上传时忽略的文件模式。仅 action=upload 时可选,例如 node_modules 或 [\"**/*.map\", \"**/.DS_Store\"]。" }, "isDir": { "type": "boolean", "default": false, "description": "是否把 cloudPath 视为目录。仅 action=delete 时使用;true=删除目录,false=删除单个文件。" }, "confirm": { "type": "boolean", "default": false, "description": "高风险操作确认开关。action=delete 和 action=unbindDomain 时必须显式传 true,避免误删文件或误解绑域名。" }, "indexDocument": { "type": "string", "description": "网站首页文档名称。仅 action=setWebsiteDocument 时必填,例如 index.html。" }, "errorDocument": { "type": "string", "description": "错误页文档名称。仅 action=setWebsiteDocument 时可选,例如 404.html。" }, "routingRules": { "type": "array", "items": { "type": "object", "properties": { "keyPrefixEquals": { "type": "string", "description": "匹配前缀规则,例如 app/ 或 assets/。与 httpErrorCodeReturnedEquals 二选一或按 CloudBase 规则组合使用。" }, "httpErrorCodeReturnedEquals": { "type": "string", "description": "匹配 HTTP 错误码,例如 404。SPA 回退常用 404。" }, "replaceKeyWith": { "type": "string", "description": "把匹配结果替换为固定文件路径,例如 index.html。" }, "replaceKeyPrefixWith": { "type": "string", "description": "把匹配前缀替换成新的前缀路径。" } }, "additionalProperties": false }, "description": "网站路由规则列表。仅 action=setWebsiteDocument 时可选。SPA 常见配置是将 404 重写到 index.html。" }, "domain": { "type": "string", "description": "自定义域名。action=bindDomain / unbindDomain / updateDomain 时使用,例如 www.example.com。" }, "certId": { "type": "string", "description": "证书 ID。仅 action=bindDomain 时必填。" }, "domainId": { "type": "number", "description": "域名 ID。仅 action=updateDomain 时必填,用于精确更新指定域名配置。" }, "domainConfig": { "type": "object", "properties": { "Refer": { "type": "object", "properties": { "Switch": { "type": "string", "enum": [ "on", "off" ], "description": "Referer 防盗链开关:on=开启,off=关闭。" }, "RefererRules": { "type": "array", "items": { "type": "object", "properties": { "RefererType": { "type": "string", "enum": [ "blacklist", "whitelist" ], "description": "Referer 规则类型:blacklist=黑名单,whitelist=白名单。" }, "Referers": { "type": "array", "items": { "type": "string" }, "description": "Referer 规则值列表。" }, "AllowEmpty": { "type": "boolean", "description": "是否允许空 Referer。" } }, "required": [ "RefererType", "Referers", "AllowEmpty" ], "additionalProperties": false }, "description": "Referer 规则列表。" } }, "required": [ "Switch" ], "additionalProperties": false, "description": "Referer 防盗链配置。" }, "Cache": { "type": "array", "items": { "type": "object", "properties": { "RuleType": { "type": "string", "enum": [ "fileType", "path" ], "description": "缓存规则类型:fileType=文件类型,path=路径。" }, "RuleValue": { "type": "string", "description": "规则匹配值。" }, "CacheTtl": { "type": "number", "description": "缓存 TTL,单位秒。" } }, "required": [ "RuleType", "RuleValue", "CacheTtl" ], "additionalProperties": false }, "description": "CDN 缓存规则列表。" }, "IpFilter": { "type": "object", "properties": { "Switch": { "type": "string", "enum": [ "on", "off" ], "description": "IP 访问控制开关:on=开启,off=关闭。" }, "FilterType": { "type": "string", "enum": [ "blacklist", "whitelist" ], "description": "过滤类型:blacklist=黑名单,whitelist=白名单。" }, "Filters": { "type": "array", "items": { "type": "string" }, "description": "IP 规则列表。" } }, "required": [ "Switch" ], "additionalProperties": false, "description": "IP 访问控制配置。" }, "IpFreqLimit": { "type": "object", "properties": { "Switch": { "type": "string", "enum": [ "on", "off" ], "description": "IP 频控开关:on=开启,off=关闭。" }, "Qps": { "type": "number", "description": "每个 IP 的 QPS 上限。" } }, "required": [ "Switch" ], "additionalProperties": false, "description": "IP 频控配置。" } }, "additionalProperties": false, "description": "域名配置。仅 action=updateDomain 时必填,支持缓存、Referer、防盗链、IP 规则与频控。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryStorage", "description": "⚠️ PG 模式环境请使用 queryPgStorage 而非本工具(pgstore 与旧 COS 是两套独立系统)。\n\n查询 CloudBase 云存储信息,支持列出目录文件、获取文件信息、获取临时下载链接等只读操作。返回的文件信息包括文件名、大小、修改时间、下载链接等。注意:action=url 返回的 temporaryUrl 是临时签名链接,有效期由 maxAge 参数决定(默认1小时),不要当作永久公网地址使用。工具还会基于 DescribeEnvs 返回的 Storages[0].CdnDomain 推导 publicUrl,⚠️ 警告:publicUrl 仅在存储桶 ACL 为公有读(所有用户可读)时才能被匿名访问;默认私有读写存储桶返回的 publicUrl 会 403,此时请继续使用 temporaryUrl 或先通过控制台/SDK 将目标路径设置为公有读。\n\n💡 存储桶 ACL 权限管理请使用 permissions 工具:queryPermissions(action=\"getResourcePermission\", resourceType=\"storage\", resourceId=\"bucket-name\") 查询,managePermissions(action=\"updateResourcePermission\", resourceType=\"storage\", resourceId=\"bucket-name\", permission=\"READONLY\") 设置。\n\n📦 CloudBase PG / pgstore 环境:`DescribeEnvs.Storages[]` 列出的 bucket 是旧 NoSQL 后端的,不等于 pgstore bucket。本工具用于查看常规存储;为 PG 浏览器上传准备 bucket 时,请确认目标 bucket 是 pgstore 后端可用的,否则浏览器 `app.storage.from().upload(...)` 会得到 `STORAGE_BUCKET_NOT_FOUND` 并出现 `PUT https://undefined/`。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "list", "info", "url", "read" ], "description": "查询操作类型:list=列出目录下的所有文件,info=获取指定文件的详细信息,url=获取文件的临时下载链接,read=读取文本文件内容" }, "cloudPath": { "type": "string", "description": "云端文件路径,例如 files/data.txt 或 files/(目录)" }, "maxAge": { "type": "number", "minimum": 1, "maximum": 86400, "default": 3600, "description": "临时链接有效期,单位为秒,取值范围:1-86400,默认值:3600(1小时)" } }, "required": [ "action", "cloudPath" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageStorage", "description": "⚠️ PG 模式环境请使用 queryPgStorage 而非本工具(pgstore 与旧 COS 是两套独立系统)。\n\n管理 CloudBase 云存储文件,仅用于 COS/Storage 对象,不用于静态网站托管。支持上传文件/目录、下载文件/目录、删除文件/目录等操作。删除操作需要设置force=true进行确认,防止误删除重要文件。注意:上传后返回的 temporaryUrl 是临时签名链接,1小时后过期,不要当作永久公网地址写入配置或持久化存储。工具还会基于 DescribeEnvs 返回的 Storages[0].CdnDomain 推导 publicUrl,⚠️ 警告:publicUrl 仅在存储桶 ACL 为公有读(所有用户可读)时才能被匿名访问;默认私有读写存储桶返回的 publicUrl 会 403,此时请继续使用 temporaryUrl 或先通过控制台/SDK 将目标路径设置为公有读。\n\n💡 存储桶 ACL 权限管理请使用 permissions 工具:queryPermissions(action=\"getResourcePermission\", resourceType=\"storage\", resourceId=\"bucket-name\") 查询,managePermissions(action=\"updateResourcePermission\", resourceType=\"storage\", resourceId=\"bucket-name\", permission=\"READONLY\") 设置。\n\n📦 CloudBase PG / pgstore 桶必须先创建后使用(与 Supabase Storage 一致:upload 前 bucket 必须存在)。浏览器 SDK `app.storage.from().upload(path, file)` 不会自动建桶,且 `path` 的第一段就是 bucket 名(例如 `covers/foo.png` → bucket=`covers`);`from('covers')` 这个参数当前不会被拼到 path 里。如果上传时浏览器看到 `STORAGE_BUCKET_NOT_FOUND` 或 `PUT https://undefined/`(DevTools 表现为 `net::ERR_NAME_NOT_RESOLVED`),先用本工具或控制台确认 / 创建对应的 pgstore bucket,再让前端重试上传,不要让前端把上传失败静默吞掉。`DescribeEnvs.Storages[]` 返回的旧 NoSQL bucket(形如 `--`)不是可用的 pgstore bucket,切勿当作默认目标使用。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "upload", "download", "delete" ], "description": "管理操作类型:upload=上传文件或目录,download=下载文件或目录,delete=删除文件或目录" }, "localPath": { "type": "string", "description": "本地文件路径,建议传入绝对路径,例如 /tmp/files/data.txt;upload/download 操作时必填,delete 操作时不需要传该参数" }, "cloudPath": { "type": "string", "description": "云端文件路径,例如 files/data.txt" }, "force": { "type": "boolean", "default": false, "description": "强制操作开关,删除操作时建议设置为true以确认删除,默认false" }, "isDirectory": { "type": "boolean", "default": false, "description": "是否为目录操作,true=目录操作,false=文件操作,默认false" } }, "required": [ "action", "cloudPath" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "downloadTemplate", "description": "自动下载并部署CloudBase项目模板。\n**Note**: Call this tool when the user requests to create a new project using a CloudBase template.\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置\n- cursor: Cursor AI编辑器\n- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:2.28.1),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)", "inputSchema": { "type": "object", "properties": { "template": { "type": "string", "enum": [ "react", "vue", "miniprogram", "uniapp", "rules" ], "description": "要下载的模板类型" }, "ide": { "type": "string", "enum": [ "all", "cursor", "windsurf", "codebuddy", "claude-code", "cline", "gemini-cli", "opencode", "qwen-code", "baidu-comate", "openai-codex-cli", "augment-code", "github-copilot", "roocode", "tongyi-lingma", "trae", "qoder", "antigravity", "vscode", "kiro", "aider", "iflow-cli" ], "description": "指定要下载的IDE类型。" }, "overwrite": { "type": "boolean", "description": "是否覆盖已存在的文件,默认为false(不覆盖)" } }, "required": [ "template", "ide" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "searchKnowledgeBase", "description": "云开发知识库智能检索工具,支持向量查询 (vector)、固定技能文档 (skill)、OpenAPI 文档 (openapi) 和 CloudBase 官方文档 (docs) 查询。\n\n 强烈推荐始终优先使用固定技能文档 (skill)、OpenAPI 文档 (openapi) 或 CloudBase 官方文档 (docs) 模式进行检索,仅当固定文档无法覆盖你的问题时,再使用向量查询 (vector) 模式。\n\n ⚠️ 重要:当 CloudBase skills 处于禁用状态或当前 IDE 不支持 skill 文件读取时,必须使用 searchKnowledgeBase(mode=skill, skillName=...) 来获取 CloudBase 技能文档内容,而不是尝试直接读取 skill 文件。直接读取可能返回 400 错误。示例:\n - 需要最小 Web+数据库 Demo 路径时:searchKnowledgeBase(mode=skill, skillName=minimal-web-baas-demo)\n - 需要 auth-tool 指南时:searchKnowledgeBase(mode=skill, skillName=auth-tool)\n - 需要 auth-web 指南时:searchKnowledgeBase(mode=skill, skillName=auth-web)\n - 需要 cloudbase-agent 指南时:searchKnowledgeBase(mode=skill, skillName=cloudbase-agent)\n\n 固定技能文档 (skill) 查询当前支持 29 个固定文档,分别是:\n 文档名:skills 文档介绍:Unified CloudBase execution guide for all-in-one skill installs. Use this first for CloudBase app tasks, especially existing apps with TODOs, fixed pages, or active handlers. Routes PostgreSQL / CloudBase PG / app.rdb() / queryPgDatabase / managePgDatabase work away from legacy NoSQL and old auth patterns.\n文档名:ai-model-nodejs 文档介绍:\"Use this skill for Node.js backend AI via @cloudbase/node-sdk (>=3.16.0) — cloud functions, CloudRun, Express, Koa, NestJS, serverless APIs, scheduled jobs, LLM proxies. Only SDK supporting image generation (ai.createImageModel + generateImage). Text models via ai.createModel with groups cloudbase, hunyuan-exp, or custom-*. Model IDs (deepseek-v4-flash, deepseek-v3.2, hunyuan-2.0-instruct-20251111, glm-5, kimi-k2.6) go in the model field of generateText/streamText. MUST run two-step preflight before code — see body. Keywords: backend, 云函数, 云托管, serverless, LLM proxy, agent orchestration, generateText, streamText, generateImage, createModel, hunyuan-image, Token Credits, TokenHub, Hunyuan, DeepSeek, GLM, Kimi, MiniMax. NOT for browser/Web (use ai-model-web) or Mini Program (use ai-model-wechat).\"\n文档名:ai-model-web 文档介绍:\"Use this skill when a browser/Web app (React, Vue, Angular, Next, Nuxt, static sites, SPAs, dashboards, AI chat UI) needs AI models via @cloudbase/js-sdk. Default routing for page/页面/Web/前端/frontend/网页/H5 AI — call directly from browser, do NOT propose a Node.js proxy. Covers generateText and streamText. Models via ai.createModel with groups cloudbase, hunyuan-exp, or custom-*. Model IDs (deepseek-v4-flash, deepseek-v3.2, hunyuan-2.0-instruct-20251111, glm-5, kimi-k2.6) go in the model field. MUST run two-step preflight before code — see body. Keywords: 页面, Web, 前端, React, Vue, Next, Nuxt, SPA, AI chat UI, generateText, streamText, createModel, hunyuan-exp, Token Credits, TokenHub, Hunyuan, DeepSeek, GLM, Kimi, MiniMax. NOT for Node.js backend (use ai-model-nodejs), Mini Program (use ai-model-wechat), or image generation (Node SDK only).\"\n文档名:ai-model-wechat 文档介绍:\"Use this skill for WeChat Mini Program AI via wx.cloud.extend.AI (小程序, 企业微信小程序, wx.cloud apps). Features generateText and streamText with callbacks (onText, onEvent, onFinish). Models via wx.cloud.extend.AI.createModel with groups hunyuan-exp (小程序成长计划), cloudbase (main managed), or custom-*. Model IDs (deepseek-v4-flash, deepseek-v3.2, hunyuan-2.0-instruct-20251111, glm-5, kimi-k2.6) go in the data wrapper model field. API differs from JS/Node SDK — streamText needs data wrapper, generateText returns raw response. MUST run two-step preflight before code — see body. Keywords: Mini Program AI, wx.cloud.extend.AI, 小程序成长计划, ai_miniprogram_inspire_plan, Token Credits 资源包, generateText, streamText, createModel, hunyuan-exp, TokenHub, Hunyuan, DeepSeek, GLM, Kimi, MiniMax. NOT for browser/Web (use ai-model-web), Node.js backend (use ai-model-nodejs), or image generation (use ai-model-nodejs).\"\n文档名:auth-nodejs-cloudbase 文档介绍:CloudBase Node SDK auth guide for server-side identity, user lookup, and custom login tickets. This skill should be used when Node.js code must read caller identity, inspect end users, or bridge an existing user system into CloudBase; not when configuring providers or building client login UI.\n文档名:auth-tool-cloudbase 文档介绍:CloudBase auth provider configuration and login-readiness guide. This skill should be used when users need to inspect, enable, disable, or configure auth providers, publishable-key prerequisites, login methods, SMS/email sender setup, or other provider-side readiness before implementing a client or backend auth flow.\n文档名:auth-web-cloudbase 文档介绍:CloudBase Web Authentication Quick Guide for frontend integration after auth-tool has already been checked. Provides concise and practical Web authentication solutions with multiple login methods and complete user management.\n文档名:auth-wechat-miniprogram 文档介绍:CloudBase WeChat Mini Program native authentication guide. This skill should be used when users need mini program identity handling, OPENID/UNIONID access, or `wx.cloud` auth behavior in projects where login is native and automatic.\n文档名:cloud-functions 文档介绍:CloudBase function runtime guide for building, deploying, and debugging your own Event Functions or HTTP Functions. This skill should be used when users need application runtime code on CloudBase, not when they are merely calling CloudBase official platform APIs.\n文档名:cloud-storage-web 文档介绍:Complete guide for CloudBase cloud storage using Web SDK (@cloudbase/js-sdk) - upload, download, temporary URLs, file management, and best practices.\n文档名:cloudbase-agent 文档介绍:Build and deploy AI agents with CloudBase Agent SDK (TypeScript & Python). Implements the AG-UI protocol for streaming agent-UI communication. Use when deploying agent servers, using LangGraph/LangChain/CrewAI adapters, building custom adapters, understanding AG-UI protocol events, or building web/mini-program UI clients. Supports both TypeScript (@cloudbase/agent-server) and Python (cloudbase-agent-server via FastAPI).\n文档名:cloudbase-cli 文档介绍:CloudBase CLI (tcb, 云开发CLI, Tencent CloudBase命令行) resource management skill. Use when deploying cloud functions, CloudRun, storage, NoSQL/MySQL, static hosting, permissions, CORS/domains via tcb; for CI/CD and batch ops; when the user prefers CLI; or as the first-session fallback when CloudBase MCP tools are not loaded yet (after install/config, before IDE restart). Covers tcb login (device code for Tencent Cloud accounts; --cloudbase-api-key -e for environment API Key without an account; --apiKeyId/--apiKey for CI) and domain commands (fn/hosting/cloudrun/…) as MCP auth/manage parity — do not default to tcb deploy.\n文档名:cloudbase-code-review 文档介绍:\"Code review and validation for CloudBase projects. After writing code for Web / miniprogram / CloudRun / cloud-function projects, call this skill to check for known pitfalls — auth guard misuse, missing database tables, RLS misconfiguration, storage domain setup, and SDK API misuse. Supports automated lint scripts (regex-based) + LLM semantic review.\"\n文档名:cloudbase-document-database-in-wechat-miniprogram 文档介绍:Use CloudBase document database WeChat MiniProgram SDK to query, create, update, and delete data. Supports complex queries, pagination, aggregation, and geolocation queries.\n文档名:cloudbase-document-database-web-sdk 文档介绍:Use CloudBase document database Web SDK only for confirmed NoSQL collection work. Query, create, update, and delete document data; if the task mentions PostgreSQL / CloudBase PG / app.rdb(), route to postgresql-development instead.\n文档名:cloudbase-platform 文档介绍:CloudBase platform overview and routing guide. This skill should be used when users need high-level capability selection, platform concepts, console navigation, or cross-platform best practices before choosing a more specific implementation skill.\n文档名:cloudbase-wechat-integration 文档介绍:CloudBase WeChat integration guide for Mini Program WeChat Pay, Official Account JSAPI Pay, Native QR-code Pay, Official Account OAuth, openid handling, payment callbacks, and CloudBase Integration Center generated functions. This skill should be used when users ask to add, debug, or extend WeChat payment or official-account flows on CloudBase.\n文档名:cloudrun-development 文档介绍:CloudBase Run backend development rules (Function mode/Container mode). Use this skill when deploying backend services that require long connections, multi-language support, custom environments, AI agent development, or migrating existing/GitHub apps that need VPC access to MySQL/PostgreSQL/Redis. Also use when diagnosing CloudRun container deploy failures (deploy_failed, readiness/probe failed, image won't start, docker.io pull loops). For stateless HTTP services, prefer HTTP cloud functions.\n文档名:data-model-creation 文档介绍:\"[Deprecated] Optional advanced tool for complex data modeling. For simple MySQL table creation, use relational-database-tool directly; for PostgreSQL / CloudBase PG schema work, use postgresql-development. New environments should use PostgreSQL DDL via queryPgDatabase/managePgDatabase — see postgresql-development skill instead.\"\n文档名:http-api-cloudbase 文档介绍:CloudBase official HTTP API client guide. This skill should be used when backends, scripts, or non-SDK clients must call CloudBase platform APIs over raw HTTP instead of using a platform SDK or MCP management tool.\n文档名:minimal-web-baas-demo 文档介绍:\"Fast path for a minimal CloudBase Web + database demo (最小前后端 / 最小可用 fullstack / Lovable-like BaaS). Defaults to @cloudbase/js-sdk client CRUD (NoSQL app.database / PG app.rdb), MCP-only schema, preview-first, and forbids cloud functions unless secrets, cron/background jobs, or logic that security rules/RLS cannot express. Use for 搭一套 demo、留言板、Todo、Notes、Kanban, or when users say 带云函数+云数据库 but only need CRUD. NOT for production multi-service backends, CloudRun, WeChat Mini Programs, or tasks that truly need server secrets.\"\n文档名:miniprogram-development 文档介绍:WeChat Mini Program development skill for building, debugging, previewing, testing, publishing, optimizing, and promoting mini program projects. This skill should be used when users ask to create, develop, modify, debug, preview, test, deploy, publish, launch, review, optimize, or promote WeChat Mini Programs, mini program pages, components, `tabBar`, routing, navigation, icon assets, project structure, project configuration, `project.config.json`, `appid` setup, device preview, real-device validation, WeChat Developer Tools Nightly workflows, `wechatide` CLI, WeChat IDE Skills/MCP, console/network debugging, `miniprogram-ci` preview/upload flows, or mini program release processes. It should also be used when users ask about mini program SEO / search optimization / search promotion (小程序 SEO、搜索优化、微信搜索收录、搜索推广、页面收录、关键词排名、被搜索到) or page indexing by the WeChat search crawler (`mpcrawler`). Use it when users explicitly mention CloudBase, `wx.cloud`, Tencent CloudBase, 腾讯云开发, 微信云开发, or 云开发 in a mini program project.\n文档名:ops-inspector 文档介绍:AIOps-style CloudBase inspection skill (v3). Use when users need health checks, log diagnosis, alarm interpretation (CPU alert normal?, peak QPS), metrics via queryEnv(action=metrics), or fault playbooks for 429 / function 404 / ACCESS_TOKEN_INVALID / zero invocations. Triggers on 巡检, 诊断, 告警, 峰值 QPS, 限频, 调用量为 0, troubleshooting.\n文档名:postgresql-development-cloudbase 文档介绍:\"Use when building, debugging, or evaluating CloudBase PostgreSQL / CloudBase PG / PG mode apps, including Postgres schema setup, queryPgDatabase/managePgDatabase, JS SDK v3 app.rdb() CRUD/RPC, PG HTTP API fallback, RLS-style permissions, username-password auth, and Web CMS/admin CRUD flows backed by CloudBase PG.\"\n文档名:relational-database-mcp-cloudbase 文档介绍:\"[Deprecated] This is the required documentation for agents operating on the CloudBase Relational Database through MCP. It defines the canonical SQL management flow with `queryMysqlDatabase`, `manageMysqlDatabase`, `queryPermissions`, and `managePermissions`, including MySQL provisioning, destroy flow, async status checks, safe query execution, schema initialization, and permission updates. New environments should use PostgreSQL — see postgresql-development skill instead.\"\n文档名:relational-database-web-cloudbase 文档介绍:\"[Deprecated] Use when building frontend Web apps that talk to CloudBase Relational Database via @cloudbase/js-sdk – provides the canonical init pattern so you can then use Supabase-style queries from the browser. New environments should use PostgreSQL with app.rdb() — see postgresql-development skill instead.\"\n文档名:spec-workflow 文档介绍:Use when medium-to-large changes need explicit requirements, technical design, and task planning before implementation, especially for multi-module work, unclear acceptance criteria, or architecture-heavy requests.\n文档名:ui-design 文档介绍:Use when users need visual direction, interface hierarchy, layout decisions, design specifications, or prototypes before implementing a Web or mini program UI.\n文档名:web-development 文档介绍:Use when users need to implement, integrate, debug, build, deploy, or validate a Web frontend after the product direction is already clear, especially for React, Vue, Vite, browser flows, or CloudBase Web integration.\n\n OpenAPI 文档 (openapi) 查询只需要传 mode=\"openapi\" 和 apiName,不要传 action;action 仅用于 mode=\"docs\"。当前支持 7 个 API 文档,分别是:\n API名:mysqldb API介绍:关系型数据库 RESTful API (MySQL/PostgreSQL) - 云开发关系型数据库 HTTP API\nAPI名:functions API介绍:Cloud Functions API - 云函数 HTTP API\nAPI名:auth API介绍:Authentication API - 身份认证 HTTP API\nAPI名:cloudrun API介绍:CloudRun API - 云托管服务 HTTP API\nAPI名:storage API介绍:Storage API - 云存储 HTTP API\nAPI名:nosql API介绍:NoSQL RESTful API - 文档型数据库 HTTP API\nAPI名:ai_model API介绍:AI 大模型接入 API - 统一 AI 模型 HTTP API", "inputSchema": { "type": "object", "properties": { "mode": { "type": "string", "enum": [ "vector", "skill", "openapi", "docs" ] }, "skillName": { "type": "string", "enum": [ "skills", "ai-model-nodejs", "ai-model-web", "ai-model-wechat", "auth-nodejs-cloudbase", "auth-tool-cloudbase", "auth-web-cloudbase", "auth-wechat-miniprogram", "cloud-functions", "cloud-storage-web", "cloudbase-agent", "cloudbase-cli", "cloudbase-code-review", "cloudbase-document-database-in-wechat-miniprogram", "cloudbase-document-database-web-sdk", "cloudbase-platform", "cloudbase-wechat-integration", "cloudrun-development", "data-model-creation", "http-api-cloudbase", "minimal-web-baas-demo", "miniprogram-development", "ops-inspector", "postgresql-development-cloudbase", "relational-database-mcp-cloudbase", "relational-database-web-cloudbase", "spec-workflow", "ui-design", "web-development" ], "description": "mode=skill 时指定。技能名称。" }, "apiName": { "type": "string", "enum": [ "mysqldb", "functions", "auth", "cloudrun", "storage", "nosql", "ai_model" ], "description": "mode=openapi 时指定。API 名称。" }, "action": { "type": "string", "enum": [ "listModules", "listModuleDocs", "findByName", "readDoc", "searchDocs" ], "description": "仅 mode=docs 时指定;mode=openapi 不要传 action。CloudBase 文档操作类型:listModules=列出所有文档模块,listModuleDocs=获取指定模块的目录结构,findByName=按名称/路径/URL 智能查找,readDoc=读取指定文档 Markdown,searchDocs=全文搜索官方文档。" }, "moduleName": { "type": "string", "description": "mode=docs 且 action=listModuleDocs 时指定。模块名称。" }, "input": { "type": "string", "description": "mode=docs 且 action=findByName 时指定。支持模块名、文档标题、层级路径或 URL。" }, "docPath": { "type": "string", "description": "mode=docs 且 action=readDoc 时指定。文档相对路径或完整 URL。" }, "query": { "type": "string", "description": "mode=docs 且 action=searchDocs 时指定。全文检索关键词。" }, "threshold": { "type": "number", "default": 0.5, "description": "mode=vector 时指定。相似性检索阈值" }, "id": { "type": "string", "enum": [ "cloudbase", "scf", "miniprogram" ], "default": "cloudbase", "description": "mode=vector 时指定。知识库范围,默认 cloudbase。cloudbase=云开发全量知识,scf=云开发的云函数知识, miniprogram=小程序知识(不包含云开发与云函数知识)" }, "content": { "type": "string", "description": "mode=vector 时指定。检索内容" }, "options": { "type": "object", "properties": { "chunkExpand": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 2, "default": [ 3, 3 ], "description": "指定返回的文档内容的展开长度,例如 [3,3]代表前后展开长度" } }, "additionalProperties": false, "description": "mode=vector 时指定。其他选项" }, "limit": { "type": "number", "default": 5, "description": "mode=vector 时指定。指定返回最相似的 Top K 的 K 的值" } }, "required": [ "mode" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryCloudRun", "description": "查询云托管服务信息,支持获取服务列表、查询服务详情、获取可用模板列表、获取构建日志(getDeployLog,仅云端源码构建/依赖 CODING)、获取运行日志(getProcessLog,镜像与源码部署均可/不依赖 CODING)、获取部署记录以及查询环境云托管开通状态(envStatus)。返回的服务信息包括服务名称、状态、访问类型、配置详情以及最近部署上下文。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "list", "detail", "templates", "getDeployLog", "getProcessLog", "getDeployRecords", "envStatus" ], "description": "查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包含服务配置和最新部署状态),templates=获取可用的项目模板列表(用于初始化新项目),getDeployLog=获取构建日志(仅云端源码构建有意义,走 CODING/DescribeCloudRunBuildLog;已有镜像部署无构建过程;未登录 CODING 的账号会报错),getProcessLog=获取运行日志(部署阶段步骤+容器启动/运行日志,走 tcbr/DescribeCloudRunProcessLog;镜像部署与源码构建均可用,不依赖 CODING;RunId 来自 detail/getDeployRecords 的 latestDeploy.RunId),getDeployRecords=获取指定服务的部署记录列表(按部署时间倒序,含 BuildId/RunId/FlowRatio/Status 等字段,用于查看历史发布与回滚上下文),envStatus=查询当前环境云托管是否已开通及开通状态(Status=creating开通中/normal已开通),用于initEnv之后轮询进度或deploy之前确认环境是否就绪" }, "pageSize": { "type": "number", "minimum": 1, "maximum": 100, "default": 10, "description": "分页大小,控制每页返回的服务数量。取值范围:1-100,默认值:10。建议根据网络性能和显示需求调整" }, "pageNum": { "type": "number", "minimum": 1, "default": 1, "description": "页码,用于分页查询。从1开始,默认值:1。配合pageSize使用可实现分页浏览" }, "serverName": { "type": "string", "description": "服务名称筛选条件,支持模糊匹配。例如:输入\"test\"可匹配\"test-service\"、\"my-test-app\"等服务名称。留空则查询所有服务" }, "serverType": { "type": "string", "enum": [ "function", "container" ], "description": "服务类型筛选条件:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)" }, "envId": { "type": "string", "description": "环境 ID(action=envStatus 时使用;不传则使用当前配置的环境)。格式如 env-xxxxxx" }, "detailServerName": { "type": "string", "description": "要查询详细信息、部署记录、构建日志或运行日志的服务名称。当action为detail、getDeployLog、getProcessLog或getDeployRecords时建议提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表" }, "buildId": { "type": "number", "description": "构建ID,仅在action=getDeployLog时使用(构建日志,仅云端源码构建)。不传时默认返回最近一次部署的构建日志" }, "runId": { "type": "string", "description": "运行ID(RunId),仅在action=getProcessLog时使用。不传时默认取该服务最近一次部署记录的 RunId(与 detail/getDeployRecords 的 latestDeploy.RunId 同源)。镜像部署与源码构建均可查询运行日志" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageCloudRun", "description": "管理云托管服务,按开发顺序支持:开通云托管环境(initEnv)、初始化项目(可从模板开始,模板列表可通过 queryCloudRun 查询)、下载服务代码、本地运行(仅函数型服务)、部署代码、仅更新配置(updateConfig,无需重新上传代码)、删除服务。deploy 支持两种方式:1) 源码构建(传入 targetPath,本地代码打包上传,默认路径);2) 已有镜像部署(传入 imageUrl,如 ccr.ccs.tencentyun.com/ns/img:v1,走 DeployType=image 容器型部署,targetPath 可省略)。deploy 语义为「触发部署 + 轻量等待任务注册」(最多约 45s)。源码构建返回 buildId,用 getDeployLog 轮询构建进度后再 getProcessLog;镜像部署(imageUrl)BuildId 常为 0,跳过 getDeployLog,返回 runId/next_step 引导 getProcessLog(或先 getDeployRecords 取 RunId)。若用户明确指定镜像或无需重新构建,必须传 imageUrl,不要仅因本地有源码目录就回退到源码构建。deploy 对已存在服务会先读取远程配置再合并(保留 VpcConf/EnvParams/OpenAccessTypes)。updateConfig 对齐控制台服务设置页。删除操作需要确认,建议设置force=true。新环境首次部署前若提示未开通云托管,先调用 initEnv 开通(异步、幂等)。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "init", "download", "run", "deploy", "delete", "createAgent", "updateConfig", "initEnv", "traffic" ], "description": "云托管服务管理操作类型:init=从模板初始化新的云托管项目代码(在targetPath目录下创建以serverName命名的子目录,支持多种语言和框架模板),download=从云端下载现有服务的代码到本地进行开发,run=在本地运行函数型云托管服务(用于开发和调试,仅支持函数型服务),deploy=触发部署并轻量等待任务注册(不会 hang 等完整构建)。源码构建(targetPath)返回 buildId,用 getDeployLog 轮询后再 getProcessLog;已有镜像部署(imageUrl,DeployType=image,BuildId 常为 0)跳过 getDeployLog,用 detail/getDeployRecords 取 RunId 后 getProcessLog。传 imageUrl 时 targetPath 可省略;已存在服务会 Read-Merge-Write 保留远程 VpcConf/EnvParams/OpenAccessTypes),updateConfig=仅更新服务配置不重新上传代码(对齐控制台服务设置,走 SubmitServerConfigChangeDiff;不需要 targetPath),delete=删除指定的云托管服务(不可恢复,需要确认),createAgent=创建函数型Agent(基于函数型云托管开发AI智能体),initEnv=开通当前环境的云托管(异步创建云托管环境,幂等:已开通直接返回;适合新环境首次部署前使用),traffic=流量管理与灰度发布(set=调整稳定版/灰度版流量比例,promote=将灰度版本升级为全量,rollback=回滚到上一个稳定版本;对应 tcb cloudrun traffic 命令)" }, "serverName": { "type": "string", "description": "云托管服务名称,用于标识和管理服务。命名规则:支持大小写字母、数字、连字符和下划线,必须以字母开头,长度3-45个字符。在init操作中会作为在targetPath下创建的子目录名,在其他操作中作为目标服务名。initEnv 操作不需要此参数" }, "trafficOp": { "type": "string", "enum": [ "set", "promote", "rollback" ], "description": "流量管理子操作(action=traffic 时使用):set=调整灰度流量比例(需先部署新版本至灰度,通过 stablePercent/canaryPercent 设置稳定版与灰度版流量比例,两者之和必须等于100);promote=将灰度版本全量发布(灰度版本流量置为100%并关闭灰度发布,等价于 tcb cloudrun traffic promote);rollback=回滚到上一个稳定版本(停止当前灰度/发布中的版本,回到稳定版本,等价于 tcb cloudrun traffic rollback)" }, "stablePercent": { "type": "number", "minimum": 0, "maximum": 100, "description": "稳定版本流量比例(trafficOp=set 时使用),取值范围0-100。与 canaryPercent 之和必须等于100。例如希望 90% 流量打到稳定版、10% 打到灰度版,则 stablePercent=90, canaryPercent=10" }, "canaryPercent": { "type": "number", "minimum": 0, "maximum": 100, "description": "灰度版本流量比例(trafficOp=set 时使用),取值范围0-100。与 stablePercent 之和必须等于100。例如希望 90% 流量打到稳定版、10% 打到灰度版,则 stablePercent=90, canaryPercent=10" }, "envId": { "type": "string", "description": "环境 ID(action=initEnv 时使用;不传则使用当前配置的环境)。格式如 env-xxxxxx" }, "packageType": { "type": "string", "enum": [ "Trial", "Standard", "Professional", "Enterprise" ], "default": "Trial", "description": "云托管环境套餐类型(action=initEnv 时使用):Trial=试用,Standard=标准,Professional=专业,Enterprise=企业。默认 Trial" }, "vpcId": { "type": "string", "description": "VPC 网络 ID(action=initEnv 时可选)。当平台拒绝系统创建网络时必填,格式如 vpc-xxxxxxxx。与 subnetIds 一起透传给 CreateCloudRunEnv 的 VpcId/SubNetIds。多数场景可不传(由系统创建网络)" }, "subnetIds": { "type": "array", "items": { "type": "string" }, "description": "子网 ID 列表(action=initEnv 时可选)。当需指定自有 VPC 时必填,如 [\"subnet-xxxxxxxx\"]。与 vpcId 一起透传给 CreateCloudRunEnv 的 SubNetIds" }, "targetPath": { "type": "string", "description": "本地代码路径,必须是绝对路径。在deploy操作中指定要部署的代码目录,在download操作中指定下载目标目录,在init操作中指定云托管服务的上级目录(会在该目录下创建以serverName命名的子目录)。updateConfig 不需要此参数。建议约定:项目根目录下的cloudrun/目录,例如:/Users/username/projects/my-project/cloudrun。使用 imageUrl 部署已有镜像时此参数可省略。注意:本地有源码目录不等于必须走源码构建;若用户指定镜像请优先传 imageUrl,不要仅因存在 targetPath 就回退到源码构建" }, "imageUrl": { "type": "string", "description": "已有镜像部署(action=deploy 时使用):直接指定容器镜像地址,如 ccr.ccs.tencentyun.com/ns/img:v1 或公网 registry 地址。传入后走 DeployType=\"image\"(容器型)部署,无需本地源码目录(targetPath 可省略)。支持:1) 公网匿名可拉取的镜像直填地址;2) 私有/需登录的镜像(如 ghcr.io)需先在本地 docker pull → docker tag/push 到腾讯云 CCR → 填入 CCR 地址。不传则维持源码构建(本地代码打包上传)。约束:若用户明确提到使用某个镜像、或无需重新构建代码,则必须传 imageUrl 走镜像部署,不要回退到源码构建。注意:无论哪种部署方式,环境都需先开通云托管(未开通时先调用 initEnv,Status=normal 后再部署)" }, "envParamsReplaceAll": { "type": "boolean", "default": false, "description": "EnvParams 合并策略(deploy / updateConfig):false(默认)= 与远程按 key 合并(输入覆盖同名 key,远程其余 key 保留);true= 用输入 EnvParams 整包替换远程。仅当显式传入 EnvParams 时生效" }, "serverConfig": { "type": "object", "properties": { "OpenAccessTypes": { "type": "array", "items": { "type": "string", "enum": [ "OA", "PUBLIC", "MINIAPP", "VPC" ] }, "description": "公网访问类型配置,控制服务的访问权限:OA=办公网访问,PUBLIC=公网访问(默认,可通过HTTPS域名访问),MINIAPP=小程序访问,VPC=VPC访问(仅同VPC内可访问)。可配置多个类型" }, "Cpu": { "type": "number", "exclusiveMinimum": 0, "description": "CPU规格配置,单位为核。可选值:0.25、0.5、1、2、4、8等。注意:内存规格必须是CPU规格的2倍(如CPU=0.25时内存=0.5,CPU=1时内存=2)。影响服务性能和计费" }, "Mem": { "type": "number", "exclusiveMinimum": 0, "description": "内存规格配置,单位为GB。可选值:0.5、1、2、4、8、16等。注意:必须是CPU规格的2倍。影响服务性能和计费" }, "MinNum": { "type": "number", "minimum": 0, "description": "最小实例数配置,控制服务的最小运行实例数量。设置为0时支持缩容到0(无请求时不产生费用),设置为大于0时始终保持指定数量的实例运行(确保快速响应但会增加成本)。建议设置为1以降低冷启动延迟,提升用户体验" }, "MaxNum": { "type": "number", "minimum": 1, "description": "最大实例数配置,控制服务的最大运行实例数量。当请求量增加时,服务最多可以扩展到指定数量的实例,超过此数量后将拒绝新的请求。建议根据业务峰值设置" }, "PolicyDetails": { "type": "array", "items": { "type": "object", "properties": { "PolicyType": { "type": "string", "enum": [ "cpu", "mem", "cpu/mem" ], "description": "扩缩容类型:cpu=基于CPU使用率扩缩容,mem=基于内存使用率扩缩容,cpu/mem=基于CPU和内存使用率扩缩容" }, "PolicyThreshold": { "type": "number", "minimum": 1, "maximum": 100, "description": "扩缩容阈值,单位为百分比。如60表示当资源使用率达到60%时触发扩缩容" } }, "required": [ "PolicyType", "PolicyThreshold" ], "additionalProperties": false }, "description": "扩缩容配置数组,用于配置服务的自动扩缩容策略。可配置多个扩缩容策略" }, "CustomLogs": { "type": "string", "description": "自定义日志配置,用于配置服务的日志收集和存储策略" }, "Port": { "type": "number", "minimum": 1, "maximum": 65535, "description": "服务监听端口配置。函数型服务固定为3000,容器型服务可自定义。服务代码必须监听此端口才能正常接收请求" }, "EnvParams": { "type": "string", "description": "环境变量配置,JSON字符串格式。用于传递配置信息给服务代码,如'{\"DATABASE_URL\":\"postgres://user:pass@10.x.x.x:5432/db\",\"NODE_ENV\":\"production\"}'。SDK v5.6.1+ 会自动对传入的环境变量进行 AES-256-CBC 加密传输。⚠️ 若 EnvParams 含 DATABASE_URL / MYSQL_* / POSTGRES_* / REDIS_* 等传统 TCP 连库变量,必须同时配置 VpcConf,否则实例通常无法访问 VPC 内数据库" }, "Dockerfile": { "type": "string", "description": "Dockerfile文件名配置,仅容器型服务需要。指定用于构建容器镜像的Dockerfile文件路径,默认为项目根目录下的Dockerfile" }, "BuildDir": { "type": "string", "description": "构建目录配置,指定代码构建的目录路径。当代码结构与标准不同时使用,默认为项目根目录" }, "InternalAccess": { "type": "string", "description": "内网访问开关配置,控制是否启用内网访问。true=启用内网访问(可通过云开发SDK直接调用),false=关闭内网访问(仅公网访问)" }, "InternalDomain": { "type": "string", "description": "内网域名配置,用于配置服务的内网访问域名。仅在启用内网访问时有效" }, "EntryPoint": { "type": "array", "items": { "type": "string" }, "description": "Dockerfile EntryPoint参数配置,仅容器型服务需要。指定容器启动时的入口程序数组,如[\"node\",\"app.js\"]" }, "Cmd": { "type": "array", "items": { "type": "string" }, "description": "Dockerfile Cmd参数配置,仅容器型服务需要。指定容器启动时的默认命令数组,如[\"npm\",\"start\"]" }, "InitialDelaySeconds": { "type": "number", "minimum": 0, "description": "端口健康检查初始延迟(秒)。部署完成后先等待 N 秒才开始端口探测,之后约每 5s 检查一次、连续约 30 次;30 次全失败才判定部署失败(约 150s 探测窗口),不是「N 秒后立即失败」。启动耗时长的应用建议调到 60–120" }, "LogType": { "type": "string", "description": "日志类型配置,指定服务的日志收集类型。影响日志的采集方式和存储格式" }, "LogSetId": { "type": "string", "description": "CLS日志集ID配置,指定日志服务(CLS)的日志集ID。需要先开通CLS日志服务" }, "LogTopicId": { "type": "string", "description": "CLS日志主题ID配置,指定日志服务(CLS)的日志主题ID。需要先开通CLS日志服务" }, "LogParseType": { "type": "string", "description": "日志解析类型配置,指定日志的解析方式。用于将原始日志解析为结构化数据" }, "Tag": { "type": "string", "description": "服务标签配置,用于标识服务类型。如设置为\"function:\"表示函数型服务。SDK会自动根据配置生成" }, "OperationMode": { "type": "string", "description": "运行模式配置,指定服务的运行模式。影响服务的调度和资源分配方式" }, "SessionAffinity": { "type": "string", "description": "会话保持配置,用于控制是否启用会话保持功能。启用后会将同一客户端的请求路由到同一实例" }, "TimerScale": { "type": "array", "items": { "type": "object", "properties": { "CycleType": { "type": "string", "enum": [ "none", "daily", "weekly", "monthly" ], "description": "循环类型:none=无循环,daily=每日循环,weekly=每周循环,monthly=每月循环" }, "StartDate": { "type": "string", "description": "循环起始日期,格式:YYYY-MM-DD" }, "EndDate": { "type": "string", "description": "循环结束日期,格式:YYYY-MM-DD" }, "StartTime": { "type": "string", "description": "起始时间,格式:HH:mm:ss" }, "EndTime": { "type": "string", "description": "结束时间,格式:HH:mm:ss" }, "ReplicaNum": { "type": "number", "minimum": 0, "description": "定时扩缩容的目标副本数,最小值0(缩容到0)" } }, "required": [ "CycleType", "StartTime", "EndTime", "ReplicaNum" ], "additionalProperties": false }, "description": "定时扩缩容配置数组,用于配置服务的定时自动扩缩容策略。可配置多个时间段的扩缩容计划,支持每日/每周/每月循环" }, "VpcConf": { "type": "object", "properties": { "VpcId": { "type": "string", "description": "VPC网络ID,格式如 vpc-xxxxxxxx。必须与目标数据库/Redis 处于同一地域,并优先选择同一 VPC。禁止猜测或使用占位符;须来自数据库控制台、已有资源详情、callCloudApi 或用户确认。建议首次创建即配置;已存在服务也可在 deploy 时传入,部署后必须用 queryCloudRun detail 复核是否生效" }, "SubnetId": { "type": "string", "description": "子网ID,格式如 subnet-xxxxxxxx。云托管实例将占用该子网 IP,需确保有足够可用 IP" } }, "required": [ "VpcId", "SubnetId" ], "additionalProperties": false, "description": "VPC网络配置(实例出网/私有网络)。用于让云托管实例接入指定 VPC,从而内网访问 MySQL/PostgreSQL/Redis/CVM 等资源。与 OpenAccessTypes(外部如何访问本服务)是不同概念。TCP 连库场景必须配置。禁止猜测 VpcId/SubnetId,须来自数据库控制台、已有资源详情、callCloudApi 或用户确认。创建时映射为 SDK vpcInfo(CreateType=2);已存在服务可用 updateConfig 或 deploy(RMW 会保留未传入的远程 VpcConf)。部署/更新后必须用 queryCloudRun detail 复核 ServerConfig.VpcConf" }, "VolumesConf": { "type": "array", "items": { "type": "object", "properties": { "VolumeName": { "type": "string", "description": "存储卷名称" }, "VolumeType": { "type": "string", "description": "存储卷类型,如CFS表示云文件存储" }, "VolumePath": { "type": "string", "description": "存储卷挂载路径,服务代码中的目标路径" } }, "required": [ "VolumeName", "VolumeType", "VolumePath" ], "additionalProperties": false }, "description": "存储卷配置数组,用于挂载云存储(如CFS)到服务实例中。可用于持久化数据或共享文件" }, "PublicNetConf": { "type": "object", "properties": { "PublicAccess": { "type": "boolean", "description": "是否开启公网访问,true=开启公网访问,false=关闭公网访问" }, "PublicAccessPath": { "type": "string", "description": "公网访问路径配置" } }, "additionalProperties": false, "description": "公网访问配置,用于控制服务的公网访问策略。可配置是否开启公网访问及访问路径" } }, "additionalProperties": false, "description": "服务配置项,用于 deploy / updateConfig。包括资源规格、访问权限、环境变量、日志、网络等。deploy 未提供时对已存在服务仍会从远程合并保留 VpcConf/EnvParams/OpenAccessTypes;updateConfig 至少需要一个配置字段" }, "template": { "type": "string", "default": "helloworld", "description": "项目模板标识符,用于指定初始化项目时使用的模板。可通过queryCloudRun的templates操作获取可用模板列表。常用模板:helloworld=Hello World示例,nodejs=Node.js项目模板,python=Python项目模板等" }, "runOptions": { "type": "object", "properties": { "port": { "type": "number", "minimum": 1, "maximum": 65535, "default": 3000, "description": "本地运行端口配置,仅函数型服务有效。指定服务在本地运行时监听的端口号,默认3000。确保端口未被其他程序占用" }, "envParams": { "type": "object", "additionalProperties": { "type": "string" }, "description": "本地运行时的附加环境变量配置,用于本地开发和调试。格式为键值对,如{\"DEBUG\":\"true\",\"LOG_LEVEL\":\"debug\"}。这些变量仅在本地运行时生效" }, "runMode": { "type": "string", "enum": [ "normal", "agent" ], "default": "normal", "description": "运行模式:normal=普通函数模式,agent=Agent模式(用于AI智能体开发)" }, "agentId": { "type": "string", "description": "Agent ID,在agent模式下使用,用于标识特定的Agent实例" } }, "additionalProperties": false, "description": "本地运行参数配置,仅函数型云托管服务支持。用于配置本地开发环境的运行参数,不影响云端部署" }, "agentConfig": { "type": "object", "properties": { "agentName": { "type": "string", "description": "Agent名称,用于生成BotId" }, "botTag": { "type": "string", "description": "Bot标签,用于生成BotId,不提供时自动生成" }, "description": { "type": "string", "description": "Agent描述信息" }, "template": { "type": "string", "default": "blank", "description": "Agent模板类型,默认为blank(空白模板)" } }, "required": [ "agentName" ], "additionalProperties": false, "description": "Agent配置项,仅在createAgent操作时使用" }, "force": { "type": "boolean", "default": false, "description": "强制操作开关,用于跳过确认提示。默认false(需要确认),设置为true时跳过所有确认步骤。删除操作时强烈建议设置为true以避免误操作" }, "serverType": { "type": "string", "enum": [ "function", "container" ], "description": "服务类型配置:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)。不提供时自动检测:1)现有服务类型 2)有Dockerfile→container 3)有@cloudbase/aiagent-framework依赖→function 4)其他情况→container" } }, "required": [ "action", "serverName" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryGateway", "description": "CloudBase HTTP 网关统一只读入口(Domain/Route)。查询域名下路径路由及其上游:WEB_SCF/SCF=云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器。主键为 Domain + Path;listRoutes / getRoute / listCustomDomains / getPrivilege。getPrivilege 查询 HTTP 网关总开关(enableService)与访问鉴权(enableAuth)状态。实现自定义域名访问前,先 listCustomDomains:若已有自定义域名,优先 createRoute 挂路由(无需证书 ID);仅在没有可用自定义域名时才 bindCustomDomain。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "listRoutes", "getRoute", "listCustomDomains", "getPrivilege" ], "description": "只读操作类型:listRoutes、getRoute、listCustomDomains、getPrivilege。getPrivilege 无需其他参数,直接返回 HTTP 网关总开关与访问鉴权状态。自定义域名访问场景先 listCustomDomains 确认是否已有域名可复用。" }, "targetName": { "type": "string", "description": "上游资源名过滤(UpstreamResourceName):云函数名、云托管服务名,或静态托管实例名(常见 staticstore)。" }, "routeId": { "type": "string", "description": "路由 ID。getRoute 时可选" }, "path": { "type": "string", "description": "路由路径。getRoute / listRoutes 过滤时可选" }, "domain": { "type": "string", "description": "域名。getRoute / listRoutes 过滤时可选" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageGateway", "description": "CloudBase HTTP 网关统一写入口(Domain/Route)。createRoute/updateRoute/deleteRoute 把域名下的 path 转到上游;enableRoute/disableRoute 启用或禁用已有路由(底层 ModifyHTTPServiceRoute 的 Routes[].Enable,不是 ModifyGatewayRoute)。未传 domain 时用 DomainType=HTTPSERVICE 的 IsDefault 默认 HTTP 域名(形如 *.{region}.app.tcloudbase.com),不会使用静态托管 CDN 域名(*.tcloudbaseapp.com,DomainType=STATIC_STORE)。这是网关默认域上的路径路由,不是 STATIC_STORE 上游绑定;STATIC_STORE 上游必须显式传 upstreamResourceType=STATIC_STORE。关闭静态托管默认域名(*.tcloudbaseapp.com):先 queryGateway(listRoutes) 找到 DomainType=STATIC_STORE 且 IsDefault=true 的 domain,再 manageGateway(action=\"disableRoute\", domain=该域名, path=\"/\");勿用 manageHosting。创建后可用 queryGateway(action=\"listRoutes\") 核对 Domain / DomainType / Path / UpstreamResourceType。上游类型只用一个参数 upstreamResourceType(也可写在 route.upstreamResourceType,route 优先):WEB_SCF=HTTP云函数,SCF=Event云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器;配合 targetName 或 route.serviceName(云函数名/云托管服务名/静态托管实例名,常见 staticstore)。createRoute 只建网关入口,不改上游权限。enablePathTransmission:默认 false 剥触发路径前缀;true 透传完整路径(CBR 多路由、WEB_SCF 自管子路径常需 true;STATIC_STORE 自定义触发路径映射站点根通常 false)。⚠️ 自定义域名访问:若环境已有自定义域名(先 queryGateway listCustomDomains),优先 createRoute 并显式传入该 domain,无需 certificateId;仅首次绑定全新自定义域名时用 bindCustomDomain(需 certificateId)。CORS/安全域名用 envDomainManagement。enableService/authSwitch:HTTP 网关总开关与访问鉴权开关;createRoute 后若访问报 HTTPSERVICE_NONACTIVATED,通常是总开关未开启(用 queryGateway getPrivilege 查询、enableService 开启)。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "createRoute", "updateRoute", "deleteRoute", "enableRoute", "disableRoute", "bindCustomDomain", "deleteCustomDomain", "enableService", "authSwitch" ], "description": "写操作:createRoute/updateRoute/deleteRoute 管理路由;enableRoute/disableRoute 启用或禁用已有路由(需 path,建议显式传 domain);bindCustomDomain/deleteCustomDomain 管理自定义域名;enableService/authSwitch 开关 HTTP 网关总开关与访问鉴权(需配合 enable 参数)。createRoute/updateRoute 必须提供 upstreamResourceType;enableRoute/disableRoute 会先 listRoutes 定位已有路由,通常不必重填上游。updateRoute 也可传 enable/route.enable 直接改 Routes[].Enable。关闭 *.tcloudbaseapp.com 默认静态托管域:disableRoute + domain=该 STATIC_STORE IsDefault 域名 + path=\"/\"。已有自定义域名时优先 createRoute(domain=已有域名) 实现访问,不必再次 bindCustomDomain / 传入 certificateId;bindCustomDomain 仅用于首次绑定新域名(需 certificateId;可选 accessType=DIRECT|CDN|CUSTOM,CUSTOM 需 customCname;普通场景用默认 DIRECT)。接入说明:https://docs.cloudbase.net/service/custom-domain" }, "targetName": { "type": "string", "description": "上游资源名称(UpstreamResourceName),与 route.serviceName 二选一(route 优先)。云函数=函数名;云托管=服务名;静态托管=实例名(常见 staticstore)。不会自动推断上游类型。" }, "path": { "type": "string", "description": "触发路径(网关匹配前缀),默认 /{上游名}。例:云函数 /api/hello、云托管 /api、静态托管 / 或 /app。只建网关入口;与 enablePathTransmission 共同决定上游实际收到的路径。" }, "upstreamResourceType": { "type": "string", "enum": [ "SCF", "WEB_SCF", "CBR", "STATIC_STORE", "LH" ], "description": "上游类型(与 route.upstreamResourceType 二选一,route 优先)。WEB_SCF=HTTP云函数,SCF=Event云函数,CBR=云托管,STATIC_STORE=静态托管,LH=轻量应用服务器。createRoute/updateRoute 必填其一;勿把 manageFunctions 的 type=HTTP|Event 传到本字段。" }, "auth": { "type": "boolean", "description": "网关路径鉴权(EnableAuth)。匿名/浏览器公网访问通常 false。只控制网关入口;云函数安全规则、云托管鉴权、静态托管权限需各自工具另行配置。" }, "enablePathTransmission": { "type": "boolean", "description": "路径透传(EnablePathTransmission),平台默认 false。例 path=/api 且请求 /api/users:false→上游收到 /users;true→上游收到 /api/users。CBR 云托管(Express 等自管子路由)与 WEB_SCF 多路径函数常需 true;STATIC_STORE 把触发路径映射到站点根目录(如 /app → 托管 /)时通常 false;单入口/根路径处理保持 false。也可用 route.enablePathTransmission(route 优先)。" }, "route": { "type": "object", "properties": { "path": { "type": "string" }, "serviceName": { "type": "string", "description": "上游实例名:云函数名 / 云托管服务名 / 静态托管实例名(常见 staticstore)/ LH 实例。优先于顶层 targetName。" }, "upstreamResourceType": { "type": "string", "enum": [ "SCF", "WEB_SCF", "CBR", "STATIC_STORE", "LH" ], "description": "同顶层 upstreamResourceType。route 内设置时优先于顶层。" }, "auth": { "type": "boolean" }, "enablePathTransmission": { "type": "boolean", "description": "同顶层 enablePathTransmission。route 内设置时优先于顶层。" }, "enable": { "type": "boolean", "description": "路由级开关(Routes[].Enable / Route.Enable)。createRoute/updateRoute 可用:enable=false 禁用该 Domain+Path(访问返回 GATEWAY_ROUTE_DISABLED);enable=true 重新启用。updateRoute 也可用顶层 enable 表达同一语义;也可用专用 action enableRoute/disableRoute。route.enable 优先于顶层 enable。" } }, "additionalProperties": false, "description": "路由对象(可选写法)。例:云函数 {upstreamResourceType:\"WEB_SCF\",serviceName:\"fn\",path:\"/api\"};云托管 {upstreamResourceType:\"CBR\",serviceName:\"svc\",path:\"/api\"};静态托管 {upstreamResourceType:\"STATIC_STORE\",serviceName:\"staticstore\",path:\"/\"};禁用路由 {path:\"/\",enable:false}(配合 updateRoute,或直接用 disableRoute)。" }, "domain": { "type": "string", "description": "域名。省略时自动使用环境 DomainType=HTTPSERVICE 的 IsDefault 默认 HTTP 域名(*.{region}.app.tcloudbase.com),不会回退到静态托管 CDN 域名(*.tcloudbaseapp.com,DomainType=STATIC_STORE);也不是 STATIC_STORE 上游绑定。可用 queryGateway(action=\"listRoutes\") 核对实际 Domain / DomainType。enableRoute/disableRoute 操作 *.tcloudbaseapp.com 时必须显式传入该域名。已有自定义域名时请显式传入该域名并 createRoute/updateRoute/deleteRoute,即可实现自定义域名访问且无需证书 ID;仅 bindCustomDomain 时表示要新绑定的域名。" }, "certificateId": { "type": "string", "description": "证书 ID。仅首次 bindCustomDomain 必填。在已有自定义域名上 createRoute / updateRoute / deleteRoute 不需要 certificateId。" }, "accessType": { "type": "string", "enum": [ "DIRECT", "CDN", "CUSTOM" ], "description": "绑定类型(仅 bindCustomDomain,默认 DIRECT)。DIRECT=直连(普通绑域名用这个);CDN=云开发 CDN;CUSTOM=自有 CDN/WAF(需 customCname)。详见 https://docs.cloudbase.net/service/custom-domain" }, "customCname": { "type": "string", "description": "自有 CDN/WAF 的回源/回填地址(仅 bindCustomDomain 且 accessType=CUSTOM)。不是 DNS 里用户域名要解析到的那个 CNAME;DIRECT/CDN 不要传。详见 https://docs.cloudbase.net/service/custom-domain" }, "enable": { "type": "boolean", "description": "开关目标状态:enableService / authSwitch 必填(true 开启 / false 关闭);bindCustomDomain 可选:enable=false 表示绑定后禁用域名(默认启用);updateRoute 可选:映射到 Routes[].Enable(也可用 route.enable,route 优先;也可用专用 action enableRoute/disableRoute)。省略或非布尔值在 enableService/authSwitch 会返回参数错误。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryAppAuth", "description": "CloudBase 应用侧认证配置只读入口。用于查询登录方式、provider、publishable key、API key、client 配置和静态域名等认证准备状态。⚠️ 本工具为管理端配置查询工具,不执行用户登录。当任务要求编写客户端登录代码时(例如「用 JS SDK 登录」),应先通过本工具确认配置状态,再在项目代码中编写 @cloudbase/js-sdk 客户端登录代码(如 auth.signInWithPassword()),而非使用本工具完成登录。若业务要接受普通用户名样式标识符,先查询 action=getLoginConfig;若 usernamePassword=false,下一步应立即调用 manageAppAuth(action=patchLoginStrategy, patch={ usernamePassword: true }),不要直接写 email 登录 API。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "getLoginConfig", "listProviders", "getProvider", "getClientConfig", "getPublishableKey", "getStaticDomain", "listApiKeys" ] }, "providerId": { "type": "string", "description": "provider 标识,如 email、google" }, "clientId": { "type": "string", "description": "OAuth client_id / DescribeClient 的 Id;省略时默认使用当前环境 ID(默认客户端)" }, "keyType": { "type": "string", "enum": [ "publish_key", "api_key" ], "description": "API key 类型过滤,可选 publish_key 或 api_key" }, "pageNumber": { "type": "integer", "exclusiveMinimum": 0, "description": "API key 列表页码,从 1 开始" }, "pageSize": { "type": "integer", "exclusiveMinimum": 0, "description": "API key 列表每页条数" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageAppAuth", "description": "CloudBase 应用侧认证配置写入口。用于修改登录方式、provider、client 配置,确保 publishable key,以及创建或删除 API key、自定义登录密钥。⚠️ 本工具为管理端配置工具,不执行用户登录。当任务要求编写客户端登录代码时(例如「用 JS SDK 登录」),应先通过本工具完成配置(如启用 usernamePassword、获取 publishable key),再在项目代码中编写 @cloudbase/js-sdk 客户端登录代码(如 auth.signInWithPassword()),而非使用本工具完成登录。若前端要接受普通用户名样式标识符,应先执行 action=patchLoginStrategy 并传入 patch={ usernamePassword: true },再实现对应前端登录逻辑。⚠️ 短信验证码登录(patch={ phone: true })使用云开发默认短信通道,开启后即可收发验证码,不需要配置短信签名/模板/自定义 Provider;仅当需要自定义模板/签名或更换短信服务商时才需配置 SmsVerificationConfig 或自定义短信通道。⚠️ action=createApiKey 返回体中的 created 字段表示是否真正新建:created=false 说明复用了环境中已存在的 key,此时 keyName/expireIn 入参不会生效,返回的 keyName/expireAt 均为服务端真实值,并会附带 warnings,切勿把它当作临时凭证分发。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "patchLoginStrategy", "addProvider", "updateProvider", "deleteProvider", "updateClientConfig", "ensurePublishableKey", "createApiKey", "deleteApiKey", "createCustomLoginKeys" ] }, "patch": { "type": "object", "additionalProperties": {}, "description": "patchLoginStrategy 使用的简化登录策略 patch,如 { usernamePassword: true }" }, "providerId": { "type": "string", "description": "provider 标识,如 email、google;addProvider 时也可作为自定义 provider Id" }, "providerType": { "type": "string", "enum": [ "OAUTH", "OIDC", "SAML", "WX_MICRO_APP", "WX_QRCODE_MICRO_APP", "WX_CLOUDBASE_MICRO_APP", "WX_MP", "WX_OPEN", "WX_WORK_INTERNAL", "WX_WORK_AGENT", "WX_WORK_THIRD_PARTY", "WX_WORK_THIRD_PARTY_ASSOCIATION", "CUSTOM", "EMAIL" ], "description": "addProvider 时的 provider 协议类型" }, "displayName": { "anyOf": [ { "type": "string" }, { "type": "object", "additionalProperties": {} } ], "description": "addProvider 时的展示名称,可传字符串或多语言对象" }, "clientId": { "type": "string", "description": "updateClientConfig 时的客户端 Id;省略时默认使用当前环境 ID" }, "config": { "type": "object", "additionalProperties": {}, "description": "provider / client 的配置对象" }, "keyType": { "type": "string", "enum": [ "publish_key", "api_key" ], "description": "createApiKey 时的 API key 类型,默认 publish_key" }, "keyName": { "type": "string", "description": "createApiKey 时的 API key 名称;服务端可能忽略该值(如 publish_key 每环境唯一时),返回体中的 keyName 一律为服务端实际存储的名称" }, "expireIn": { "type": "integer", "minimum": 0, "description": "createApiKey 时的有效期,单位秒;0 表示不过期。复用已有 key 时该值不生效,此时返回体会带 created=false 与 warnings" }, "keyId": { "type": "string", "description": "deleteApiKey 时的 API key 唯一标识" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryApps", "description": "查询 CloudBase 应用部署的应用和版本。可查应用列表/详情、版本列表/详情;部署后用 getAppVersion 按 buildId 轮询构建状态;getBuildLog 可查询构建日志用于诊断失败原因。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "listApps", "getApp", "listAppVersions", "getAppVersion", "getBuildLog" ] }, "serviceName": { "type": "string", "description": "CloudBase 应用服务名。getApp / listAppVersions / getAppVersion / getBuildLog 时必填;重新部署后复用同一个 serviceName 查询版本历史。" }, "searchKey": { "type": "string", "description": "按应用服务名模糊搜索关键词,仅 action=listApps 时使用。" }, "pageNo": { "type": "number", "description": "分页页码,从 1 开始。" }, "pageSize": { "type": "number", "description": "分页大小。" }, "versionName": { "type": "string", "description": "版本名称。getAppVersion 时可与 buildId 二选一;已知版本号时优先传该值。" }, "buildId": { "type": "string", "description": "构建 ID。getAppVersion 时可与 versionName 二选一;部署返回 BuildId 后可直接用它轮询状态。getBuildLog 时必填。" }, "start": { "type": "number", "description": "构建日志偏移量,用于分页拉取后续日志。仅 action=getBuildLog 时使用,不传时从开头返回。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageApps", "description": "部署 Web 应用到 CloudBase(构建前后端,部署到独立子域名)。\naction=getUploadUrl 获取预签名上传 URL(cloud mode 下使用),返回上传地址和 cosTimestamp。\naction=deployApp 上传源码 ZIP 并触发远端构建部署管道:\n 1. 远端 npm install(可通过 installCmd=\"\" 跳过)\n 2. 远端 npm run build(可通过 buildCmd=\"\" 跳过)\n 3. 远端 tcb hosting deploy\n\n域名格式:`-.webapps.tcloudbase.com`(每个 serviceName 一个独立子域名)\n\n✅ 推荐用法(新项目/需要独立域名的 Web 应用,首选此工具):\n 新建项目首次部署时,传 framework=static, installCmd=\"\", buildCmd=\"\" 跳过远端构建,\n 只执行 tcb hosting deploy。部署后获得独立子域名,支持版本管理。\n\n⚠️ 兼容性说明:\n- 已有项目若之前用 manageHosting 部署过(域名格式:`-.tcloudbaseapp.com`),\n 切换到 manageApps 会产生全新的 URL,老链接失效。请保持原部署方式不变。\n- 如需判断:调用 queryHosting 检查是否已有托管文件。\n\n与 manageHosting 对比:\n- manageApps(本工具,新项目首选):域名 `-.webapps.tcloudbase.com`,独立子域名,支持版本管理\n- manageHosting(已有项目或 fallback):域名 `-.tcloudbaseapp.com/`,共享环境域名\n两者均可绑定自定义域名。\n\n⚠️ 如果 manageApps 构建失败,先用 queryApps(action=\"getBuildLog\") 查日志;仍不行再 fallback 到 manageHosting。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "deployApp", "getUploadUrl", "deleteApp", "deleteAppVersion" ] }, "serviceName": { "type": "string", "description": "CloudBase 应用服务名,会体现在域名中:`-.webapps.tcloudbase.com`。deployApp 时复用现有 serviceName 会新增一个部署版本并触发重新部署,而不是删除重建。首次部署请用新名称。" }, "filePath": { "type": "string", "description": "要上传并部署的本地项目根目录绝对路径。本地模式下 deployApp 时必填;通常传源码所在目录(含 package.json 和源码),不是 dist 目录。构建产物目录请用 buildPath 指定。cloud mode 下无需传此参数,改用 cosTimestamp。" }, "cosTimestamp": { "type": "string", "description": "可选 COS 时间戳。传入此值则直接使用已上传的代码创建应用,跳过本地文件上传。需先调用 getUploadUrl 获取预签名 URL,上传 ZIP 包后再传此时间戳。cloud mode 下为必填;本地模式也可传此值代替 filePath。两个路径二选一:filePath(本地打包上传)或 cosTimestamp(预签名 URL 上传)。" }, "appPath": { "type": "string", "description": "应用线上访问路径(hosting mount path),例如 /my-web-app。不是本地目录路径;CloudApp 已有独立子域名,省略时默认为 /(根路径)。" }, "buildPath": { "type": "string", "description": "构建产物目录,相对于 filePath,例如 dist 或 build。\n⚠️ 传此值后远端构建系统会 cd 到此目录再执行 tcb hosting deploy,因此 deployCmd 会自动使用 .(当前目录)而非目录名,避免路径重复(如 dist/dist 错误)。\n纯静态 HTML 如果在项目根目录可省略,但注意 deployCmd 默认用 dist。" }, "framework": { "type": "string", "enum": [ "vue", "react", "next", "nuxt", "vite", "angular", "static" ], "description": "前端框架类型。可选值:vue、react、next、nuxt、vite、angular、static。\n即使传 static,仍会经过远端构建管道。如果本地已构建好,建议改用 manageHosting 直接上传,可完全跳过远端构建。" }, "nodeJsVersion": { "type": "string", "description": "构建时使用的 Node.js 版本;不传时由 CloudBase 使用默认值。" }, "installCmd": { "type": "string", "description": "依赖安装命令,例如 npm install。不传时默认 npm install。本地已安装或无需安装可传空字符串 '' 跳过,但远端仍会执行 tcb hosting deploy。" }, "buildCmd": { "type": "string", "description": "构建命令,例如 npm run build。不传时默认 npm run build。本地已构建好可传空字符串 '' 跳过构建步骤。若希望完全跳过远端管道,请改用 manageHosting。" }, "deployCmd": { "type": "string", "description": "自定义部署命令。通常无需填写,默认自动生成 tcb hosting deploy 命令。有 buildPath 时远端已 cd 到该目录,默认用 . 作为源码路径;无 buildPath 时默认用 dist。" }, "ignore": { "type": "array", "items": { "type": "string" }, "description": "上传时忽略的文件/目录 glob 模式,例如 **/node_modules/**。\n⚠️ 打包的是项目根目录(filePath)而非 buildPath 产物目录:若项目根含 target/(Rust)、.next/、dist-old/、build/ 等大构建产物,必须加进 ignore(如 **/target/**),否则整个目录被打进上传 zip(实证 54GB target → 34GB zip)。默认已排除 node_modules/.git/.DS_Store/**/target/**/.next/**/.next.bak/**。" }, "versionName": { "type": "string", "description": "要删除的历史版本名,仅 action=deleteAppVersion 时必填。" } }, "required": [ "action", "serviceName" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryPermissions", "description": "查询 CloudBase 权限与用户配置,支持查询资源权限(数据库/云函数/存储桶等)、角色列表/详情、应用用户列表/详情,以及网关 OPA 授权策略(对齐 CLI `tcb policy list/get`)。\n\n示例:\n- 查询存储桶权限:`action=\"getResourcePermission\", resourceType=\"storage\", resourceId=\"bucket-name\"`\n- 列出旧网关策略:`action=\"listPolicy\"`(PG / OPA 引擎环境返回空列表,与 CLI 一致)\n- 读取用户 Rego:`action=\"getPolicy\"`;平台扩展策略:`action=\"getPolicy\", extension=true`\n\n📌 跨后端边界提示:调用前先用 `envQuery(action=\"info\", envId=...)` 看 `EnvInfo.RuntimeBackends`。`resourceType=\"noSqlDatabase\"` 查询的是 CloudBase NoSQL 集合规则,与 CloudBase PostgreSQL(PG)表的行级安全(RLS)是两套独立机制——同一个 PG 环境里 NoSQL 集合若仍在使用,对那些集合查询本工具结果**仍然有效**。要查 PG 表 RLS,请改用 `queryPgDatabase(action=\"sql\", sql=\"SELECT * FROM pg_policies WHERE tablename=...\")`。本工具不涉及 MySQL 权限。\n\n⚠️ PostgreSQL 环境:平台 `DescribeResourcePermission` 对 PG 环境会直接拒绝。当 `resourceType=\"function\"` 时,本工具会自动回退到 Manager SDK `describeEnvAuthzConfig`(与 CLI `tcb policy get` 一致,读取 `authz.user.rego`)。显式 OPA 策略请用 `listPolicy` / `getPolicy`。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "getResourcePermission", "listResourcePermissions", "listRoles", "getRole", "listUsers", "getUser", "listPolicy", "getPolicy" ] }, "resourceType": { "type": "string", "enum": [ "noSqlDatabase", "sqlDatabase", "function", "storage" ] }, "resourceId": { "type": "string" }, "resourceIds": { "type": "array", "items": { "type": "string" } }, "roleId": { "type": "string" }, "roleIdentity": { "type": "string" }, "roleName": { "type": "string" }, "uid": { "type": "string" }, "username": { "type": "string" }, "pageNo": { "type": "number" }, "pageSize": { "type": "number" }, "extension": { "type": "boolean", "description": "仅 action=getPolicy。true=读取平台为该环境单独配置的策略(authz.platform.extension.rego),默认 false=用户策略(authz.user.rego),对齐 CLI `tcb policy get --extension`。" }, "policyResourceType": { "type": "string", "enum": [ "policy" ], "description": "仅 action=listPolicy。按资源类型过滤,当前仅支持 `policy`,对齐 CLI `tcb policy list --resource-type policy`。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "managePermissions", "description": "管理 CloudBase 权限与用户配置,支持修改资源权限(数据库/云函数/存储桶等)、角色管理、成员与策略增删、应用用户 CRUD,以及设置网关 OPA Rego 策略(对齐 CLI `tcb policy set`)。\n\n示例:\n- 设置存储桶为私有:`action=\"updateResourcePermission\", resourceType=\"storage\", resourceId=\"bucket-name\", permission=\"PRIVATE\"`\n- 创建角色:`action=\"createRole\", roleName=\"admin\", roleIdentity=\"admin\"`\n- 放开云函数匿名/未登录访问(PG 会走 OPA,对齐 CLI `tcb policy set`):`action=\"updateResourcePermission\", resourceType=\"function\", resourceId=\"myFn\", permission=\"CUSTOM\", securityRule='{\"invoke\":true}'`\n- 直接设置用户 Rego:`action=\"setPolicy\", regoContent=\"package authz.user\\n\\ndefault allow := false\\n\", confirm=true`(⚠️ 立即禁用旧网关鉴权)\n\n注意:`createUser` / `updateUser` 是环境侧应用用户管理能力,适合测试账号、管理员或预置用户,不应替代浏览器里的 Web SDK 注册表单;前端用户名密码注册应使用 `auth.signUp({ username, password })`,登录应使用 `auth.signInWithPassword({ username, password })`。直接在浏览器里用 `auth.signUp` 创建用户名密码用户取决于 SDK/provider 支持,使用前必须验证;不支持时应走后端或管理端边界,不能在浏览器暴露密钥。`securityRule` 的详细语义取决于 `resourceType`:`doc._openid`、`auth.openid`、查询条件子集校验,以及 `create` / `update` / `delete` JSON 模板仅适用于 `resourceType=\"noSqlDatabase\"` 的文档数据库安全规则;配置 `function` 或 `storage` 时,请参考各自官方安全规则文档,而不是复用 NoSQL 模板。\n\n📌 跨后端边界提示:调用前先用 `envQuery(action=\"info\", envId=...)` 看 `EnvInfo.RuntimeBackends`:\n- `resourceType=\"noSqlDatabase\"` 仅作用于 CloudBase NoSQL 文档数据库的集合;CloudBase PostgreSQL(PG)表的行级权限**不**受它控制——PG 表请改用 RLS:`managePgDatabase(action=\"execute\", confirm=true)` 跑 `ALTER TABLE ... ENABLE ROW LEVEL SECURITY` 与 `CREATE POLICY ...`。同一个 PG 环境里如果还有 NoSQL 集合在用,对那些**集合**继续使用 `noSqlDatabase` 规则是正确的——不是\"PG 环境就禁用本工具\"。\n- `resourceType=\"storage\"` 控制的是 NoSQL/COS 存储桶 ACL;PG 的 `pgstore` bucket 不在此 `resourceType` 覆盖范围内。\n- 本工具不涉及 MySQL;MySQL 数据库权限请走 MySQL 自身的 GRANT/REVOKE 语句(通过 `manageMysqlDatabase`)。\n\n⚠️ PostgreSQL 环境:平台 `ModifyResourcePermission` 对 PG 环境会直接拒绝。当 `resourceType=\"function\"` 时,本工具会自动回退到 Manager SDK `modifyEnvAuthzConfig`(与 CLI `tcb policy set` 一致,写入 `authz.user.rego`)。`securityRule` 可传完整 Rego(`package authz.user`)或 `'{\"invoke\":true}'`(自动生成放通 anonymous/unauthenticated 调 functions 的策略)。设置 Rego 后旧网关鉴权会失效,行为与 CLI 相同。显式 OPA 策略请优先用 `action=\"setPolicy\"`。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "updateResourcePermission", "createRole", "updateRole", "deleteRoles", "addRoleMembers", "removeRoleMembers", "addRolePolicies", "removeRolePolicies", "createUser", "updateUser", "deleteUsers", "setPolicy" ] }, "resourceType": { "type": "string", "enum": [ "noSqlDatabase", "sqlDatabase", "function", "storage" ], "description": "目标资源类型。`securityRule` 的具体语义依赖这个值;`noSqlDatabase` 使用集合安全规则,`function` 与 `storage` 也有各自独立的安全规则语义,不要套用 NoSQL 规则语法。" }, "resourceId": { "type": "string" }, "permission": { "type": "string", "enum": [ "READONLY", "PRIVATE", "ADMINWRITE", "ADMINONLY", "CUSTOM" ] }, "securityRule": { "type": "string", "description": "资源类型特定的规则内容,详细语义依赖 `resourceType`。当 `resourceType=\"noSqlDatabase\"` 且 `permission=\"CUSTOM\"` 时,应传文档数据库安全规则 JSON(文档型数据库规则:`https://docs.cloudbase.net/database/security-rules`);键通常为 `read` / `create` / `update` / `delete`,值为表达式。重要:`create` 规则验证写入数据,此时文档尚不存在,不能使用 `doc.*`;`read` / `update` / `delete` 规则可使用 `doc.*` 引用已有文档字段。不要把 `doc._openid`、`auth.openid`、查询条件子集校验或 `create` / `update` / `delete` 模板误用于 `function`、`storage` 或 `sqlDatabase`。如需配置 `function` 或 `storage`,请改查官方安全规则文档:云函数 `https://docs.cloudbase.net/cloud-function/security-rules`,云存储 `https://docs.cloudbase.net/storage/security-rules`。示例:{\"read\":\"auth.uid != null\",\"create\":\"auth.uid != null && auth.loginType != \"ANONYMOUS\"\",\"update\":\"auth.uid != null && doc._openid == auth.openid\",\"delete\":\"auth.uid != null && doc._openid == auth.openid\"}" }, "roleId": { "type": "string" }, "roleIds": { "type": "array", "items": { "type": "string" } }, "roleName": { "type": "string" }, "roleIdentity": { "type": "string", "description": "角色标识符(字母/数字/_-:@.),action=createRole 时必填,用于程序化引用角色" }, "description": { "type": "string" }, "memberUids": { "type": "array", "items": { "type": "string" } }, "policies": { "type": "array", "items": { "type": "object", "additionalProperties": {} } }, "policyIds": { "type": "array", "items": { "type": "string" }, "description": "策略 ID 列表(当前不支持直接按 ID 绑定,请改传 policies 详情对象)" }, "uid": { "type": "string" }, "uids": { "type": "array", "items": { "type": "string" } }, "username": { "type": "string" }, "password": { "type": "string" }, "userStatus": { "type": "string", "enum": [ "ACTIVE", "BLOCKED" ] }, "regoContent": { "type": "string", "description": "仅 action=setPolicy。用户 OPA Rego 全文,必须以 `package authz.user` 开头,对齐 CLI `tcb policy set `。" }, "confirm": { "type": "boolean", "description": "仅 action=setPolicy。设置 Rego 后会立即禁用旧网关鉴权,必须显式传 confirm=true(对齐 CLI 确认提示)。" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryLogs", "description": "CloudBase 日志域统一只读入口。支持检查日志服务状态并搜索 CLS 日志。\n\n**重要区分**:\n- 查询云函数日志:使用 `queryFunctions(action=\"listFunctionLogs\", functionName=\"xxx\")`\n- 查询 CLS 日志(跨服务日志聚合):使用本工具 `queryLogs(action=\"searchLogs\")`\n\n**适用场景**:\n- 检查 CLS 日志服务是否开通:`action=\"checkLogService\"`\n- 跨服务日志搜索(如搜索所有 ERROR 日志):`action=\"searchLogs\"`\n- 按 CLS 语法检索特定服务的日志:`action=\"searchLogs\", service=\"tcb|tcbr\"`", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "checkLogService", "searchLogs" ], "description": "操作类型:\n- `checkLogService`: 检查 CLS 日志服务是否开通\n- `searchLogs`: 搜索 CLS 日志(需要提供 queryString)" }, "queryString": { "type": "string", "description": "CLS 查询语句,**action=\"searchLogs\" 时必填**,需严格遵循 CLS(Cloud Log Service)语法规范,详见 https://cloud.tencent.com/document/api/876/128127\n\n**云函数相关查询**:\n- 云函数日志:`(src:app OR src:system) AND log:\"START RequestId\"`\n- 聚合云函数请求状态:`| select request_id, max(status_code) as status where ((request_id='44738f94-16dd-11f1-****' AND retry_num=0) AND retry_num=0) AND status_code!=202 group by request_id, retry_num`\n\n**云数据库 / 文档型**:\n- 云数据库(文档型):`module:database`\n- 云数据库(文档型)事件:`module:database AND eventType:(MongoSlowQuery)`(MongoSlowQuery 为文档型数据库慢查询事件)\n\n**云数据库 / SQL 型**:\n- 云数据库(SQL 型):`module:rdb`\n- 云数据库(SQL 型)事件:`module:rdb AND eventType:(MysqlFreeze OR MysqlRecover OR MysqlSlowQuery)`(MysqlFreeze 冻结、MysqlRecover 恢复、MysqlSlowQuery 慢查询)\n\n**其它服务**:\n- 审批流:`module:workflow`\n- 模型:`module:model`\n- 用户权限:`module:auth`\n- 大模型:`module:llm AND logType:llm-tracelog`\n- 网关服务调用:`logType:accesslog`\n- 应用发布/删除事件:`module:app AND eventType:(AppProdPub OR AppProdDel)`(AppProdPub 发布事件、AppProdDel 删除事件)\n\n以上仅为示例,实际使用时请根据具体日志内容调整。\n\n**注意**:查询特定云函数的执行日志时,优先使用 `queryFunctions(action=\"listFunctionLogs\", functionName=\"xxx\")`。" }, "service": { "type": "string", "enum": [ "tcb", "tcbr" ], "description": "日志来源服务:\n- `tcb`: 云函数、数据库、存储等基础服务日志\n- `tcbr`: CloudRun 容器服务日志" }, "startTime": { "type": "string", "description": "查询开始时间,格式:`YYYY-MM-DD HH:mm:ss`,如 `2024-01-01 00:00:00`" }, "endTime": { "type": "string", "description": "查询结束时间,格式:`YYYY-MM-DD HH:mm:ss`,如 `2024-01-01 23:59:59`" }, "limit": { "type": "number", "description": "返回日志条数限制,默认 20" }, "context": { "type": "string", "description": "翻页上下文,用于继续上一次查询" }, "sort": { "type": "string", "enum": [ "asc", "desc" ], "description": "按时间排序:`asc` 升序,`desc` 降序" } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "queryAgents", "description": "CloudBase Agent 域统一只读入口。支持列表、详情与日志查询。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "listAgents", "getAgent", "getAgentLogs" ] }, "agentId": { "type": "string" }, "pageNumber": { "type": "number" }, "pageSize": { "type": "number" }, "params": { "type": "object", "additionalProperties": {} } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "manageAgents", "description": "CloudBase Agent 域统一写入口。支持创建、更新和删除远端 Agent。", "inputSchema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "createAgent", "updateAgent", "deleteAgent" ] }, "agentId": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string" }, "runtime": { "type": "string" }, "timeout": { "type": "number" }, "memorySize": { "type": "number" }, "installDependency": { "type": "boolean" }, "zipFile": { "type": "string" }, "cosBucketRegion": { "type": "string" }, "tempCosObjectName": { "type": "string" }, "sessionConfig": { "type": "object", "additionalProperties": {} }, "cwd": { "type": "string" }, "params": { "type": "object", "additionalProperties": {} } }, "required": [ "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } }, { "name": "callCloudApi", "description": "通用的云 API 调用工具,主要用于 CloudBase / 腾讯云管控面与依赖资源相关 API 调用。调用前请先确认 service、Action 与 Param,避免猜测 Action 名称。如果你的目标是通过 HTTP 协议直接集成 auth/functions/cloudrun/storage/mysqldb 等 CloudBase 业务 API,请不要优先使用 callCloudApi,而应优先查看对应 OpenAPI / Swagger。现有 OpenAPI / Swagger 能力不是通用的管控面 Action 集合;管控面 API 请优先参考 CloudBase API 概览 https://cloud.tencent.com/document/product/876/34809 与云开发依赖资源接口指引 https://cloud.tencent.com/document/product/876/34808。对于 tcb service,常用 Action 分类如下:\n\n**环境管理**: `CreateEnv`、`ModifyEnv`、`DescribeEnvs`、`DestroyEnv`\n**用户管理**: `CreateUser`、`ModifyUser`、`DescribeUserList`、`DeleteUsers`\n**认证配置**: `EditAuthConfig`、`DescribeAuthDomains`\n**云函数**: `DescribeFunctions`、`CreateFunction`、`UpdateFunctionCode`、`DeleteFunction`\n**数据库**: `CreateMySQLInstance`、`DescribeMySQLInstances`、`DestroyMySQLInstance`\n\n⚠️ 云托管(CloudBase Run)统一走 tcbr service(CreateCloudRunEnv / CreateCloudRunServer / DescribeEnvBaseInfo / DescribeCloudRunEnvs,version=\"2022-02-17\"),tcb 旧小租户接口 CreateCloudBaseRunResource 等已被禁用;部署请用 manageCloudRun。查询单个环境基础信息/是否已开通云托管用 DescribeEnvBaseInfo(EnvId 必填),查询环境列表及资源信息用 DescribeCloudRunEnvs(EnvId 可选过滤)。\n\n销毁环境时,常见做法是至少带上 `EnvId` 和 `BypassCheck: true`,如果环境已经处于隔离期再按文档补 `IsForce: true`。", "inputSchema": { "type": "object", "properties": { "service": { "type": "string", "enum": [ "tcb", "tcbr", "scf", "sts", "cam", "lowcode", "cdn", "vpc" ], "description": "选择要访问的服务。可选:tcb、tcbr、scf、sts、cam、lowcode、cdn、vpc。对于 tcb / scf / lowcode 等 CloudBase 管控面 Action,请优先查官方文档,不要直接猜测 Action。云托管统一走 tcbr(version 需传 2022-02-17)。" }, "action": { "type": "string", "minLength": 1, "description": "具体 Action 名称,需符合对应服务的官方 API 定义。若不确定正确 Action,请先查官方文档;不要用近义词或历史命名进行猜测。tcb 常用 Action:环境管理 CreateEnv/ModifyEnv/DescribeEnvs/DestroyEnv、用户管理 CreateUser/ModifyUser/DescribeUserList/DeleteUsers、认证配置 EditAuthConfig、云函数 DescribeFunctions/CreateFunction、数据库 CreateMySQLInstance 等。tcbr 常用 Action:CreateCloudRunEnv(初始化云托管)、DescribeEnvBaseInfo(查询单个环境基础信息,EnvId 必填)、DescribeCloudRunEnvs(查询环境列表/资源信息,EnvId 可选过滤)、CreateCloudRunServer/DescribeCloudRunServers。" }, "version": { "type": "string", "description": "API 版本(可选)。缺省时按 service 使用 SDK 内置默认版本;tcbr 必须传 \"2022-02-17\"(否则请求缺少 X-TC-Version 会失败)。示例:service=\"tcbr\", version=\"2022-02-17\", action=\"CreateCloudRunEnv\", params={EnvId:\"env-xxx\",PackageType:\"Standard\"}。" }, "params": { "type": "object", "additionalProperties": {}, "description": "Action 对应的参数对象,键名需与官方 API 定义一致。某些 Action 需要携带 EnvId 等信息;如不确定参数结构,请先查官方文档。tcb 示例:`{ \"service\": \"tcb\", \"action\": \"DestroyEnv\", \"params\": { \"EnvId\": \"env-xxx\", \"BypassCheck\": true } }`,如果环境已经处于隔离期,可再补 `IsForce: true`;更新环境别名则可用 `{ \"service\": \"tcb\", \"action\": \"ModifyEnv\", \"params\": { \"EnvId\": \"env-xxx\", \"Alias\": \"demo\" } }`。若你的场景是通过 HTTP 协议直接集成 auth/functions/cloudrun/storage/mysqldb 等 CloudBase 业务 API,请优先使用 OpenAPI / Swagger 或 searchKnowledgeBase(mode=\"openapi\"),而不是优先使用 callCloudApi。" } }, "required": [ "service", "action" ], "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" } } ] }