# run_report

> Generates a saved report now and attaches its PDF to the result.

URL: https://repliqds.com/en/docs/mcp/tools/run-report
Updated on: 2026-11-24

## What it does

Generates a saved report now and attaches its PDF to the result.

- Spends one report of the plan’s monthly allowance (the same counter as the app); call `get_quota` first.
- The PDF goes only to the assistant as an embedded resource; nothing is emailed. Above 4 MB it is not attached but the report is still counted.
- Only owners, admins and editors can run reports.

## Permission and limits

| Property | Value |
| --- | --- |
| Permission | `repliq:draft` |
| Kind | Changes data |
| Hourly budget | None |
| Plan quota | None |
| Behaviour hints | writes data · not idempotent · stays inside Repliq |

## Parameters

- `report_id` (string (uuid), required): A report id from list_reports.
- `workspace_id` (string (uuid), optional): A workspace id from list_locations; optional when the account has one workspace.

## Example

A complete call, as a raw JSON-RPC request and with the official MCP SDK. Replace `REPLIQ_TOKEN` with an access token or a personal token (see [Authentication](https://repliqds.com/en/docs/mcp/authentication)) and the ids with your own from `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":"run_report","arguments":{"report_id":"5e2b7c90-4d1a-4a68-8f3b-0c9d1e7a2b46"}}}'
```

**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: "run_report",
  arguments: {
    "report_id": "5e2b7c90-4d1a-4a68-8f3b-0c9d1e7a2b46"
  },
});
console.log(result.structuredContent);
```

The arguments of this example are validated against the tool’s input schema in Repliq’s own test suite.

## Response

A successful call returns the same JSON twice: as `structuredContent` and serialised in a text block. Its top-level fields are:

- `generated`
- `workspace_id`
- `run`
- `pdf`
- `note`
- `quota`

## Errors

A failed call returns `isError: true` with a JSON text `{ "error": CODE, "message": … }`. Besides arguments that fail the input schema (rejected before the tool runs), this tool can return:

| Code | Meaning | What to do |
| --- | --- | --- |
| `INSUFFICIENT_SCOPE` | The connection was not granted the permission this tool needs. | Reconnect Repliq and tick that permission, or create a personal token that includes it. |
| `WORKSPACE_REQUIRED` | The account has several workspaces and the tool needs to know which one. | Pass `workspace_id` (the message lists the ids; `list_locations` also returns them). |
| `NO_WORKSPACE` | The account has no workspace with locations yet. | Connect a location in the Repliq app first. |
| `REPORT_NOT_FOUND` | No saved report with that id exists in the workspace. | Call `list_reports` and use one of its ids (and its `workspace_id`). |
| `REPORT_QUOTA_EXCEEDED` | The workspace already used all the reports its plan allows this month. | Call `get_quota` to see when it renews, or upgrade the plan in Repliq. |
| `READ_ONLY_ROLE` | Your role in that workspace is viewer. | Ask an owner or admin for the Manager (editor) role. |
| `PLAN_REQUIRED` | The location has no active plan or trial. | Start the trial or a plan in Repliq. |
| `TEMPORARILY_UNAVAILABLE` | Repliq could not finish the request right now, or could not check an hourly budget (it then fails closed and does nothing). | Retry in a moment. |

## Description published by the server

Generates a saved report now and attaches its PDF to the result. Spends one report of the plan's monthly allowance (call get_quota first). Nothing is emailed. Owners, admins and editors. Needs the draft permission.

## Related tools

- [`list_reports`](https://repliqds.com/en/docs/mcp/tools/list-reports): The workspace’s saved report definitions: type, cadence, recipients, last and next run.
- [`get_quota`](https://repliqds.com/en/docs/mcp/tools/get-quota): 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.
- [`list_exports`](https://repliqds.com/en/docs/mcp/tools/list-exports): The latest exports (CSV, Excel, PDF, Word) of the workspace: what, who, when and how many rows.
- [All MCP tools](https://repliqds.com/en/docs/mcp/tools): The full catalogue with the permission each tool needs.

## Related documentation

- [list_reports](https://repliqds.com/en/docs/mcp/tools/list-reports)
- [get_quota](https://repliqds.com/en/docs/mcp/tools/get-quota)
- [list_exports](https://repliqds.com/en/docs/mcp/tools/list-exports)
