Skip to main content
Glama
HorizunGroup

Horizun PBI MCP

Official
by HorizunGroup

pbi_add_table_from_file

Import CSV, Excel, JSON, or HTML files into a Power BI project as a new table with auto-detected headers, culture, and text columns.

Instructions

Carga un archivo al modelo como lo haria una persona: abrir, transformar, cargar.

El mismo recorrido de Power Query —Obtener datos, promover encabezados, cambiar tipos, Cargar— pero escrito directo en el proyecto. Los pasos de la consulta se llaman como los pone Power BI ('Origen', 'Encabezados promovidos', 'Tipo cambiado'), asi que se puede abrir y editar en el editor sin que desentone.

Admite .csv, .txt, .tsv, .xlsx, .xlsm, .json, .html/.htm y '.xls'. Sin dependencias nuevas: el .xlsx se lee como lo que es, un zip con XML, y el HTML con html.parser de la biblioteca estandar.

Un '.xls' NO se toma por la extension: se mira la firma real del archivo. En la practica, casi ningun '.xls' que exportan los ERPs es el binario OLE2 que la extension promete -- es una tabla HTML con esa extension porque Excel la abre igual. Si de verdad es OLE2 (Excel 97-2003), se rechaza con un mensaje claro en vez de leerlo mal; si es un .xlsx renombrado, se lee como .xlsx.

Para HTML: si el archivo trae varias <table>, se elige la mas grande y se avisa (usa table_id para elegir una en concreto, el id HTML de la tabla). Los encabezados solo se promueven si la tabla usa <th>; un reporte sin esa marca (el caso normal en un reporte de ERP, donde la fila 1 es el titulo del reporte, no un encabezado) carga con columnas 'Column1', 'Column2'...

La cultura se deduce del archivo, mirando como escribe los decimales, y se emite SIEMPRE explicita en la consulta. Asumir la del modelo es lo que convierte 10527.52 en diez millones sin que nada falle: un informe que abre, pinta y miente. culture permite forzarla.

Lo escrito se valida antes de darlo por bueno: si el TMDL generado no pasara pbi_validate_tmdl, se aborta en vez de dejar un proyecto que no abre.

Filas de basura antes del encabezado: es el patron de export mas comun de un ERP -fila 1 con el titulo del reporte y el resto de la fila vacia, encabezado real en la fila 2-. Por defecto se AUTODETECTA la primera fila que pueda ser encabezado (sin huecos y sin nombres repetidos) y se dice cual se eligio en warnings. skip_rows fuerza cuantas saltar cuando la deteccion no acierta; skip_rows=0 obliga a usar la fila 1 tal cual. Aplica a csv y xlsx.

Los codigos se cargan como texto. Una columna cuyo encabezado dice que es un codigo (codigo, cod, code, clave, item, sku, ref...) queda en texto aunque sus valores parezcan numeros: como numero 2.10 se vuelve 2.1 y deja de cruzar con otras tablas. Igual con enteros con ceros a la izquierda (007). Se avisa en warnings. text_columns fuerza texto en columnas que el encabezado no delata (p. ej. ["partida"]); un nombre que no exista es error.

dry_run=true devuelve el TMDL y la M sin escribir nada. sheet: hoja del libro; si se omite, la primera. Solo aplica a xlsx.

Escribe en TMDL: requiere el proyecto CERRADO en Power BI Desktop.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
sheetNo
cultureNo
dry_runNo
table_idNo
overwriteNo
skip_rowsNo
request_idNo
table_nameNo
descriptionNo
text_columnsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.1.2
    • addedInput schema / properties / text_columns
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Text Columns"
      +}
  2. Changed1 schema field changedv1.2.0
    • addedInput schema / properties / skip_rows
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Skip Rows"
      +}
  3. First observedv1.0.1

TDQS

A4.2/5.0
Behavior4/5

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

Without relying on the annotations, it discloses a great deal of behavior: results are validated via pbi_validate_tmdl before being kept, culture is always emitted explicitly, code-like columns are forced to text, and HTML table selection emits warnings. The notable gap is the `overwrite` parameter, whose replacement semantics are never described even though destructiveHint is false — an agent cannot tell whether existing tables are replaced.

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?

Long but dense — each paragraph covers a distinct behavior (formats, .xls signature sniffing, HTML tables, culture inference, header autodetection, text codes) and there is no filler. It could be front-loaded more tightly around the core action, but every sentence earns its place.

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

Completeness3/5

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

For an 11-parameter mutating tool, coverage is good on behavior and formats, and the output schema removes any need to explain return values. However, the absence of any mention of `overwrite` (a mutation-relevant parameter) plus the undocumented table_name/description leaves meaningful gaps for an agent preparing the call.

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 carry the load, and it does for most parameters: path, sheet, culture, dry_run, table_id, skip_rows and text_columns all get real semantics (including the error case for a nonexistent text_columns name). It leaves overwrite, request_id, table_name and description unexplained, so it is strong but incomplete.

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?

States a specific verb+resource ('Carga un archivo al modelo') and frames it precisely as replicating a Power Query flow written directly into the project. It is clearly distinguishable from the sibling pbi_add_table_from_source, which implies a connector-based source rather than a local file.

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?

Gives concrete operational context: dry_run returns TMDL/M without writing, sheet only applies to xlsx, skip_rows forces/reverts autodetection, and the project must be closed in Power BI Desktop. It does not explicitly name the alternative tool (pbi_add_table_from_source) or state when NOT to use this one, so it stops short of a 5.

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