1+ import logging
12from collections .abc import Awaitable , Callable
23from datetime import timedelta
3- import logging
44from typing import Any , Protocol , TypeAlias
55
66import anyio .lowlevel
1414from mcp .shared .session import BaseSession , ProgressFnT , RequestResponder
1515from mcp .shared .version import SUPPORTED_PROTOCOL_VERSIONS
1616
17-
1817logger = logging .getLogger (__name__ )
1918
2019DEFAULT_CLIENT_INFO = types .Implementation (name = "mcp" , version = "0.1.0" )
2120
21+
2222class SamplingFnT (Protocol ):
2323 async def __call__ (
2424 self ,
@@ -451,6 +451,13 @@ async def _received_notification(
451451 pass
452452
453453
454+ class NoOpToolOutputValidator (ToolOutputValidationFnT ):
455+ async def __call__ (
456+ self , request : types .CallToolRequest , result : types .CallToolResult
457+ ) -> bool :
458+ return True
459+
460+
454461class SimpleCachingToolOutputValidator (ToolOutputValidationFnT ):
455462 _schema_cache : dict [str , dict [str , Any ] | bool ]
456463
@@ -475,7 +482,7 @@ async def __call__(
475482 raise RuntimeError (f"Unknown tool { request .params .name } " )
476483 elif schema is False :
477484 # no schema
478- logging .debug (' No schema found checking structuredContent is empty' )
485+ logging .debug (" No schema found checking structuredContent is empty" )
479486 return result .structuredContent is None
480487 else :
481488 try :
@@ -490,6 +497,7 @@ async def __call__(
490497 async def _refresh_schema_cache (self ):
491498 cursor = None
492499 first = True
500+ self ._schema_cache = {}
493501 while first or cursor is not None :
494502 first = False
495503 tools_result = await self ._session .list_tools (cursor )
0 commit comments