# create_qr_code

> 为该地点创建指向 Google 评价表单的二维码和短链接。

URL: https://repliqds.com/zh/docs/mcp/tools/create-qr-code
更新于: 2026-11-24

## 功能说明

为该地点创建指向 Google 评价表单的二维码和短链接。

- 计入套餐的有效二维码上限；请先调用 `get_quota`。
- 该地点需要已关联 Google 地点；`slug` 是可选的可读后缀，例如 `cafe-sol`。

## 权限与限制

| 属性 | 值 |
| --- | --- |
| 权限 | `repliq:draft` |
| 类型 | 修改数据 |
| 每小时预算 | 无 |
| 套餐配额 | 无 |
| 行为提示 | 写入数据 · 非幂等 · 仅限 Repliq 内部 |

## 参数

- `location_id` (string (uuid), 必填): A location id from list_locations.
- `name` (string (1–80 chars), 必填): Name of the QR, e.g. "Mostrador".
- `slug` (string (3–40 chars), 可选): Optional readable link ending (lowercase letters, digits and hyphens), e.g. "bar-pepe".

## 示例

一次完整调用，分别给出原始 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":"create_qr_code","arguments":{"location_id":"3f1c2a9e-5b7d-4c1e-9a3b-2d6f8e0a1b4c","name":"Mostrador","slug":"cafe-sol"}}}'
```

**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: "create_qr_code",
  arguments: {
    "location_id": "3f1c2a9e-5b7d-4c1e-9a3b-2d6f8e0a1b4c",
    "name": "Mostrador",
    "slug": "cafe-sol"
  },
});
console.log(result.structuredContent);
```

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

## 响应

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

- `created`
- `location`
- `asset`
- `quota`

## 错误

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

| 错误码 | 含义 | 处理方法 |
| --- | --- | --- |
| `INSUFFICIENT_SCOPE` | 该连接没有被授予此工具所需的权限。 | 重新连接 Repliq 并勾选该权限，或创建包含该权限的个人令牌。 |
| `LOCATION_NOT_FOUND` | 该连接看不到具有此 id 的地点。 | 调用 `list_locations`，使用其返回的 id。 |
| `LOCATION_WITHOUT_WORKSPACE` | 该地点尚未加入任何工作区。 | 在 Repliq 应用中打开一次该地点后重试。 |
| `QR_QUOTA_EXCEEDED` | 已达到套餐允许的有效二维码数量上限。 | 调用 `get_quota`，在 Repliq 中停用一个二维码或升级套餐。 |
| `QR_SLUG_TAKEN` | 该可读链接后缀已被占用。 | 换一个 `slug`，或省略以获得随机后缀。 |
| `READ_ONLY_ROLE` | 你在该工作区的角色是 viewer（只读）。 | 请所有者或管理员授予 Manager（editor）角色。 |
| `PLAN_REQUIRED` | 该地点没有有效的套餐或试用。 | 在 Repliq 中开始试用或订阅套餐。 |
| `TEMPORARILY_UNAVAILABLE` | Repliq 暂时无法完成请求，或无法检查每小时预算（此时会安全失败，不执行任何操作）。 | 稍后重试。 |

## 服务器发布的描述

Creates a QR code and short link to the location's Google review form, within the plan's QR limit (call get_quota first). Owners, admins and editors. Needs the draft permission.

## 相关工具

- [`list_qr_codes`](https://repliqds.com/zh/docs/mcp/tools/list-qr-codes): 将客户带到 Google 评价表单的二维码和短链接，附带最近 90 天的扫描量和套餐上限。
- [`get_quota`](https://repliqds.com/zh/docs/mcp/tools/get-quota): 每个工作区套餐的剩余额度：AI 回复、评价邀请、报告、导出、二维码、门店、团队席位、模板、分享链接和手动同步。
- [全部 MCP 工具](https://repliqds.com/zh/docs/mcp/tools): 完整目录及每个工具所需的权限。

## 相关文档

- [list_qr_codes](https://repliqds.com/zh/docs/mcp/tools/list-qr-codes)
- [get_quota](https://repliqds.com/zh/docs/mcp/tools/get-quota)
