Skip to main content
Version: Next

MCP Tools

Statistics Explorer ships nine MCP tools that let an AI agent discover what a Report Builder report can read, try a report configuration, read the reports shared with the user, and save a report or propose it for review. Each tool runs as the authenticated user, with the same checks as the Report Builder endpoints of Pimcore Studio (and refuses datasets the user may not read before validating), and needs the reports_config permission.

Requirements​

The tools are registered only when mcp/sdk ^0.7 || ^0.8 || ^0.9 is installed, which the Pimcore Agent Bundle requires. This feature raises the minimum pimcore/studio-backend-bundle to ^2026.4, which provides the shared MCP tool error handling. All tools need the Custom Reports bundle, which stores and lists the reports: without it, or without mcp/sdk, no Report Builder tool is registered. propose_report additionally needs Change Control and the Pimcore Agent Bundle with proposal support; without them it is not registered and nothing else changes.

Tool groups​

The Pimcore Agent Bundle serves each group under /pimcore-mcp/agent/<group>. Attach a group to an agent through pimcoreMcpServers or pimcoreMetaGroups.

GroupTools
pimcore-report-builder-readlist_datasets, describe_dataset, search_fields, get_report_schema, preview_report, list_reports, get_report
pimcore-report-builder-proposepropose_report (needs Change Control)
pimcore-report-builder-direct-writesave_report

An agent that may only explore and preview does not need the other groups.

The nine tools are also tagged pimcore.studio_backend.mcp_tool, so they are listed in the Studio MCP tool catalogue and can be assigned to a Studio-managed MCP server (/pimcore-mcp/studio/<slug>), where a client without a chat session can propose too. The read tools need the OAuth scope mcp:read, save_report and propose_report need mcp:write.

The Studio catalogue needs tool names that are unique across all bundles: the container does not compile when two tools tagged pimcore.studio_backend.mcp_tool share a name. Do not give a tool of your own project one of the nine names above (list_datasets, describe_dataset, search_fields, get_report_schema, preview_report, list_reports, get_report, propose_report, save_report).

Skill and tool pack for the Pimcore Agent Bundle​

When the Pimcore Agent Bundle is installed, Statistics Explorer adds a Report Builder skill (report-builder) to pimcore_agent.skills.paths and a tool pack to pimcore_agent.tool_bundles; without the agent bundle nothing is added. The pack is named "Report Builder" and holds the skill and the pimcore-report-builder-read group, so an agent with only this pack finds datasets and fields, previews and reads reports, and proposes a new report or a change for review where Change Control is installed (the pack then also holds pimcore-report-builder-propose; the skill reads a report with get_report first and prefers propose_report over save_report). Without Change Control it tells the user to save a previewed report in Studio. Where proposals are available the Configuration agent gets the read and propose groups too.

The pack never holds the pimcore-report-builder-direct-write group, because saving bypasses review. An administrator who wants an agent to create reports adds that group to the agent by hand; the skill then saves the previewed report with save_report. The pack and the skill are registered together with the tools, so they are only there when the tools are (mcp/sdk and the Custom Reports bundle).

Workflow​

An agent searches first and queries second:

  1. list_datasets: the datasets a report can read, as {type, name, label}: data object classes, asset, document and registered event indices.
  2. describe_dataset(type, name): the total field count, maxLookupDepth (how many relations a field path may cross) and the field groups with their field counts and a few example paths, so a class with hundreds of fields is not listed in full.
  3. search_fields(type, name, query, paths, limit, offset): the fields themselves. Every word of query must appear in the path, label or group of a field. Each field carries the path to use in the configuration, its type, unit, source and lookupDepth (above 0 for a field of a related element), the filter operators and measure functions it supports, whether it can be grouped or sorted, the allowed values of select fields (at most 50 per field) and pqlName, the name to use in the pql advanced filter ({language} stands for a language). limit defaults to 20, at most 100; page with offset while hasMore is true.
  4. get_report_schema: the JSON schema (version 1) of a report configuration, for the shape of filters, parameters, drill-downs and limits. The tool description also explains the optional pql advanced filter: AND/OR run left to right, booleans are written published = "true", localized fields need a language (name.en), a field of a related element is written with one relation step (manufacturer:Manufacturer.name = "Ford", up to 5 such conditions, see Building Reports), and QUERY() is rejected. Errors of the query come back at path /pql with position, expected, found, token, query and errorKey, like in the grid search. The schema also holds publishedState (published, unpublished or both, default when left out) for reports on data objects and documents: reports include unpublished elements by default, publishedState fixes the choice for every run of the report (preview_report, save_report, viewers and the dashboard) and it combines with conditions on published (all must match). Assets and event datasets refuse it; a click-through target report uses its own state. The same schema validates preview_report, propose_report and save_report, which refuse an invalid value or the property on an asset or event report at path /publishedState. The optional language of the configuration is the language of localized fields in groups, filters, sorts and lists. Leave it out to run in the language of the viewer: the builder and the report view both have a language select, the builder writes language only when an editor picks one, and viewers may switch among the languages they may view without changing the report. A language the user may not view is refused (403) when the report reads localized fields, fallback values count as the Generic Data Index holds them, and the pql advanced filter keeps the language it names. Literal filter values are values of one language and may match nothing after a switch.
  5. preview_report(config, parameters, page, rows): validates the configuration and runs it with the permissions of the user, limited to 50 rows or 50 groups per groupBy field. rows (default 20) shortens the answer further; rowsOmitted reports what was left out.
  6. list_reports: the Report Builder reports shared with the user (name, title, group, dataset). A report of another adapter is not listed.
  7. get_report(name): one of them whole, in the shape propose_report takes (config and the settings), without sharing. A report not shared with the user or of another adapter is refused with a reason.
  8. propose_report(name, config, <settings>): proposes a new report or a change for review, see Proposing.
  9. save_report(name, config, <settings>, overwrite): saves the configuration as a custom report.

Datasets are subject to the element permissions of the user: classes need objects, assets assets and documents documents. A report on a dataset the user may not read is refused by the Report Builder endpoints and by preview_report and save_report before it is validated. Only the dataset of the report is checked this way; values reached through relations (images.filename) are limited by the workspaces of the user.

describe_dataset lists at most 100 groups (groupsTruncated). preview_report cuts text values of cells at 500 characters (cellsTruncated). A preview column (preview, <field>.preview) gives the asset id as value and its full path as label, empty where the cell is empty; the thumbnail of the view is not part of the answer.

Correcting a configuration​

An invalid configuration is not run or saved. The tool answers with code: "invalid_report" and every problem with its JSON pointer:

{
"error": "The report configuration is invalid. Correct the listed paths and try again.",
"code": "invalid_report",
"errors": [
{"path": "/groupBy/0/field", "message": "unknown field \"nope\" in class \"Car\"; did you mean \"type\", \"name\"?"}
]
}

The messages are the validation messages of the Report Builder, so an agent can fix the listed paths and call the tool again.

Proposing​

propose_report records a proposal in Change Control instead of saving: a reviewer sees the report read-only with the changed sections marked, a Settings block listing each changed setting (display name, group, icons, menu shortcut, column and chart settings) with its old and new value, the report run with data, and a text diff of the whole report, and approves or rejects it there. A proposal that changes only settings shows and runs the report as it is. The proposal carries the whole report (config plus the settings title, group, icon, groupIcon, menuShortcut, columnConfiguration, chartType, pieColumn, pieLabelColumn, xAxis, yAxis) and replaces the stored one on approval: for a change read it with get_report, apply the change and send everything back; a setting left out is reset to its default, and the Settings block shows that reset as a change. icon and groupIcon take the name of a Studio icon (for example chart-pie) or an image path; a legacy pimcore_icon_* class is accepted but Studio shows the default icon for it. It is refused with a reason when the user lacks reports_config, the report is not shared with the user, the dataset may not be read, the proposal carries sharing, changes nothing or is invalid.

Approving writes the whole report. A change keeps its sharing; a new report is shared with the proposer (with nobody for an administrator). A person who approves a proposal of a person does not get the report, but one who approves the proposal of a service user (an external MCP client) does, so that the dashboards they own can show it (an approving administrator is not added: they see every report). A report changed since the proposal is refused as stale by Change Control; a new report whose name was taken since is refused ("propose it again"). Rejecting changes nothing. Reviewing needs reports_config, and for a change the report must also be shared with the reviewer. The tool works with a chat session of the Pimcore agent and, on a Studio MCP server, without one.

Reports and parameters in the custom report tools​

With the Pimcore Agent Bundle installed (a version that has its custom report tools: list_custom_reports, describe_custom_report, run_custom_report), Report Builder reports can be read through these tools as well. A Report Builder report has no column filters: it is filtered by its parameters, the ones a filter of the report uses. describe_custom_report lists them with their name, label, type (string, number, boolean or date), whether they are required, their default and their possible values. A list is offered for a string, number, identifier (a user or a tag, for example) or relation field whose parameter every filter compares for equality or membership (eq, ne, in, notIn): the values present in the elements the user may view. Any value of the type is accepted for other operators (gte, contains, ...), and when the list is cut off (more than 500 values). run_custom_report takes the values by parameter name in its parameters; a number, id or yes/no value may be written as text ("120", "false"). The report must be shared with the user and the user needs the permission for its dataset, as when opening it in Studio.

A parameter of a range (between) or a period (inLast) cannot be set through these tools, which pass single values: it is described with a note and the report runs with its default. A parameter whose default is a range, a period or a list is not reported as required: left out, the report runs with that default.

Saving​

save_report creates a Report Builder custom report named name: 3 to 80 letters, digits, spaces, _ and -, starting with a letter or digit.

  • A new report is shared with the user who saved it only (administrators see every report). It is not shared globally.
  • An existing name is refused with code: "conflict" unless overwrite is true. Only Report Builder reports that are shared with the user are replaced; a report of another adapter is never replaced. A replaced report keeps its sharing; settings the call leaves out keep their value (the same settings as propose_report), and sharing passed to it is refused with a reason. Chart settings that point at a column the new configuration no longer has are cleared.
  • Saving is not atomic: two simultaneous saves of a new name can replace each other.
  • The result lists the columns of the report. They are also stored as the column configuration, which the CSV export of Pimcore Studio reads.

Errors​

Every failure is a tool result with isError: true and a body of {"error": ..., "code": ...}.

codeMeaning
permission_deniedThe user lacks reports_config, may not view the data, or the report is not shared with the user.
invalid_requestA malformed argument, such as an unknown dataset type, a missing name or an invalid report name, or custom reports are read-only on this installation.
invalid_reportThe configuration is invalid, with errors for validation problems.
not_foundThe class or event dataset does not exist.
conflictThe report exists and is not replaced.
internal_errorSomething failed inside Pimcore.

The message of an internal_error names a correlation id (ref: <id>). The exception goes to the Pimcore log under that id and never to the client.