API reference¶
The reference is generated from portr's docstrings and type annotations. It documents each module's public API: the names in its __all__.
portr.core¶
portr's core: what an outside client is offered, made from the composed commands.
No I/O and no MCP SDK. offered turns lattice's commands (lattice-core's Command, lattice
ADR-0041) into the tools and resource templates a client sees, for the toolsets its connection
may use: each command offered on the mcp surface and exposed as a tool, a resource or both, in
one of those toolsets. core is always among them (lattice RFC-0014). A tool's name is its
command's tool name, <package>_<name>, and its annotations follow from the command's tier,
reversibility and effects, so a client can tell a read from a change it can't undo.
tiers says which tiers each toolset holds, as the consent page shows them.
CORE
module-attribute
¶
The toolset every connection may use, whatever else it was given.
SURFACE
module-attribute
¶
The surface portr's MCP server offers commands on.
Annotations
pydantic-model
¶
Bases: BaseModel
What a tool tells a client of itself, as MCP's tool annotations say it.
Each is a hint, never a guarantee: the enforcer decides every call.
Config:
frozen:Truepopulate_by_name:Trueuse_attribute_docstrings:True
Fields:
-
read_only(bool) -
destructive(bool) -
idempotent(bool) -
open_world(bool)
Tool
pydantic-model
¶
Bases: BaseModel
A tool a client is offered: one command, as MCP's tools/list names it.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
-
name(str) -
command(str) -
description(str) -
input_schema(JsonObject) -
annotations(Annotations) -
toolset(Toolset) -
route(str | None) -
tenant_wide(bool)
Resource
pydantic-model
¶
Bases: BaseModel
A resource template a client is offered: one read, by the URI its command names.
Config:
frozen:Trueuse_attribute_docstrings:True
Fields:
Offered
pydantic-model
¶
offered
¶
offered(
commands: Iterable[Command],
*,
toolsets: Collection[Toolset] = (),
) -> Offered
Return the tools and resource templates a connection with these toolsets is offered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commands
|
Iterable[Command]
|
Every command of the composed catalogs, as the registry lists them. |
required |
toolsets
|
Collection[Toolset]
|
The toolsets the connection may use; |
()
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If a toolset isn't one of lattice-core's. |