The pipeline is a list of callables executed in order before syntax providers and map substitution. Each stage receives the current text, the context dict (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/iFamishedX/mapres/llms.txt
Use this file to discover all available pages before exploring further.
ctx), and the MapResolver instance — giving you full control over the string before any placeholder replacement occurs.
Pipeline stage signature
Every pipeline stage must accept exactly three positional arguments and return the transformed string:| Argument | Type | Description |
|---|---|---|
text | str | The current string, as it stands at this stage |
ctx | dict | The keyword arguments passed to resolver.res() |
resolver | MapResolver | The resolver instance (see Accessing the resolver) |
Configuring a pipeline
Pass a list of stage callables to thepipeline parameter of MapResolver:
Practical example — sanitize HTML entities before substitution
A common use case is escaping or stripping content before a template is filled in. For example, you may want to neutralize any HTML entities embedded in raw input:Multiple stages
Chain as many stages as you need by listing them in the order they should execute. Each stage receives the output of the previous one:Error handling
If any pipeline stage raises an exception,MapResolver catches it and re-raises it as a MapResError with a descriptive message:
MapResError (or its subclasses MissingKeyError and MapSyntaxError) at the call site, regardless of what the underlying stage raised.
Accessing the resolver inside a stage
The third argument to every stage is the liveMapResolver instance. This gives you read access to resolver.layers, resolver.syntax, resolver.pipeline, and resolver.max_depth from inside a stage — useful for context-aware transformations:
The resolver passed to a stage is the same instance that is executing the resolution. Modifying
resolver.pipeline or resolver.layers from within a stage affects subsequent resolution calls on the same resolver, so prefer read-only access unless you intentionally want that side effect.