Skip to main content
Glama
Ivan-Madera

midd-nestjs-hexagonal-architecture-mcp

by Ivan-Madera

generate_from_spec

Generates a NestJS hexagonal module from a declarative middleware.spec.yaml, validating and planning output by default; set dryRun=false to write the module slice per use case.

Instructions

Genera un módulo hexagonal a partir de un middleware.spec.yaml declarativo (agnóstico de dominio: module/entity/use_cases los define el usuario en el spec). Soporta casos de uso con N métodos por puerto (inbound/outbound). Con dryRun=true (default) valida el spec y devuelve el PLAN de generación (casos, métodos, archivos) SIN escribir disco; con dryRun=false genera el slice por cada caso reutilizando add_use_case. Respeta las reglas de get_rules.

Input Schema

NameRequiredDescriptionDefault
modeNoModo de generación. "greenfield" (default): servicio nuevo, cablea app.module y mergea módulos del dataset. "refactor": proyecto existente — NO toca app.module ni módulos ajenos; genera el slice hexagonal para que el agente lo adapte a la infra del proyecto.greenfield
dryRunNoSi true (default): valida el spec y devuelve el PLAN de generación SIN escribir disco. Si false: genera el módulo.
specPathYesRuta absoluta al middleware.spec.yaml a generar. La ubicación la decide el usuario (no se impone carpeta).
overwriteNoSi true, sobrescribe archivos existentes. Por defecto false (no pisa).
projectRootYesRuta absoluta de la raíz del servicio NestJS destino donde se escriben los archivos.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/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 dryRun is the default (safe), that false writes to disk, that it reuses add_use_case, and that it honors get_rules. It doesn't cover failure behavior on invalid specs, permissions, or idempotency, which keeps it off a 5.

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?

Front-loaded with the purpose, then dryRun semantics, then the dependencies on add_use_case and get_rules. Fairly tight, though the dryRun explanation partly duplicates the schema's own description.

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?

With no output schema, the description usefully says what dryRun=true returns (the plan: use cases, methods, files) so the agent knows the shape of the response. Missing only failure-mode and mode-selection detail for a five-parameter file-writing tool.

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

Parameters3/5

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

Schema coverage is 100%, so the schema already documents all five parameters including the mode enum and overwrite semantics. The description reinforces dryRun and specPath at a conceptual level but adds no syntax beyond the schema and never mentions the mode parameter's greenfield/refactor distinction.

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 and resource ("Genera un módulo hexagonal a partir de un middleware.spec.yaml") plus the scope (domain-agnostic, N methods per inbound/outbound port). It also differentiates from siblings by noting it reuses add_use_case and respects get_rules, so an agent can distinguish it without opening a schema.

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?

Explains the two operational modes clearly: dryRun=true validates and returns a plan without disk writes, dryRun=false generates the slice per use case. However, it doesn't state when to prefer this over scaffold_service or add_use_case directly, nor 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.