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

class McpResponse: (source)

View In Hierarchy

Compose protocol content without knowing the transport or DI container.

Class Method audio Encode raw audio bytes once.
Class Method error Return an application-visible tool error, with an explicit safe message.
Class Method image Encode raw image bytes once.
Class Method progress Yield progress; the dispatcher suppresses it without client opt-in.
Class Method resource Serialize and embed resource content according to its MIME type.
Class Method resourceLink Link to a resource without loading it.
Class Method structured Return any JSON value and the recommended serialized text content.
Class Method text Return text content.
Method _copyContent Retain generated-text ownership when cloning content metadata.
Method asAssistant Assign the assistant role for a prompt response.
Method asUser Assign the user role for a prompt response.
Method withAnnotations Set audience, priority and modification hints on content blocks.
Method withContentMeta Attach application metadata to each content block.
Method withMeta Attach result metadata without allowing reserved protocol keys.
Class Variable _structured_text Generated text block owned by structured content, excluding manual text.
Class Variable content Content blocks carried by this protocol value.
Class Variable is_error Is error flag used by McpResponse.
Class Variable meta Meta produced by field.
Class Variable progress_update Progress notification emitted independently of response content.
Class Variable role user.
def audio(cls, value: bytes, mime_type: str) -> Self: (source)

Encode raw audio bytes once.

Parameters
value:bytesValue to inspect, transform or validate.
mime_type:strValue supplied for mime_type.
Returns
typing.SelfResult of the operation described above.
def error(cls, message: str) -> Self: (source)

Return an application-visible tool error, with an explicit safe message.

Parameters
message:strValue supplied for message.
Returns
typing.SelfAn application-visible tool error, with an explicit safe message.
def image(cls, value: bytes, mime_type: str) -> Self: (source)

Encode raw image bytes once.

Parameters
value:bytesValue to inspect, transform or validate.
mime_type:strValue supplied for mime_type.
Returns
typing.SelfResult of the operation described above.
def progress(cls, current: float, total: float | None = None, message: str | None = None) -> Self: (source)

Yield progress; the dispatcher suppresses it without client opt-in.

Parameters
current:floatValue supplied for current.
total:float | NoneValue supplied for total.
message:str | NoneValue supplied for message.
Returns
typing.SelfResult of the operation described above.
def resource(cls, uri: str, value: object, mime_type: str | None = None) -> Self: (source)

Serialize and embed resource content according to its MIME type.

Parameters
uri:strValue supplied for uri.
value:objectNative msgspec-compatible data, or already encoded content. JSON data is normalized to builtins before strict validation. JSON strings and binary buffers are retained without re-encoding.
mime_type:str | NoneDeclared media type. Structured data defaults to application/json; MessagePack is emitted as Base64 binary resource content.
Returns
typing.SelfEmbedded content usable by tools, resources and prompts.
def resourceLink(cls, uri: str, name: str, *, title: str | None = None, description: str | None = None, mime_type: str | None = None) -> Self: (source)

Link to a resource without loading it.

Parameters
uri:strValue supplied for uri.
name:strValue supplied for name.
title:str | NoneValue supplied for title.
description:str | NoneValue supplied for description.
mime_type:str | NoneValue supplied for mime_type.
Returns
typing.SelfResult of the operation described above.
def structured(cls, value: object) -> Self: (source)

Return any JSON value and the recommended serialized text content.

Parameters
value:objectNative msgspec-compatible data normalized to a finite JSON value.
Returns
typing.SelfAny JSON value and the recommended serialized text content.
def text(cls, value: str) -> Self: (source)

Return text content.

Parameters
value:strValue to inspect, transform or validate.
Returns
typing.SelfText content.
def _copyContent(self, content: tuple[ContentBlock, ...]) -> Self: (source)

Retain generated-text ownership when cloning content metadata.

Parameters
content:tuple[orionis.mcp.protocol.content.ContentBlock, ...]Transformed content preserving the original blocks' order.
Returns
typing.SelfIndependent response retaining the corresponding generated block.
def asAssistant(self) -> Self: (source)

Assign the assistant role for a prompt response.

Returns
typing.SelfResult of the operation described above.
def asUser(self) -> Self: (source)

Assign the user role for a prompt response.

Returns
typing.SelfResult of the operation described above.
def withAnnotations(self, annotations: ContentAnnotations) -> Self: (source)

Set audience, priority and modification hints on content blocks.

Parameters
annotations:orionis.mcp.ContentAnnotationsValue supplied for annotations.
Returns
typing.SelfResult of the operation described above.
def withContentMeta(self, metadata: dict[str, object]) -> Self: (source)

Attach application metadata to each content block.

Parameters
metadata:dict[str, object]Metadata associated with the current operation.
Returns
typing.SelfResult of the operation described above.
def withMeta(self, metadata: dict[str, object]) -> Self: (source)

Attach result metadata without allowing reserved protocol keys.

Parameters
metadata:dict[str, object]Metadata associated with the current operation.
Returns
typing.SelfResult of the operation described above.
_structured_text: TextContent | None = (source)

Generated text block owned by structured content, excluding manual text.

content: tuple[ContentBlock, ...] = (source)

Content blocks carried by this protocol value.

is_error: bool = (source)

Is error flag used by McpResponse.

Meta produced by field.

progress_update: Progress | None = (source)

Progress notification emitted independently of response content.

role: Literal['user', 'assistant'] = (source)

user.