tools/call request passes through a deterministic pipeline. The stages are identical for DB-backed and script-backed tools — only the execution step differs. If any stage fails, execution halts immediately and an error response is returned.
Every tool invocation passes through the same deterministic pipeline
Tool resolution
Hyperterse matches the tool name fromtools/call to the tool definition it loaded for that server run.
If no tool matches, a JSON-RPC error is returned with code -32601.
Authentication
If the tool defines anauth block, the configured plugin is invoked with the request context and policy parameters.
- Plugin returns
nil: authentication passes; the request continues. - Plugin returns an error: the request stops; the error goes back to the caller.
- No
authblock: stage is skipped entirely.
Input transform
Ifmappers.input is configured or discovered by convention, the mapper script’s export default function executes in the embedded runtime.
Payload:
Execution
The execution stage branches based on the tool’s configuration. Only one path runs per invocation.Script-backed tools
Whenhandler is configured, the handler script’s export default function executes in the embedded runtime. The return value becomes the execution result.
DB-backed tools
Whenuse and statement are configured, the executor runs six substeps:
- Input validation — validate all declared inputs against type definitions. Missing required inputs and type mismatches produce errors.
- Environment substitution — resolve
{{ env.VAR }}placeholders. Missing variables produce errors. - Input substitution — replace
{{ inputs.field }}placeholders with post-transform values. Substitution is textual. - Cache check — if caching is enabled, compute the cache key from tool name + statement hash. On hit, return cached result and skip connector execution.
- Connector execution — run the statement against the configured connector and return row/object results.
- Cache store — on miss, store the result with the configured TTL.
Output transform
Ifmappers.output is configured or discovered by convention, the mapper script’s export default function executes in the embedded runtime.
Payload:
Response serialization
The final result is JSON-encoded and wrapped in an MCP content block:Error propagation
Error messages from scripts and connectors are included in the response. Stack traces are logged at debug level but not exposed to callers.