Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
},
{
"group": "Query API",
"pages": ["management/query/execute"]
"pages": ["management/query/execute", "management/query/schema", "management/query/dashboards"]
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions docs/management/query/dashboards.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "List dashboards"
openapi: "v3-openapi GET /api/v1/query/dashboards"
---
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add the required description frontmatter.

This new page only sets title and openapi, but docs/**/*.mdx pages in this repo require a description.

Proposed fix
 ---
 title: "List dashboards"
+description: "Reference for listing built-in query dashboards and their widgets."
 openapi: "v3-openapi GET /api/v1/query/dashboards"
 ---

As per coding guidelines, "MDX documentation pages must include frontmatter with title (required), description (required), and sidebarTitle (optional) in YAML format."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
title: "List dashboards"
openapi: "v3-openapi GET /api/v1/query/dashboards"
---
---
title: "List dashboards"
description: "Reference for listing built-in query dashboards and their widgets."
openapi: "v3-openapi GET /api/v1/query/dashboards"
---
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/management/query/dashboards.mdx` around lines 1 - 4, The frontmatter for
the MDX page is missing the required description field; update the YAML
frontmatter at the top of the "List dashboards" MDX page to include a
description key (e.g. description: "Brief summary of the List dashboards
endpoint") alongside the existing title and openapi entries, and optionally add
sidebarTitle if desired so the page conforms to the docs frontmatter
requirements.

4 changes: 4 additions & 0 deletions docs/management/query/schema.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Get query schema"
openapi: "v3-openapi GET /api/v1/query/schema"
---
Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add the required description frontmatter.

This new page only sets title and openapi, but docs/**/*.mdx pages in this repo require a description.

Proposed fix
 ---
 title: "Get query schema"
+description: "Reference for retrieving the query schema, including available tables and columns."
 openapi: "v3-openapi GET /api/v1/query/schema"
 ---

As per coding guidelines, "MDX documentation pages must include frontmatter with title (required), description (required), and sidebarTitle (optional) in YAML format."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
title: "Get query schema"
openapi: "v3-openapi GET /api/v1/query/schema"
---
---
title: "Get query schema"
description: "Reference for retrieving the query schema, including available tables and columns."
openapi: "v3-openapi GET /api/v1/query/schema"
---
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/management/query/schema.mdx` around lines 1 - 4, The frontmatter for the
"Get query schema" MDX page is missing the required description field; update
the YAML frontmatter that currently contains title and openapi to also include a
description key with a concise summary of the page's purpose (you may also add
sidebarTitle if desired) so it conforms to the repo's MDX frontmatter rules;
locate the metadata block at the top of the schema.mdx file (the lines with ---,
title, openapi) and insert a description: "..." line describing the page.

11 changes: 11 additions & 0 deletions docs/mcp-introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The Trigger.dev MCP (Model Context Protocol) Server enables AI assistants to int
- Get task information and trigger task runs
- Deploy projects to different environments
- Monitor run details and list runs with filtering options
- Query your data with TRQL and run built-in dashboard metrics

## Installation

Expand Down Expand Up @@ -306,6 +307,7 @@ The `install-mcp` command supports these options:
- `-p, --project-ref <project ref>` — Scope the MCP server to a specific project
- `-t, --tag <package tag>` — CLI package version to use (default: latest)
- `--dev-only` — Restrict to the dev environment only
- `--readonly` — Read-only mode. Hides write tools (`deploy`, `trigger_task`, `cancel_run`) so the AI cannot make changes to your account
- `--yolo` — Install into all supported clients automatically
- `--scope <scope>` — `user`, `project`, or `local`
- `--client <clients...>` — Install into specific client(s)
Expand Down Expand Up @@ -336,6 +338,12 @@ Restrict to dev environment for a specific project:
npx trigger.dev@latest install-mcp --dev-only --project-ref proj_abc123
```

Read-only mode (prevents AI from deploying or triggering tasks):

```bash
npx trigger.dev@latest install-mcp --readonly
```

To add these options to a manual config, append them to the `args` array:

```json
Expand All @@ -358,6 +366,9 @@ Once installed, you can start using the MCP server by asking your AI assistant q
- `"List all runs for my foobar task"`
- `"Deploy my project to staging"`
- `"Deploy my project to production"`
- `"How many runs failed in the last 7 days?"`
- `"Show me the overview dashboard metrics"`
- `"What tables can I query?"`

## Next Steps

Expand Down
89 changes: 88 additions & 1 deletion docs/mcp-tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,93 @@ List all preview branches in the project.
- `"What preview branches exist?"`
- `"Show me preview deployments"`

## Profile Tools

### whoami

Show the current authenticated user, active CLI profile, email, and API URL.

**Example usage:**
- `"Who am I logged in as?"`
- `"What profile am I using?"`

### list_profiles

List all configured CLI profiles and which one is currently active.

**Example usage:**
- `"What profiles do I have?"`
- `"Show me my Trigger.dev profiles"`

### switch_profile

Switch the active CLI profile for this MCP session. This changes which Trigger.dev account and API URL are used for all subsequent tool calls.

**Example usage:**
- `"Switch to my production profile"`
- `"Use the staging profile"`

## Query and Analytics Tools

### get_query_schema

Get the schema for TRQL queries, including all available tables, their columns, data types, descriptions, and allowed values. Call this before using the query tool to understand what data is available.

**Example usage:**
- `"What tables and columns can I query?"`
- `"Show me the query schema"`

### query

Execute a TRQL query against your Trigger.dev data. TRQL is a SQL-style query language for analyzing runs, metrics, and LLM usage.

**Example usage:**
- `"How many runs failed in the last 7 days?"`
- `"Show me the top 10 most expensive tasks"`
- `"Query the average execution duration by task"`

### list_dashboards

List available built-in dashboards with their widgets. Each dashboard contains pre-built queries for common metrics.

**Example usage:**
- `"What dashboards are available?"`
- `"Show me the dashboard widgets"`

### run_dashboard_query

Execute a single widget query from a built-in dashboard. Use `list_dashboards` first to see available dashboards and widget IDs.

**Example usage:**
- `"Run the total runs widget from the overview dashboard"`
- `"Show me the LLM cost over time from the AI dashboard"`

## Dev Server Tools

### start_dev_server

Start the Trigger.dev dev server (`trigger dev`) in the background. Waits up to 30 seconds for the worker to be ready.

**Example usage:**
- `"Start the dev server"`
- `"Run trigger dev"`

### stop_dev_server

Stop the running Trigger.dev dev server.

**Example usage:**
- `"Stop the dev server"`

### dev_server_status

Check the status of the dev server and view recent output. Shows whether it is stopped, starting, ready, or has errors.

**Example usage:**
- `"Is the dev server running?"`
- `"Show me the dev server logs"`
- `"Are there any build errors?"`

<Callout type="warning">
The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag.
The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag. The `--readonly` flag hides deploy, trigger_task, and cancel_run.
</Callout>
11 changes: 6 additions & 5 deletions docs/observability/query.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ description: "Query allows you to write custom queries against your data using T

- `runs`: contains all task run data including status, timing, costs, and task output. Run metadata (key-value set in your task) is not available on the Query page.
- `metrics`: contains metrics data for your runs including CPU, memory, and your custom metrics
- `llm_metrics`: contains LLM/AI metrics including token usage, costs, latency, and model performance data from GenAI spans

### `metrics` table columns

| Column | Type | Description |
| :--- | :--- | :--- |
| `metric_name` | string | Metric identifier (e.g., `process.cpu.utilization`) |
| `metric_type` | string | `gauge`, `sum`, or `histogram` |
| `value` | number | The observed value |
| `metric_value` | number | The observed value |
| `bucket_start` | datetime | 10-second aggregation bucket start time |
| `run_id` | string | Associated run ID |
| `task_identifier` | string | Task slug |
Expand All @@ -34,7 +35,7 @@ Use `prettyFormat()` to format metric values for display:
```sql
SELECT
timeBucket(),
prettyFormat(avg(value), 'bytes') AS avg_memory
prettyFormat(avg(metric_value), 'bytes') AS avg_memory_usage
FROM metrics
WHERE metric_name = 'process.memory.usage'
GROUP BY timeBucket
Expand Down Expand Up @@ -225,7 +226,7 @@ Use `GROUP BY` with aggregate functions:
```sql
SELECT
task_identifier,
avg(value) AS avg_memory
avg(metric_value) AS avg_memory
FROM metrics
WHERE metric_name = 'process.memory.usage'
GROUP BY task_identifier
Expand Down Expand Up @@ -529,7 +530,7 @@ Track process CPU utilization bucketed over time.
```sql
SELECT
timeBucket(),
avg(value) AS avg_cpu
avg(metric_value) AS avg_cpu
FROM metrics
WHERE metric_name = 'process.cpu.utilization'
GROUP BY timeBucket
Expand All @@ -544,7 +545,7 @@ Average process memory usage per task identifier over the last 7 days.
```sql
SELECT
task_identifier,
avg(value) AS avg_memory
avg(metric_value) AS avg_memory
FROM metrics
WHERE metric_name = 'process.memory.usage'
GROUP BY task_identifier
Expand Down
120 changes: 120 additions & 0 deletions docs/v3-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,126 @@ paths:
"format": "json"
}'

"/api/v1/query/schema":
get:
operationId: get_query_schema_v1
summary: Get query schema
description: Get the schema for TRQL queries, including all available tables, their columns, data types, descriptions, and allowed values.
responses:
"200":
description: Schema retrieved successfully
content:
application/json:
schema:
type: object
properties:
tables:
type: array
items:
type: object
properties:
name:
type: string
description: Table name used in TRQL queries
description:
type: string
description: Description of the table
timeColumn:
type: string
description: The primary time column for this table
columns:
type: array
items:
type: object
properties:
name:
type: string
description: Column name
type:
type: string
description: ClickHouse data type
description:
type: string
description: Column description
example:
type: string
description: Example value
allowedValues:
type: array
items:
type: string
description: Allowed values for enum-like columns
coreColumn:
type: boolean
description: Whether this is a core column included in default queries
"401":
description: Unauthorized - API key is missing or invalid
tags:
- query
security:
- secretKey: []
x-codeSamples:
- lang: curl
label: cURL
source: |-
curl "https://api.trigger.dev/api/v1/query/schema" \
-H "Authorization: Bearer tr_dev_1234"

"/api/v1/query/dashboards":
get:
operationId: list_dashboards_v1
summary: List built-in dashboards
description: List available built-in dashboards with their widgets. Each dashboard contains pre-built TRQL queries for common metrics like run success rates, costs, and LLM usage.
responses:
"200":
description: Dashboards listed successfully
content:
application/json:
schema:
type: object
properties:
dashboards:
type: array
items:
type: object
properties:
key:
type: string
description: Dashboard identifier (e.g. "overview", "llm")
title:
type: string
description: Dashboard display title
widgets:
type: array
items:
type: object
properties:
id:
type: string
description: Widget identifier
title:
type: string
description: Widget display title
query:
type: string
description: The TRQL query this widget executes
type:
type: string
enum: [bignumber, chart, table]
description: Widget display type
"401":
description: Unauthorized - API key is missing or invalid
tags:
- query
security:
- secretKey: []
x-codeSamples:
- lang: curl
label: cURL
source: |-
curl "https://api.trigger.dev/api/v1/query/dashboards" \
-H "Authorization: Bearer tr_dev_1234"

"/api/v1/runs/{runId}/reschedule":
parameters:
- $ref: "#/components/parameters/runId"
Expand Down
Loading