Skip to content

Commit 4d327cd

Browse files
committed
add logging
1 parent b16e716 commit 4d327cd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/mcp/client/session.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections.abc import Awaitable, Callable
22
from datetime import timedelta
3+
import logging
34
from typing import Any, Protocol, TypeAlias
45

56
import anyio.lowlevel
@@ -13,8 +14,10 @@
1314
from mcp.shared.session import BaseSession, ProgressFnT, RequestResponder
1415
from mcp.shared.version import SUPPORTED_PROTOCOL_VERSIONS
1516

16-
DEFAULT_CLIENT_INFO = types.Implementation(name="mcp", version="0.1.0")
1717

18+
logger = logging.getLogger(__name__)
19+
20+
DEFAULT_CLIENT_INFO = types.Implementation(name="mcp", version="0.1.0")
1821

1922
class SamplingFnT(Protocol):
2023
async def __call__(
@@ -472,16 +475,16 @@ async def __call__(
472475
raise RuntimeError(f"Unknown tool {request.params.name}")
473476
elif schema is False:
474477
# no schema
475-
# TODO add logging
478+
logging.debug('No schema found checking structuredContent is empty')
476479
return result.structuredContent is None
477480
else:
478481
try:
479482
# TODO opportunity to build jsonschema.protocol.Validator
480483
# and reuse rather than build every time
481484
validate(result.structuredContent, schema)
482485
return True
483-
except ValidationError:
484-
# TODO log this
486+
except ValidationError as e:
487+
logging.exception(e)
485488
return False
486489

487490
async def _refresh_schema_cache(self):

0 commit comments

Comments
 (0)