Skip to main content
Glama

vpp_apply_pattern

Applies creational design patterns (singleton, builder, factory, prototype) to a Visual Paradigm class model and writes the patterned result to a new .vpp file while keeping the original unchanged.

Instructions

Wzorce kreacyjne jako gotowe zmiany modelu klas (wynik do NOWEGO pliku, oryginał bez zmian).

  • singleton: Singleton. {"class":"DyspozytorDostaw"}: prywatny konstruktor, statyczne pole -instance i statyczna metoda +getInstance(). Opcjonalnie: "instance_field", "accessor", "drop_parameters":true (usuwa z metod innych klas parametry typu tej klasy, bo klienci biorą instancję przez getInstance()).

  • builder: Budowniczy (Builder). {"product":"Zamowienie","builder":"BudowniczyZamowienia","concrete_builder":"BudowniczyZamowieniaKlienta","director":"KierownikZamowien","steps":["+dodajPozycjeZKoszyka(koszyk : Koszyk) : void","+ustawUwagi(uwagi : String) : void"],"concrete_constructor":["klient : Klient","adres : Adres"],"product_constructor":"+Zamowienie(klient : Klient, adresDostawy : Adres)","product_operations":["+dodajPozycje(pozycja : PozycjaZamowienia) : void"],"clients":["Klient"]}. Powstają: interfejs budowniczego (kroki + operacja wyniku), konkretny budowniczy (realizacja, «create» produktu), kierownik (asocjacja do budowniczego, operacja konstruująca). Opcjonalnie: result_operation, director_operation, concrete_attributes, mark_product (domyślnie true).

  • factory_method: Metoda wytwórcza. {"product":"BramkaPlatnosci","concrete_products":["BramkaPlatnosciOnline"],"creator":"FabrykaBramek","factory_method":"utworzBramke","concrete_creators":["FabrykaBramekOnline"]}. Wytwórca abstrakcyjny z abstrakcyjną metodą wytwórczą i konkretni wytwórcy tworzący konkretne produkty.

  • abstract_factory: Fabryka abstrakcyjna. {"factory":"FabrykaPlatnosci","products":[{"name":"BramkaPlatnosci","method":"utworzBramke"},{"name":"Platnosc2","method":"utworzPlatnosc"}],"families":[{"name":"FabrykaOnline","products":{"BramkaPlatnosci":"BramkaPlatnosciOnline","Platnosc2":"PlatnoscOnline"}}],"clients":["Zamowienie"]}. Brakujące produkty konkretne są tworzone i podpinane do produktu abstrakcyjnego.

  • prototype: Prototyp. {"class":"Zamowienie","prototype":"Prototyp","clone_method":"klonuj","clients":["Klient"]}: interfejs z operacją klonowania, klasa go realizuje i dostaje +klonuj(). Wspólne parametry (params): "diagram" (na którym diagramie rysować nowe klasy; domyślnie główny), "positions" ({"Klasa":[x,y]}), "stereotypes" (true: role wzorca jako stereotypy klas, domyślnie true), "language" ("pl"/"en", nazwy ról), "fragment_diagram" (nazwa nowego diagramu klas z samym wzorcem, do studium), "fragment_context" (dodatkowe klasy na tym diagramie) i "fragment_folder" (Model/folder w Model Explorer, w którym ma leżeć fragment_diagram; brakujący zostanie utworzony). Wynik zawiera listę zmian i mapę ról. Żeby pokazać stan 'przed', zrób fragment_diagram w KOPII pliku sprzed wzorca (diagram jest widokiem modelu, więc w jednym pliku nie da się zachować 'przed' obok 'po').

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": {
      "source_path": "<source_path>",
      "output_path": "<output_path>",
      "pattern": "<pattern>",
      "params": "<params>"
    },
    "name": "vpp_apply_pattern"
  }
}

Input Schema

NameRequiredDescriptionDefault
paramsYes
patternYes
output_pathYes
source_pathYes
overwrite_outputNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the burden well: it discloses that output goes to a new file while the original stays unchanged, that the result contains a change list and role map, and that a diagram is a view of the model so 'before' and 'after' cannot coexist in one file. It omits what overwrite_output does when the target exists.

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 core purpose and the new-file/no-change guarantee are front-loaded before a structured bullet list of pattern recipes. The text is long but each pattern block earns its place by showing required and optional keys; some wording is dense but not redundant.

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 a five-parameter, nested-object tool with an output schema present and no annotations, the description covers the pattern payloads and the shared params thoroughly. The only meaningful omission is the overwrite_output behavior, which an agent needs before writing to an existing path.

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 coverage is 0%, so the description must compensate, and it does — it documents the params object fields (diagram, positions, stereotypes, language, fragment_diagram, fragment_context, fragment_folder) plus the per-pattern argument shapes. The notable gap is overwrite_output, which is never mentioned despite being a mutation-safety switch.

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 line states a specific verb and resource — applying creational design patterns as model changes written to a NEW file — and enumerates the five supported patterns (singleton, builder, factory_method, abstract_factory, prototype). It is clear what the tool does, though it never names a sibling (e.g. vpp_list_patterns or vpp_edit_class_model) to distinguish itself.

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

Usage Guidelines3/5

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

Usage is conveyed through per-pattern parameter recipes and one concrete tip (build a fragment_diagram in a copy of the pre-pattern file to preserve a 'before' state), but there is no explicit statement of when to choose this tool over vpp_edit_class_model or when not to use it.

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