TypeScriptTransforms

Transforms

Reshape the tool catalog a client sees: progressive search, code mode, and visibility

Every tool your server registers is normally sent to the client in tools/list, schema and all. With a few tools that's fine. With hundreds, the catalog alone can fill the model's context before the conversation starts. Transforms sit between your tools and the client and reshape that catalog: they can hide tools until they're needed, replace the catalog with a search tool, or let the model run several tools from one script.

Why transforms

A large catalog costs tokens on every request and gives the model more tools to confuse with each other. Transforms send a small, stable catalog instead, and reveal the rest on demand.

Without transformstools/list returns everything
  • 100+ full tool schemas on every request
  • 15,000 to 40,000 tokens of catalog
  • More tools for the model to confuse
  • Too large for small-context models
With a search transformtools/list returns a few tools
  • search_tools and call_tool
  • Plus the tools you mark alwaysVisible
  • Schemas fetched only when needed
  • The same small catalog for every model

How a catalog request flows

Transforms run in the order you list them in @McpApp. A typical setup filters hidden tools first, then collapses what's left into a search tool.

tools/listFrom the client
Registered toolsEverything your server declares
VisibilityTransformDrops hidden tools for this session
Search or Code ModeCollapses the catalog
What the client seesMeta-tools and alwaysVisible tools

You add transforms in @McpApp:

@McpApp({
  module: AppModule,
  server: { name: 'enterprise-service', version: '1.0.0' },
  transforms: [
    new VisibilityTransform(),
    new BM25SearchTransform({ defaultLimit: 5, alwaysVisible: ['auth_login'] }),
  ],
})

Transforms

On this page