Technology · Discipline

Schema-driven build-time code generation

YAML tool schemas compile into dispatch at build time in my MCP gateway and the execution substrate, so a tool cannot be half-wired.

Rust build scripts and procedural macrosMCP gateway and control planeLink-time registration
One declaration · three compiled outputs
Rust modules
routing table
advertised JSON Schema
  • 18tool surfaces declared in YAML
  • ~180actions across those surfaces
  • 8sections in every API connectivity profile

Tools added by writing files

FAFO Core and Function Forge has a tool surface that grows constantly, and I decided nobody would hand-edit dispatch code to add a tool. Declarations live in YAML and the dispatch code is generated, so a new tool is a data change. The model-facing MCP gateway compiles YAML at build time, and input schemas come from the same metadata that drives routing, so they cannot drift from the implementation. The control plane compiles an auto-registration file into its dependency list and an extern-crate macro, and each function crate registers its execution handler and control target at link time.

That is how Function Forge adds a tool by writing files. The generator writes the gateway's definitions and the control plane's registration entry, and the next build turns them into routing, schemas and registration. Nothing registers at runtime. See Tools that build tools, under governance.

A complete declaration · fully wired
A piece missing · the build fails
1 YAML written2 modules3 routing4 schema5 registered at link

APIs as connectivity profiles

The API integration platform applies the same idea to external systems. Each API is a connectivity profile with a fixed set of sections, compiled into a generic runtime that is built once. See Closed by evidence.

Profiles, one per API
each: connect, authentication, read, change detection, write, entities and indexes, webhooks, limits
Generic runtime · built once
a new API adds a profile, not code

One contract for producer and consumer

FAFOHive gets its media tools from a contracts crate that defines each tool's JSON Schema, examples and validation. The same crate compiles into the media service and the memory server, so the schema an agent sees and the schema the service enforces have one source.

Contracts crateJSON Schema, examples, validation
Media serviceenforces it
Memory servershows it to agents

I move integration work out of hand-written code into declarations the build compiles and checks, because that keeps a fast-growing tool estate consistent.

The techniques are standard Rust build scripts and procedural macros; my contribution is making them the single path for every tool.