MCP¶
The MCP protocol assertables and content blocks. See the MCP guide for examples and the full method catalog.
pyssertive.protocols.mcp.AssertableMCP ¶
Source code in src/pyssertive/protocols/mcp/assertable.py
negotiated_protocol ¶
server_named ¶
Source code in src/pyssertive/protocols/mcp/assertable.py
server_version ¶
Source code in src/pyssertive/protocols/mcp/assertable.py
supports_tools ¶
supports_resources ¶
Source code in src/pyssertive/protocols/mcp/assertable.py
supports_prompts ¶
supports_logging ¶
has_instructions ¶
lists_tools ¶
lists_tools() -> AssertableToolList
lists_prompts ¶
lists_prompts() -> AssertablePromptList
prompt ¶
prompt(name: str) -> AssertablePromptGet
Source code in src/pyssertive/protocols/mcp/assertable.py
is_prompts_list_changed_notification ¶
Source code in src/pyssertive/protocols/mcp/assertable.py
tool ¶
tool(name: str) -> AssertableToolCall
Source code in src/pyssertive/protocols/mcp/assertable.py
is_rejected_with_code ¶
is_rejected_as_parse_error ¶
is_rejected_as_invalid_request ¶
is_rejected_as_method_not_found ¶
is_rejected_with_invalid_params ¶
is_rejected_as_internal_error ¶
is_rejected_as_resource_not_found ¶
is_rejected_as_user_rejected ¶
because_message_contains ¶
Source code in src/pyssertive/protocols/mcp/assertable.py
because_message_equals ¶
Source code in src/pyssertive/protocols/mcp/assertable.py
pyssertive.protocols.mcp.AssertableToolList ¶
Source code in src/pyssertive/protocols/mcp/tools.py
with_count ¶
contains_tool ¶
contains_tool(
name: str,
callback: Callable[[AssertableToolDef], Any]
| None = None,
) -> Self
Source code in src/pyssertive/protocols/mcp/tools.py
does_not_contain_tool ¶
every_tool ¶
every_tool(
callback: Callable[[AssertableToolDef], Any],
) -> Self
pyssertive.protocols.mcp.AssertableToolDef ¶
Source code in src/pyssertive/protocols/mcp/tools.py
documented ¶
accepts ¶
Source code in src/pyssertive/protocols/mcp/tools.py
accepts_optional ¶
Source code in src/pyssertive/protocols/mcp/tools.py
does_not_accept ¶
Source code in src/pyssertive/protocols/mcp/tools.py
pyssertive.protocols.mcp.AssertableToolCall ¶
Source code in src/pyssertive/protocols/mcp/tools.py
succeeds ¶
returns_text ¶
Source code in src/pyssertive/protocols/mcp/tools.py
returns_text_containing ¶
Source code in src/pyssertive/protocols/mcp/tools.py
returns_image ¶
Source code in src/pyssertive/protocols/mcp/tools.py
returns_content_count ¶
returns_structured ¶
Source code in src/pyssertive/protocols/mcp/tools.py
content ¶
content(
index: int,
callback: Callable[[AssertableContent], Any]
| None = None,
) -> AssertableContent | Self
Source code in src/pyssertive/protocols/mcp/tools.py
reports_tool_error ¶
with_message_containing ¶
Source code in src/pyssertive/protocols/mcp/tools.py
is_rejected_as_unknown_tool ¶
Source code in src/pyssertive/protocols/mcp/tools.py
is_rejected_with_invalid_params ¶
Source code in src/pyssertive/protocols/mcp/tools.py
pyssertive.protocols.mcp.AssertablePromptList ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
with_count ¶
contains_prompt ¶
contains_prompt(
name: str,
callback: Callable[[AssertablePromptDef], Any]
| None = None,
) -> Self
Source code in src/pyssertive/protocols/mcp/prompts.py
does_not_contain_prompt ¶
every_prompt ¶
every_prompt(
callback: Callable[[AssertablePromptDef], Any],
) -> Self
pyssertive.protocols.mcp.AssertablePromptDef ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
documented ¶
accepts ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
accepts_optional ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
does_not_accept ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
pyssertive.protocols.mcp.AssertablePromptGet ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
with_description ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
with_description_containing ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
succeeds ¶
with_message_count ¶
first_message ¶
first_message(
callback: Callable[[AssertablePromptMessage], Any]
| None = None,
) -> AssertablePromptMessage | Self
message ¶
message(
index: int,
callback: Callable[[AssertablePromptMessage], Any]
| None = None,
) -> AssertablePromptMessage | Self
last_message ¶
last_message(
callback: Callable[[AssertablePromptMessage], Any]
| None = None,
) -> AssertablePromptMessage | Self
every_message ¶
every_message(
callback: Callable[[AssertablePromptMessage], Any],
) -> Self
Source code in src/pyssertive/protocols/mcp/prompts.py
is_rejected_with_invalid_params ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
with_message_containing ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
pyssertive.protocols.mcp.AssertablePromptMessage ¶
Source code in src/pyssertive/protocols/mcp/prompts.py
is_from_user ¶
is_from_assistant ¶
content ¶
content(
callback: Callable[[AssertableContent], Any]
| None = None,
) -> AssertableContent | Self
pyssertive.protocols.mcp.AssertableContent ¶
Fluent assertions over a single MCP content block.
Value-asserting methods auto-dispatch based on the block's type field.
Compatibility:
| Method | Compatible types |
|---|---|
| is_text / is_image / is_audio / is_resource_link / is_resource | standalone type guards |
| with_text / with_text_containing | text, resource |
| is_not_empty | text, resource, image, audio |
| with_mime_type | image, audio, resource_link, resource |
| with_uri / named | resource_link, resource |
| with_base64_data | image, audio |
| with_blob_data | resource |
Calling a method on an incompatible block raises AssertionError listing the expected types and the actual type observed.
Source code in src/pyssertive/protocols/mcp/content.py
is_text ¶
is_image ¶
is_audio ¶
is_resource_link ¶
is_resource ¶
with_text ¶
with_text_containing ¶
is_not_empty ¶
Source code in src/pyssertive/protocols/mcp/content.py
with_mime_type ¶
Source code in src/pyssertive/protocols/mcp/content.py
with_base64_data ¶
with_blob_data ¶
with_uri ¶
Source code in src/pyssertive/protocols/mcp/content.py
named ¶
Source code in src/pyssertive/protocols/mcp/content.py
pyssertive.protocols.mcp.ErrorCode ¶
Bases: IntEnum