ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

Serve a registered endpoint without owning routes, sessions or identities.

Method __init__ Retain immutable server metadata and one shared protocol dispatcher.
Async Method _closeFailedResponse Close failed-response events without suppressing cleanup interruptions.
Method _error Encode a sanitized protocol error with its required HTTP status.
Method _params Decode method parameters and validate compiled tool parameter headers.
Async Method _read Bound the native body stream before allocating the complete message.
Method _release Release a single request or response-stream admission slot.
Async Method _reportRequestFailure Report an HTTP request failure without passing an unset identifier.
Async Method _streamResponse Transfer event-source ownership to a response or clean up on failure.
Method _validateHttp Reject origins and unsupported media types before reading a body.
Async Method handle Validate HTTP metadata, dispatch once, and return native response objects.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _active Active value used by McpHttpTransport.
Instance Variable _app Application owning runtime failure reporting.
Instance Variable _compiled Precompiled metadata shared by request executions.
Instance Variable _config Validated configuration controlling this component.
Instance Variable _dispatcher Dispatcher produced by McpDispatcher.
Instance Variable _origins Origins produced by frozenset.
def __init__(self, app: IApplication, compiled: CompiledMcpServer, config: McpConfig, bus: IMcpEventBus): (source)

Retain immutable server metadata and one shared protocol dispatcher.

Parameters
app:orionis.IApplicationApplication container supplying configuration and dependencies.
compiled:orionis.mcp.server.compiler.CompiledMcpServerPrecompiled metadata shared by request executions.
config:orionis.mcp.config.McpConfigValidated configuration controlling this component.
bus:orionis.mcp.contracts.event_bus.IMcpEventBusValue supplied for bus.
Returns
NoneComplete the documented operation without returning a value.
async def _closeFailedResponse(self, events: _EventFrames, primary: BaseException): (source)

Close failed-response events without suppressing cleanup interruptions.

Parameters
events:orionis.mcp.transport.http._EventFramesEvent source to close after response construction fails.
primary:BaseExceptionConstruction or reporting failure retained if ordinary cleanup fails.
Returns
NoneClose the producer and release its admission slot.
Raises
BaseExceptionIf cleanup fails. Re-raise primary from an ordinary cleanup error; propagate cleanup cancellation or other non-Exception failures.
def _error(self, exception: McpProtocolException, request_id: str | int | msgspec.UnsetType) -> Response: (source)

Encode a sanitized protocol error with its required HTTP status.

Parameters
exception:orionis.mcp.exceptions.McpProtocolExceptionException being inspected or reported.
request_id:str | int | msgspec.UnsetTypeValue supplied for request_id.
Returns
orionis.http.ResponseResult of the operation described above.
def _params(self, request: Request, envelope: JsonRpcRequest) -> RequestParams: (source)

Decode method parameters and validate compiled tool parameter headers.

Parameters
request:orionis.http.RequestCurrent request and its trusted execution context.
envelope:orionis.mcp.protocol.requests.JsonRpcRequestValue supplied for envelope.
Returns
orionis.mcp.protocol.requests.RequestParamsResult of the operation described above.
async def _read(self, request: Request) -> bytes: (source)

Bound the native body stream before allocating the complete message.

Parameters
request:orionis.http.RequestCurrent request and its trusted execution context.
Returns
bytesResult of the operation described above.
def _release(self): (source)

Release a single request or response-stream admission slot.

Returns
NoneComplete the documented operation without returning a value.
async def _reportRequestFailure(self, exception: BaseException, request_id: str | int | msgspec.UnsetType, *, phase: str = 'request', expected: bool = False): (source)

Report an HTTP request failure without passing an unset identifier.

Parameters
exception:BaseExceptionRequest failure passed to the shared MCP reporting policy.
request_id:str | int | msgspec.UnsetTypeRequest identifier; convert msgspec.UNSET to None for reporting.
phase:str, optionalReporting phase, defaulting to "request".
expected:bool, optionalWhether shared reporting should treat the failure as expected.
Returns
NoneAwait shared failure reporting with HTTP transport metadata.
async def _streamResponse(self, events: _EventFrames, status: int) -> EventStreamResponse: (source)

Transfer event-source ownership to a response or clean up on failure.

Parameters
events:orionis.mcp.transport.http._EventFramesEvent source owning the producer iterator and admission slot.
status:intHTTP status code for the event-stream response.
Returns
orionis.http.responses.EventStreamResponseResponse owning the event source and its admission slot.
Raises
BaseExceptionIf response creation fails, after attempted reporting and cleanup. Reporting or cleanup interruptions may take precedence.
def _validateHttp(self, request: Request): (source)

Reject origins and unsupported media types before reading a body.

Parameters
request:orionis.http.RequestCurrent request and its trusted execution context.
Returns
NoneComplete the documented operation without returning a value.
async def handle(self, request: Request) -> Response: (source)

Validate HTTP metadata, dispatch once, and return native response objects.

Parameters
request:orionis.http.RequestCurrent request and its trusted execution context.
Returns
orionis.http.ResponseResult of the operation described above.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

Active value used by McpHttpTransport.

Application owning runtime failure reporting.

_compiled = (source)

Precompiled metadata shared by request executions.

Validated configuration controlling this component.

_dispatcher = (source)

Dispatcher produced by McpDispatcher.

_origins = (source)

Origins produced by frozenset.