# get_quota

> 每个工作区套餐的剩余额度：AI 回复、评价邀请、报告、导出、二维码、门店、团队席位、模板、分享链接和手动同步。

URL: https://repliqds.com/zh/docs/mcp/tools/get-quota
更新于: 2026-11-24

## 功能说明

每个工作区套餐的剩余额度：AI 回复、评价邀请、报告、导出、二维码、门店、团队席位、模板、分享链接和手动同步。

- 在执行会消耗配额的操作前调用，并告诉用户还剩多少。支持 MCP Apps 的客户端会把结果显示为带进度条的紧凑卡片。
- `focus`（`ai`、`requests`、`reports` 或 `qr`）只会把该操作相关的指标排在前面。
- 数字来自应用实际执行的同一批计数器；你看不到的工作区不会出现。
- 消耗配额的操作还会在结果中返回更新后的 `quota`。

## 权限与限制

| 属性 | 值 |
| --- | --- |
| 权限 | `repliq:read` |
| 类型 | 读取 |
| 每小时预算 | 无 |
| 套餐配额 | 无 |
| 行为提示 | 只读 · 仅限 Repliq 内部 |

## 参数

- `workspace_id` (string (uuid), 可选): A workspace id from list_locations; optional when the account has one workspace.
- `focus` ("ai" | "requests" | "reports" | "qr", 可选): What the user is about to do, so its meters come first on the card.

## 示例

一次完整调用，分别给出原始 JSON-RPC 请求和官方 MCP SDK 的写法。把 `REPLIQ_TOKEN` 换成访问令牌或个人令牌（参见[认证](https://repliqds.com/zh/docs/mcp/authentication)），并把 id 换成你自己通过 `list_locations` 得到的值。

**curl**

```bash
curl -sS https://repliqds.com/api/mcp \
  -H "Authorization: Bearer $REPLIQ_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_quota","arguments":{"focus":"reports"}}}'
```

**TypeScript**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const client = new Client({ name: "my-script", version: "1.0.0" });
await client.connect(new StreamableHTTPClientTransport(new URL("https://repliqds.com/api/mcp"), {
  requestInit: { headers: { Authorization: `Bearer ${process.env.REPLIQ_TOKEN}` } },
}));

const result = await client.callTool({
  name: "get_quota",
  arguments: {
    "focus": "reports"
  },
});
console.log(result.structuredContent);
```

本示例的参数已在 Repliq 自己的测试中按该工具的输入模式校验通过。

## 响应

调用成功时会返回两份相同的 JSON：一份在 `structuredContent` 中，另一份序列化在文本块中。其顶层字段为：

- `generated_at`
- `workspaces`
- `hourly_limits_per_connection`
- `focus`

## 错误

调用失败时返回 `isError: true`，文本为 JSON：`{ "error": 错误码, "message": … }`。除了不符合输入模式的参数（会在工具运行前被拒绝）外，该工具可能返回：

| 错误码 | 含义 | 处理方法 |
| --- | --- | --- |
| `TEMPORARILY_UNAVAILABLE` | Repliq 暂时无法完成请求，或无法检查每小时预算（此时会安全失败，不执行任何操作）。 | 稍后重试。 |

## 服务器发布的描述

What is left of the plan for each workspace: AI replies, review requests, reports, exports, QR codes, locations, team seats, templates, share links and manual syncs, with the plan, the trial and the hourly limits of this connection. Call it before an action that spends quota and tell the user what is left.

## 相关工具

- [`list_reports`](https://repliqds.com/zh/docs/mcp/tools/list-reports): 工作区中已保存的报告定义：类型、频率、收件人、上次和下次运行时间。
- [`send_review_requests`](https://repliqds.com/zh/docs/mcp/tools/send-review-requests): 向用户指定的客户发送评价请求邮件，可立即发送或定时发送。仅在用户明确要求并确认收件人后使用。
- [`generate_reply_draft`](https://repliqds.com/zh/docs/mcp/tools/generate-reply-draft): 使用 Repliq AI，依据品牌语气和人工批准过的回复撰写草稿。不会发布。
- [全部 MCP 工具](https://repliqds.com/zh/docs/mcp/tools): 完整目录及每个工具所需的权限。

## 相关文档

- [list_reports](https://repliqds.com/zh/docs/mcp/tools/list-reports)
- [send_review_requests](https://repliqds.com/zh/docs/mcp/tools/send-review-requests)
- [generate_reply_draft](https://repliqds.com/zh/docs/mcp/tools/generate-reply-draft)
