Skip to main content
Glama

tia_programar

Writes and imports PLC program blocks (KOP, SCL, XML) in TIA Portal, compiles each change, restores the previous block if compilation fails, and returns errors for correction.

Instructions

Escribir programa. Cada escritura valida, respalda el bloque si existía, importa y COMPILA; si no compila y el bloque existía, lo restaura. Devuelve los errores para corregirlos.

  • ayuda_kop: formato JSON de los bloques KOP y catálogo de instrucciones (TON, CTU, MOVE, PID...).

  • crear_kop: especificacion JSON (FB/FC/OB en KOP). Usa action='ayuda_kop' la primera vez.

  • importar_scl: codigo SCL con uno o varios FUNCTION_BLOCK/FUNCTION/DATA_BLOCK/TYPE. Ideal para PID, cálculos, máquinas de estado y UDT.

  • importar_xml: xml SimaticML completo.

  • crear_maquina_estados: especificacion de una máquina de estados Moore o Mealy → FB en KOP (comparadores + MOVE) o SCL (CASE), más su diagrama de estados (Mermaid) para documentar. Ver action='ayuda_maquina_estados'. Para programación por BANDERAS (S/R) usa crear_kop.

  • crear_db_instancia: nombre del DB + fb [+ numero].

  • borrar_bloque: nombre. carpeta = carpeta de bloques destino ('Motores/Bombas'), se crea si no existe.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "tia_programar"
  }
}

Input Schema

NameRequiredDescriptionDefault
fbNo
plcNo
xmlNo
actionYes
codigoNo
nombreNo
numeroNo
carpetaNo
especificacionNo
compilar_despuesNo
restaurar_si_fallaNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv4.0.0

TDQS

A4.2/5.0
Behavior5/5

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

The annotations only declare readOnlyHint=false, destructiveHint=false, openWorldHint=false; the description adds substantive behavior the agent could not otherwise know: every write validates, backs up an existing block, imports, then compiles, and restores the prior block if compilation fails, returning the errors so they can be fixed. That transactional/rollback semantics is exactly the kind of non-structural context that matters for a mutation tool. Minor caveat: borrar_bloque deletes a block while destructiveHint=false, and the description does not say whether that delete also takes a backup.

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 critical behavior (validate/backup/compile/restore) is front-loaded in the first sentence, and the per-action bullets are information-dense with no filler. The trailing 'carpeta' note sits awkwardly after the action list rather than with the parameters, and the description is fairly long. Both are minor against how much signal per line it delivers.

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

Completeness4/5

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

For an 11-parameter, 8-action write tool this covers the essentials, and an output schema exists so return values need not be re-explained. Rollback behavior, error surfacing, and per-action payload mapping are all present. What is missing is the 'plc' targeting parameter and any prerequisite such as an open project/session, which matters for a tool that mutates a live PLC project.

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 parameter load, and it does for most: especificacion for crear_kop/crear_maquina_estados, codigo for importar_scl, xml for importar_xml, nombre+fb+numero for crear_db_instancia, nombre for borrar_bloque, carpeta for the destination path with an example ('Motores/Bombas') and the note that it is created if absent. The notable gap is the 'plc' parameter, which is never mentioned, and compilar_despues/restaurar_si_falla are only implied by the described compile-and-restore behavior.

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

Purpose4/5

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

The opening 'Escribir programa' is broad, but the bulleted enumeration of the eight actions (crear_kop, importar_scl, importar_xml, crear_maquina_estados, crear_db_instancia, borrar_bloque, ayuda_kop, ayuda_maquina_estados) tells an agent exactly what each entry point produces. It is clearly distinguishable from siblings such as tia_bloques or tia_compilar because it is the write/import path. It stops short of 5 only because the umbrella verb is vague until the bullets are read.

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?

It gives real routing guidance: 'Usa action=ayuda_kop la primera vez', 'Ver action=ayuda_maquina_estados', and an explicit exclusion — 'Para programación por BANDERAS (S/R) usa crear_kop' rather than crear_maquina_estados. It also steers PID/state machines/UDTs to importar_scl and says when to use XML (complete SimaticML). It does not state prerequisites (open project/session, which sibling handles compilation), so it is not a full 5.

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