Skip to main content
Glama
HorizunGroup

Horizun PBI MCP

Official
by HorizunGroup

pbi_get_power_query

Read-only

Retrieve the Power Query (M) definition of a table partition or named expression from a live Power BI Desktop model or .pbip project, with its SHA-256 hash to verify the current version before updating.

Instructions

Lee la consulta Power Query (M) de una particion o expresion.

En un .pbip el M no tiene archivo propio: vive dentro del TMDL, en la partition de cada tabla y en expressions.tmdl. Esta tool lo saca tal cual, con su SHA-256, que es lo que despues acepta pbi_update_power_query como expected_sha256 para no escribir sobre una version que ya cambio.

source: 'pbip' (TMDL en disco), 'live' (motor de Desktop, DMV TMSCHEMA_PARTITIONS / TMSCHEMA_EXPRESSIONS) o vacio: pbip si hay proyecto activo, si no el modelo vivo. Con live la respuesta trae file: null y source: 'live': es la definicion cargada en Desktop, no el archivo.

table + name seleccionan una particion; name con kind='expression', una expresion con nombre. object_name es un alias de name (si llegan distintos, conflicto). Si la seleccion queda ambigua o no existe, el error trae la lista de candidatos.

Solo lectura, y solo lectura de TEXTO: nadie ha ejecutado esta consulta. No hay motor M fuera de Power BI Desktop.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindNo
nameNo
tableNo
sourceNo
object_nameNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.1.1
    • addedInput schema / properties / object_name
      Added value: +{
      +  "default": "",
      +  "title": "Object Name",
      +  "type": "string"
      +}
    • addedInput schema / properties / source
      Added value: +{
      +  "default": "",
      +  "title": "Source",
      +  "type": "string"
      +}
  2. Addedv2.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Although readOnlyHint is already true, the description adds important behavioral context: it only reads text and never executes the M query, it returns the SHA-256 hash for use by pbi_update_power_query, and it clarifies that with source='live' the definition comes from the in-memory Desktop model, not the file. It also describes error behavior with candidate lists, going well beyond annotations.

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

Conciseness5/5

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

The description is long but every sentence earns its place: background on pbip TMDL, source semantics, selection rules, alias behavior, error behavior, and safety guarantees. The core purpose is front-loaded in the first sentence and the rest expands it without repetition.

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?

This is a nuanced tool with optional parameters and two distinct source modes, and the description explains the full selection model, the live-vs-file distinction, the SHA-256 handoff to the update tool, and the read-only safety profile. Since an output schema exists, return values need not be described separately.

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 description coverage is 0%, so the description carries full responsibility for parameter meaning. It explains source values and their consequences, how table/name select partitions, how kind='expression' changes the target, and how object_name aliases name with conflict handling. This is strong compensation for the empty schema descriptions.

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 opens with a specific verb and resource: reading the Power Query (M) definition of a partition or expression. It goes further to explain where the M lives in a .pbip project and that the tool also computes the SHA-256, clearly distinguishing it from other model-reading siblings like pbi_get_object.

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

Usage Guidelines4/5

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

The description provides clear contextual guidance for selecting source, table, and name, and explains the fallback behavior when source is empty. It does not explicitly contrast this tool with alternative read paths such as pbi_get_object or pbi_list_partitions, but the selection semantics are detailed enough that an agent knows when to invoke this tool.

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

Deploy Server

Other Tools