feat: prefer stateful runtime for mcp content access

This commit is contained in:
lda
2026-06-07 19:49:07 +07:00 Verified
parent 76ac0432a0
commit 8bb2f32d9a
14 changed files with 252 additions and 14 deletions
+2 -1
View File
@@ -8,11 +8,12 @@ from .converters import (
tool_to_discovered,
workflow_output_schema_from_mcp_tool_schema,
)
from .protocols import BackendAdapter, ToolCallResult, ToolExecutor
from .protocols import BackendAdapter, StatefulMcpRuntime, ToolCallResult, ToolExecutor
__all__ = [
"BackendAdapter",
"McpSdkAdapter",
"StatefulMcpRuntime",
"ToolCallResult",
"ToolExecutor",
"prompt_to_discovered",
+24
View File
@@ -99,8 +99,32 @@ class ToolExecutor(Protocol):
) -> ToolCallResult: ...
class StatefulMcpRuntime(ToolExecutor, Protocol):
"""Stateful execution/read boundary for configured MCP sources.
Implementations keep source session state across calls. Discovery/catalog
refresh may still use one-shot adapters by policy.
"""
async def read_resource(
self,
connection: McpSourceConnection,
auth: AuthRecord | None,
uri: str,
) -> dict[str, Any]: ...
async def get_prompt(
self,
connection: McpSourceConnection,
auth: AuthRecord | None,
prompt_name: str,
arguments: dict[str, str] | None = None,
) -> dict[str, Any]: ...
__all__ = [
"BackendAdapter",
"StatefulMcpRuntime",
"ToolCallResult",
"ToolExecutor",
]