Skip to main content
Glama

Publish a report from a spec

publish_report_spec

Publish a hosted report from a spec — no build, no zip, live in seconds.

The report is DATA: Porter drops the spec onto its prebuilt viewer, checks every chart against real data and returns the live url. A report is ALWAYS this hosted Porter report: an error is fixed with its hint, never by building it elsewhere (an HTML page, an artifact). Pass name and accounts_used (account_id values from list_accounts; the connectors are derived) to create a report, or report_id to change one (below). Start from draft_report_spec(intent, accounts_used, sections=[…]): it returns the spec with what was asked, passing these checks, and its draft_id; publish it with publish_report_spec(draft_id=…, patch=[…]) — name and accounts come with it, the patch holds only your changes; never resend the whole spec. A chart the catalog lacks is a viz node (below), a control or other visual a custom section — never a reason to leave; only what neither expresses goes to the slow path, create_report + edit_report. This description is the reference (get_knowledge only for the full @porter/kit list).

One page of at most eight sections by default; more pages or sections only when the user asks for them: every chart runs against real data before this call answers.

A complete one-page spec::

{"meta": {"title": "Google Ads", "dateRange": {"start": "2025-12-01", "end": "2025-12-31"}},
 "connector": "google-ads",
 "pages": [{"id": "overview", "title": "Overview", "sections": [
  {"type": "kpi_row", "metrics": [
    {"field": "cost_micros", "label": "Spend", "format": "money"},
    {"derive": "ratio", "from": ["cost_micros", "clicks"], "label": "CPC", "format": "money",
     "lowerIsBetter": true}]},
  {"type": "trend", "metric": "clicks", "title": "Clicks per week", "granularity": "week"},
  {"type": "table", "dimension": "campaign_name", "title": "Campaigns",
   "columns": ["cost_micros", "impressions", "clicks"], "derived": ["ctr"]}]}]}

Fields are list_fields ids; the connector's prefix may be left out when one id has it (clicks = google_ads_clicks); ratios are never fields, derive them. format is exactly money, int or pct. A fixed period (a month, a quarter) is meta.dateRange; defaultPreset is only 7d|30d|90d.

spec = {meta, connector, pages, theme?, filters?, layout?}. meta: title, subtitle?, dateRange? {start, end} (ISO) or defaultPreset?, compareDefault?, locale? (BCP-47), currency? (ISO 4217), periodControl?, client?, logo?: meta.client names the client above the title and meta.logo shows its logo — only an image Porter hosts (the asset_url of prepare_upload(purpose="public_url"), a media.portermetrics.com URL, a data:image/… under 64 KB); an SVG logo goes as its <svg>…</svg> markup, which Porter inlines. connector: the fields' slug; a report that mixes connectors is ONE spec over "porter-blend": its unprefixed fields (each adds up every source) plus any field of the declared accounts' own connectors, and every account in accounts_used; data_source splits by source; a node grouped by one connector's field reads that connector (Porter sets it). theme?: accent, bg, panel, text (CSS colors), radius, chartPalette (≤6), fontDisplay / fontBody (bundled families), css (below). Colors and fonts: patch /theme (the nodes read its tokens); touch nodes only to change the structure. filters? (≤4) [{field, label?, operator?: equals|contains}]: a dropdown or a search box filtering every section of the spec's connector.

Compact styles — style ONCE, by class: theme.css (≤16 KB) is the report's stylesheet, scoped to it, on the role classes the viewer puts: .card (every data block's frame; in kpis, each tile), .kpis, .kpi (:first-child), .kpi-label, .kpi-value, .kpi-delta, .card-title, .chip / .chip.on, .tab / .tab.on, h1–h3 (display font), plus each node's cls (≤8 names: "cls": "eyebrow"). Viewer < theme.css < a node's s. Place data nodes with no s and no box around them: the sheet makes them cards. Rules on classes, elements, attributes, :hover…, :nth-child(), ::before, @media, @keyframes; each declaration as an inline style's. What the viewer refuses (:root, body, #id, @import, @font-face) is dropped and named in spec_notes; an unclosed string, comment or brace, or a backslash, fails at spec.theme.css.

Sections (pages[i].sections; every field a list_fields id): kpi_row {metrics: [{field, label, format} | {derive: ratio|per_mille, from: [a, b], label, format, lowerIsBetter?}], hero?} · trend {metric, title, dateField?, granularity?: day|week|month, format?, overlayPrevious?}; several lines (same unit): metrics (2–6), or metric + splitBy (a line per value, top maxSeries 1–6) · table {dimension, columns, derived?: [ctr|cpc|cpm | {label, numerator, denominator, format?}], sort?, limit?, totalsFooter?, title} · breakdown_bars (horizontal; vertical is a viz) / breakdown_donut {dimension, metric, title, limit?} · funnel {steps: [2–8 fields or {field, label}], title} · pacing {metric, target, per?: period|day, title} (a goal or budget in the metric's units; monthly over that month's dateRange) · creative_gallery / video_gallery {metrics, imageField?/posterField?, nameField?, limit?} · text {body, title?}: prose with live numbers {{sum(field)}}, {{ratio(a, b)}}, {{delta(field)}}, {{top(dimension, metric)}}, | money|int|pct — never type a number. span: half on a columns page; connector: the section reads that ONE connector. Already in the catalog, never custom code: a keyword table (table by google_ads_search_term), GA4 attribution (by google_analytics_4_sessionDefaultChannelGroup), an audience split (breakdowns by age, gender, device, country). Multi-line trends, funnel and pacing, one example each (over porter-blend)::

{"type": "trend", "metric": "amount_spent", "splitBy": "data_source", "title": "Spend by channel"},
{"type": "funnel", "title": "Lead funnel",
 "steps": ["link_clicks", {"field": "landing_page_views", "label": "Visits"}, "leads"]},
{"type": "pacing", "metric": "amount_spent", "target": 15000, "format": "money", "title": "Budget"}

Custom sections — a control or visual that is not a chart (a chart is viz): {"type": "custom", "component": "Name"} with its TSX in custom_sections={"Name": "<source>"}, compiled in milliseconds and audited like any chart. It export defaults a React component that imports ONLY react and @porter/kit; it receives connector, accounts, range and filters (a {"t": "custom"} node of the free layout also gets shell: {range, preset, setPreset, setRange}; a page section does not) and queries with useReportQuery({connector, accounts, fields, filters}, range) → {data: {columns, rows}, prev, loading, error, empty, retry}: one row per combination of the dimensions, keyed by field id, every value TEXT ("914"; a day "20261018"). Use num(v), sumField(data, field) (the total), int / money / pct(n) (pct prints n: pass ratio ×100), useTopRows(base, [{dim, metric}], range, limit) (the true top N, sorted by the server); wrap every view in ChartFrame. No CSS imports: the role classes and cls. At most 16 sections, 64 KB each, 512 KB in all; compile errors come back at custom_sections.<Name>.

Free layout — every report is one (a spec without layout gets a default), in ANY design: edit what draft_report_spec returns rather than write one. spec.layout = {background?, root}, shared by all pages, with ONE {"t": "outlet"} where the page renders (a filters entry needs its select); a page has sections OR root. Node: {t, s?, p?, c?, cls?}: s a React style object, c the children of row/col/grid (p.cols)/box. text (text with {period}, as: h1, h2, h3, p, div, span, mono) · logo (src as meta.logo) · icon (name: grid, search, globe, chart, users, mail, cart, dollar, calendar, target, trending, megaphone…) · divider · period · tabs (items: [{label, icon?, page}]) · chips (items: [{label, preset: 7d|30d|90d|6m|all}]) · select (field: the whole report; ≤4 filtered fields) · calendar: asked for a calendar or date picker, use it (months 1|2, align, label with {period}, presets as the chips'). Native variants, no custom: a segmented control is chips variant: segmented (links, list: a sidebar, cards); a slider or timeline is calendar variant: timeline (window 90d|6m|all) · custom (component of custom_sections, props) · viz · outlet. A report ALWAYS lets the user choose the period: when no chips, calendar or custom node with setRange/setPreset does, Porter adds a calendar before the outlet (normalized); meta.periodControl: false only if the user explicitly asks for a fixed period. Data nodes: kpis (items: [{label, field | ratio: [a, b], format?, lowerIsBetter?}], columns?, delta?) · dual (two axes: left {field, label?, format?}, right {field | ratio, …}, date?, granularity?, headline?: {totalL} {labelL} {totalR} {labelR} {peakR} {avgR}) · table, bars, donut, line, funnel, pacing, the galleries: their section's keys in p; p.connector as a section's. A style the viewer cannot use (vh, position: fixed, a url() outside Porter) is dropped (normalized)::

{"theme": {"accent": "#a78bfa", "css": ".card,.kpi{border:1px solid var(--grid);padding:20px} .eyebrow{letter-spacing:.18em;opacity:.65} h1{font-size:34px}"},
 "layout": {"root": {"t": "col", "s": {"padding": "28px 40px"}, "c": [
   {"t": "text", "cls": "eyebrow", "p": {"text": "ACME · GOOGLE ADS"}},
   {"t": "text", "p": {"as": "h1", "text": "Campañas · {period}"}},
   {"t": "chips", "p": {"variant": "segmented", "items": ["7 días", "30 días", "Todo"]}},
   {"t": "outlet"}]}},
 "pages": [{"id": "resumen", "root": {"t": "col", "c": [
  {"t": "kpis", "p": {"items": [{"label": "Gasto", "field": "cost_micros", "format": "money"},
    {"label": "CPA", "ratio": ["cost_micros", "conversions"], "format": "money"}]}},
  {"t": "dual", "p": {"left": {"field": "cost_micros", "label": "Gasto", "format": "money"},
   "right": {"field": "clicks", "label": "Clics"}}}]}}]}

Any chart without a piece (heatmap, bubbles, waterfall, scatter, box plot…) is a viz node: {"t": "viz", "p": {title?, query: {connector?, dimensions, metrics, filters?, sort?, limit? ≤ 10000}, spec: <Vega-Lite v5 without data>, height?}}; filters: [{field, operator, values}] combined with AND (equals, not_equals, in, not_in, contains, not_contains). Porter puts in the query's rows (a date YYYY-MM-DD, an hour 0–23, a weekday 0–6) and the theme; each field the spec reads is in query or made by a transform (no data, url or image). Sessions by hour and weekday::

{"t": "viz", "p": {"title": "Sessions by hour", "query": {
  "dimensions": ["google_analytics_4_hour", "google_analytics_4_dayOfWeek"],
  "metrics": ["google_analytics_4_sessions"]},
 "spec": {"mark": "rect", "encoding": {
  "x": {"field": "google_analytics_4_hour", "type": "ordinal"},
  "y": {"field": "google_analytics_4_dayOfWeek", "type": "ordinal"},
  "color": {"aggregate": "sum", "field": "google_analytics_4_sessions", "type": "quantitative"}}}}}

Changing a published report: report_id + spec replaces its spec; report_id + patch (no spec) edits the CURRENT one with a JSON Patch (RFC 6902: add, remove, replace, move, copy, test) after the same checks. Paths are JSON Pointers (/pages/0/sections/2, /layout/root/c/0; - appends); add/replace set a key of an object that exists. The ops apply in order: one that fails after others answers patch_partially_applied — those are kept in a new draft_id; resend ONLY pending_ops, fixed, with it. A failing test publishes nothing. The report keeps its accounts unless given, and the live source of each custom section the spec still uses. A built (zip) report has no spec: use edit_report. A patch answers applied_ops::

[{"op": "add", "path": "/theme/accent", "value": "#e4572e"}]
[{"op": "move", "from": "/pages/0/sections/3", "path": "/pages/0/sections/0"}]
[{"op": "add", "path": "/meta/dateRange", "value": {"start": "2026-09-01", "end": "2026-09-30"}}]

By reference — only when you can upload a file (a terminal): instead of writing a file's text into these arguments a second time, upload it with prepare_upload(purpose="report_source", path="Ticker.tsx") and pass its source_ref: custom_sections_ref={"Ticker": ref}, spec_ref or patch_ref. Yours alone, two hours, checked exactly like the arguments.

Returns report_id, url (live), version_id, diagnostics, the audit's preview_url (plus empty_charts and a warning when charts have no rows; no preview_report needed after). deliver says how to answer the user: follow it. Or findings naming each path to fix (spec_invalid), each chart that failed on real data (audit_failed) — both bring draft_id (the refused spec, kept) and a pointer per finding: correct it with draft_id + patch there, never resend the spec — or no_data when every chart came back empty — nothing is published then; tell the user, and set allow_empty only if they want the empty report anyway. normalized lists what Porter rewrote ({path, from, to}): write it that way next time; spec_notes, what the runtime dropped.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "publish_report_spec"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNo
specNo
labelNo
patchNo
draft_idNo
spec_refNo
patch_refNo
report_idNo
allow_emptyNo
accounts_usedNo
connectors_usedNo
custom_sectionsNo
custom_sections_refNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare readOnlyHint=false, openWorldHint=true, destructiveHint=false; the description adds substantial context beyond that: charts are validated against real data before answering, empty charts trigger a warning, patch semantics are ordered with partial application reported back as patch_partially_applied, and failing test ops publish nothing. The one gap is that the replace-vs-edit boundary (versioning/rollback of a replaced spec) is implied rather than stated, and 'label' is never given behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and routing are front-loaded, but the body is a multi-thousand-word embedded spec reference covering theme CSS role classes, every section type, free-layout node types, viz/Vega-Lite, and patch examples. Given a get_knowledge sibling exists, much of this is reference material rather than selection guidance, and the mutation workflow an agent needs is buried in the middle.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter, zero-schema-coverage mutation tool operating on a complex document format, everything an agent needs is present: the full spec shape, worked examples, error branches with recovery via draft_id+patch, and normalization notes. It even restates the return fields and the meaning of 'deliver' despite an output schema existing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description carries the full burden, and it does: name/accounts_used, report_id, spec, patch (RFC 6902 with JSON Pointer paths), draft_id, allow_empty, custom_sections, custom_sections_ref/spec_ref/patch_ref (with the two-hour, owner-only scoping) are all explained. Only 'label' and 'connectors_used' go undefined, which is a small remainder out of thirteen.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening line names a specific verb and resource — "Publish a hosted report from a spec — no build, no zip" — and immediately distinguishes the result from alternatives ("A report is ALWAYS this hosted Porter report... never by building it elsewhere"). It also explicitly names the sibling tools it coordinates with: draft_report_spec, create_report, edit_report.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit routing rules: start from draft_report_spec and pass draft_id, use report_id+spec to replace vs report_id+patch to edit, use edit_report for built (zip) reports, and reserve create_report+edit_report as the "slow path" for what neither a viz node nor a custom section expresses. Preconditions (accounts come with the draft, never resend the spec) and exclusions are spelled out.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources