Draft a report spec from the user's request
draft_report_specDraft a ready-to-publish report spec from the user's request — one call; it NEVER publishes.
The report is ALWAYS a hosted Porter report (this draft, then
publish_report_spec), never an HTML page, an artifact or a file.
Call it first when the user asks for a report: intent (their words),
accounts_used (account_id values from list_accounts) and
sections: what they asked for, one line each — <kind>: <metrics> [by <dimensions>] [top N] [| title]. The draft holds THOSE nodes with the
connector's real ids, in order: you only edit style and texts::
["kpis: clicks, impressions, ctr, position", "trend: clicks, impressions",
"table: clicks, impressions by query top 20", "bars: clicks by page",
"heatmap: sessions by hour, dayOfWeek", "page: Detail", "donut: sessions by device"]Kinds: kpis, trend (two metrics: two axes; by month), table,
bars, donut, funnel (a > b > c), gallery, page (a new
tab) and any chart: heatmap, scatter, areas, lines,
columns, stacked, waterfall, boxplot, calendar,
radial. Names short or natural (clicks, clics, campaign);
ratios (ctr, cpc, cpa) are derived. What does not resolve comes
back in skipped with did_you_mean ids. Without sections Porter
picks a report type (archetype; alternatives when it was a close
call: call again with archetype=<it>), or a generic draft. Optional:
date_range {start, end} (ISO days) or preset 7d|30d|90d,
locale (BCP-47, e.g. es-CO: the labels' language), style:
oscuro_campana (dark, mono labels), claro_minimal, editorial
(serif) or corporativo (centered band).
Returns spec (a FREE LAYOUT styled once in theme.css, with short
ids, that passes publish_report_spec's checks: edit it, never rewrite
it), draft_id, name, skipped,
fields (per connector, the ids in use and the best alternatives: no
list_fields unless you need another), data_preview (the period's
KPI totals and top values: no query_data before publishing; the audit's
queries already run in the background) and slots ({logo: {path, value}}, a JSON Patch add for the client's logo). Then
publish_report_spec(draft_id=…, patch=[…]): the draft keeps the spec,
name and accounts, so the patch holds only your changes — never resend the
spec.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"intent": "<intent>",
"accounts_used": "<accounts_used>"
},
"name": "draft_report_spec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| style | No | ||
| intent | Yes | ||
| locale | No | ||
| preset | No | ||
| sections | No | ||
| archetype | No | ||
| date_range | No | ||
| accounts_used | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||