The Anatomy of a Tool
Every LVD tool comes out of one factory with five named parts. Here is what they are, why validation stays out of the handler, and what a two-part result buys.
A new engineer is asked to change how a membership is cancelled. She searches the repository and finds three candidate files in three folders, one of them named after a sprint. Business logic that is hard to find tends to get written twice. LVD answers the problem with conventions so dull that nobody has to think about them: a place for every tool, a shape for every name, and a registry that finds them all.
The book is strict here: each tool gets its own directory, and that directory sits inside a parent named for a business domain. The tool file and its test live together. Schemas for the tool live in a parallel tree inside the Schema layer, laid out the same way, so you can predict the location of a schema from the location of the tool.
tools/src/
memberships/
cancelMembership/ (tool file + test file)
pauseMembership/
classes/
getTimetable/
schema/src/tools/
cancelMembership/ (parameters + data)
getTimetable/
The payoff is that navigation becomes mechanical. Domains answer "what area of the business is this?", the directory answers "which operation?", and the mirrored schema folder answers "what goes in and out?". Nobody opens a file to find out where to look next.
It also helps reviewers. A pull request that adds a tool but no matching schema folder, or drops a tool into a directory named after a team, is visibly off before anyone reads a line of code.
Tool names follow a verb-plus-noun pattern, so they sound like instructions: cancelMembership, pauseMembership. Read operations take a get prefix and checks take check, as in getTimetable or checkEligibility. The book warns against vague verbs such as handle, process and manage, because they hide what the tool actually does.
This is more than tidiness. As the anatomy of a tool explains, the name is what protocol layers route on and what agents select by. A model choosing between manageMembership and a dozen siblings has very little to go on, while a verb and a noun tell it something real. Every name must also be unique across the whole system, and the registry is what enforces that.
At startup, a registry walks the tool directories, loads each tool's descriptor and handler, and checks that no two share a name. A duplicate stops startup. Whatever survives is exposed in two ways: a listing of descriptors, and a lookup of handlers by name.
const registry = new Map<string, ToolEntry>();
for (const dir of toolDirectories) {
const { tool, handler } = await import(dir);
if (registry.has(tool.name)) {
throw new Error(`Two tools share the name ${tool.name}`);
}
registry.set(tool.name, { tool, handler });
}
The consumers are the protocol layers. A REST router, a GraphQL resolver or an MCP server asks the registry what exists and delegates each incoming request to the handler registered under that name. The consequence worth remembering is that adding a tool requires no change to any protocol layer. The tool is found automatically at startup.
Think about what that does to the volatility story. Both the protocol layers and the Tools layer change often, and the registry lets each one change on its own timetable. A new business operation does not force an edit in the layers above it, and a new protocol does not force an edit in any tool. The registry is the single narrow point where the two meet.
None of these three conventions is clever. A directory per tool, a verb and a noun per name, and a registry that refuses duplicates are all easy to adopt and easy to check mechanically. Together they make the Tools layer something a person can navigate and a protocol layer can enumerate. For the principle behind the folder structure, see the folder-as-layer principle, and for how a model ends up seeing the registry's output, the MCP layer.