Skip to main content
Glama

list_power_query

Extract the Power Query (M) code behind a Power BI model, including loaded table queries, shared queries/functions, and optional named step breakdowns; filter by table when needed.

Instructions

Get the Power Query (M) code behind the model: each loaded table's query steps (the let/in M code, including its transformation step names), plus shared queries/functions/staging steps that feed other queries but don't load into a visible table themselves (Enable Load = Off). Pass table to filter table_queries to one table; shared queries aren't table-scoped so they're always returned in full.

With include_steps (default True), each query also comes broken into its named steps in source order, each with the sub-step names it references -- e.g. step "Changed Type" references step "Source". This is a structural breakdown of the M source text, not a live evaluation: there's no local API into the mashup engine that actually executes these steps, only into the already-loaded tabular model, so this can't show you the data at each step the way Power Query Editor's step preview does -- it can only show you the steps and how they chain together, which is usually enough to spot which step to look at. Each table_queries entry also includes the partition's live refresh state and error_message; use diagnose_power_query for just that, across all tables, without the M text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNo
instanceYes
include_stepsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and does so well: it discloses that the steps are a structural breakdown of M source text, not a live evaluation, and that data at each step cannot be shown. It also describes filtering behavior, default `include_steps` behavior, inclusion of refresh state and `error_message`, and the alternative diagnostics tool.

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

Conciseness4/5

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

The description is front-loaded with the core purpose and is generally efficient for a complex tool. Some sentences are dense, but the detail about limitations and alternatives earns its place rather than being filler.

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?

An output schema exists, so the description need not enumerate return fields, but it still explains what the returned data represents and what it cannot represent. Given the tool's complexity and lack of annotations, the description is complete enough for correct invocation and interpretation.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must add parameter meaning. It richly explains `table` filtering and the default `include_steps` behavior, including subtle shared-query scoping, but it does not explain the required `instance` parameter at all.

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 description names a specific verb and resource: get the Power Query (M) code behind the model, including loaded tables and shared queries. It clearly distinguishes this tool from a simple diagnostics tool and from the tabular model itself, so an agent can tell what it returns without opening the schema.

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 explicitly explains when to use the `table` filter and how shared queries behave, and it names `diagnose_power_query` as the alternative for refresh state/errors without M text. The distinction between structural M-source inspection and live step evaluation is also stated, leaving little ambiguity about when this tool applies.

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