How your AI agent understands your content

forge_description and forge_format are struct tags that bake field semantics directly into the MCP schema. The agent knows what each field means and what format it expects -- without a system prompt.

When an AI agent calls create_post, it sees a tool schema. That schema includes field names, types, and validation constraints. Without anything else, the agent is guessing what body means, whether excerpt is optional, and what format title expects.

Forge solves this at the struct level.

type Post struct {
    forge.Node
    Title   string `forge:"required,min=3"    forge_description:"The headline of the post"`
    Excerpt string `forge:"required"           forge_description:"1-2 sentences shown in the devlog list and used as meta description"`
    Body    string `forge:"required"           forge_format:"markdown"`
    Tags    []string
}

Two tags do the work: forge_description and forge_format.

forge_description

Becomes the field's description in the generated JSON Schema. When the MCP client sends initialize, the tool definitions it receives include these descriptions inline -- as part of the schema, not as external documentation.

The agent does not need a system prompt explaining what excerpt is for. It reads the tool definition and the description is already there: "1-2 sentences shown in the devlog list and used as meta description."

This applies to both layers. In the operations layer, the agent calling create_post knows what to write in each field. In the reading layer, .aidoc responses are shaped by the same field definitions -- the agent that reads content and the agent that writes it share the same understanding of what each field contains.

forge_format

Signals to the agent what syntax a field expects. forge_format:"markdown" tells the agent that body is markdown -- not plain text, not HTML. The agent formats its output accordingly without being told in a prompt.

Currently supported: markdown. The tag is designed to extend.

The other struct tags

For completeness, the full set of struct tags Forge reads:

TagPurpose
forge:"required,min=N"Validation -- enforced in HTTP handler and MCP tool
forge_description:"..."Field description in MCP schema
forge_format:"..."Expected syntax (markdown)
db:"column_name"Database column name override

Validation via forge tags is enforced everywhere -- HTTP form submissions, API calls, and MCP tool calls go through the same validation path. An agent cannot bypass field requirements any more than a browser form can.

What this replaces

The alternative is writing field explanations into a system prompt and hoping the agent reads them, applies them correctly, and that they stay in sync with the actual schema as your content types evolve.

With struct tags, the schema is the documentation. The two cannot drift apart because they are the same thing.