Axiom A5: Why Tools Must Never Depend on Each Other
Axiom A5 forbids tools from depending on other tools. Here is why that small rule keeps a business-logic layer testable, acyclic and easy to change.
Open ten business functions in a typical codebase and you will find ten ways of checking input, ten shapes of return value and a few names that explain nothing. Nobody planned it that way. It accumulated. LVD avoids the drift by building every tool from the same template, so a colleague, an API route or an AI model can always predict what it will find.
In an LVD system, tools are not written freehand. A single factory function, createTool, accepts a configuration object and hands back two things: a serialisable descriptor that protocol layers use to register the tool, and a callable handler that does the work at runtime. The configuration has a slot for each of the five parts of a well-formed tool.
export const { tool, handler } = createTool({
name: "cancelRide",
description: "Cancel a booked ride before the driver arrives.",
schemas: { parameters: CancelRideParams, data: RideSchema },
annotations: { readOnlyHint: false, idempotentHint: true },
handler: async ({ rideId }) => {
const ride = await rideRepository.cancel(rideId);
return { text: `Ride ${rideId} cancelled`, data: ride };
},
});
Nothing in that file mentions HTTP, a prompt or a message format. It declares a capability, and the layers above decide how to present it.
The rule that surprises people most is that a handler contains no input checking at all. Validation is delegated entirely to the Schema layer. The wrapper that createTool puts around your handler parses the raw arguments against the parameters schema first. If they do not fit, a structured error is thrown before any business logic runs.
The consequence is a guarantee you can lean on: by the time the handler starts, its arguments are already well typed. There is no defensive code at the top of the function, and no chance of one tool being strict while its neighbour is lenient. Because the definition lives in Layer 1, the same contract can also describe the tool to a REST client or a model.
A handler returns an object with two fields. text is a human-readable summary, suitable for a chat window or a log line. data is a strongly typed payload that matches the data schema.
That dual shape lets each protocol layer pick what suits its audience. A REST endpoint takes data and sends JSON. An MCP server wraps text in content blocks for an agent. The tool itself never learns who is asking, which is exactly what you want from a layer that sits beneath both of them.
The fifth part is the most easily misread. The Model Context Protocol specification defines a handful of standard annotations. The book highlights four: readOnlyHint (the tool does not modify state), idempotentHint (repeated calls have the same effect), openWorldHint (the tool reaches entities outside the system) and title (a display name).
They inform how a caller retries and caches, but they do not create contractual obligations. Treat them as a courtesy to the caller, not a lock on the door. A tool marked read-only that quietly writes to a table is a bug in the tool, and no annotation will catch it for you.
The annotation set is also a place where a domain can extend the standard. The book's trading example adds its own flags and lets them travel through the registry into protocol descriptors, which we look at in the article on testing tools.
A tool is a name, a description, two schemas, a handler and some hints, produced by one factory. That uniformity is what lets the layers above treat tools as interchangeable parts: they can list them, call them and describe them without reading any of them. The next question is where all these tools should live on disk, which the article on organising business logic answers. For the layer itself, see Layer 4: Tools.