Orchestrata Ultimate › Tests › Reference › session › test_session_mcp_tools

Tests reference — tests/session/test_session_mcp_tools.py

Module of tests/session, split out because the directory page would be too large.

Prose pending.

tests/session/test_session_mcp_tools.py

source · 23 tests · 495 lines

Tests for SessionMCPTools — MCP integration for session management.

Covers: infra.redis_state, session.fact_emitter, session.mcp_tools, session.redis_store, session.types

Kind Name Line Description
class TestToolDefinitions 79 Verify MCP tool schema structure.
method TestToolDefinitions.test_tool_definitions_count 82 All 6 session tools are defined.
method TestToolDefinitions.test_tool_definitions_schema 87 Every tool has name, description, and inputSchema.
method TestToolDefinitions.test_tool_names 98 Tool names match the expected set.
method TestToolDefinitions.test_fact_type_enum_in_schemas 111 Tools that accept fact_type include the FactType enum values.
class TestSessionCreate 125 Test session_create tool.
method TestSessionCreate.test_create_session_via_mcp 128 Creating a session returns session_id and status 'created'.
method TestSessionCreate.test_create_session_with_goals 136 Creating a session with goals stores them.
method TestSessionCreate.test_create_session_marks_active 145 Creating a session marks it as active in Redis.
class TestSessionGet 156 Test session_get tool.
method TestSessionGet.test_get_session_via_mcp 159 Retrieving a created session returns its data.
method TestSessionGet.test_get_nonexistent_session 168 Getting a nonexistent session returns an error dict.
class TestSessionClose 182 Test session_close tool.
method TestSessionClose.test_close_session_via_mcp 185 Closing a session returns status 'closed'.
method TestSessionClose.test_close_removes_session_data 192 After close, session_get returns error.
method TestSessionClose.test_close_clears_active 199 After close, session is no longer marked active.
class TestEmitFact 211 Test session_emit_fact tool.
method TestEmitFact.test_emit_fact_via_mcp 214 Emitting a fact returns status 'fact_emitted' and a fact_id.
method TestEmitFact.test_emit_each_fact_type 231 Every FactType value can be emitted without error.
class TestQueryFacts 252 Test session_query_facts tool.
method TestQueryFacts.test_query_facts_via_mcp 255 Querying facts after emission returns the emitted facts.
method TestQueryFacts.test_query_facts_with_filter 278 Filtering by fact_type returns only matching facts.
method TestQueryFacts.test_query_facts_empty_session 308 Querying a session with no facts returns empty list.
class TestFactCount 323 Test session_fact_count tool.
method TestFactCount.test_fact_count_via_mcp 326 Fact count reflects the number of emitted facts.
method TestFactCount.test_fact_count_zero 345 Fact count is 0 for a session with no facts.
class TestErrorHandling 358 Test error paths and unknown tools.
method TestErrorHandling.test_unknown_tool_returns_error 361 Calling an unknown tool returns an error dict.
method TestErrorHandling.test_invalid_fact_type_raises 367 Emitting an invalid fact_type raises ValueError.
class TestFullLifecycle 386 End-to-end MCP session lifecycle tests.
method TestFullLifecycle.test_full_session_lifecycle_via_mcp 389 Complete lifecycle: create -> emit facts -> query -> count -> close.
method TestFullLifecycle.test_multiple_sessions_via_mcp 451 Manage multiple independent sessions concurrently.