fix: replace http code by jsonrpc (#1920)

This commit is contained in:
Marcelo Trylesinski 2026-01-21 18:37:55 +01:00 • committed by GitHub
commit 656f887aff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 13 deletions

View file

@ -281,10 +281,7 @@ class StreamableHTTPSessionManager:
error_response = JSONRPCError(
jsonrpc="2.0",
id="server-error",
error=ErrorData(
code=INVALID_REQUEST,
message="Session not found",
),
error=ErrorData(code=INVALID_REQUEST, message="Session not found"),
)
response = Response(
content=error_response.model_dump_json(by_alias=True, exclude_none=True),

View file

@ -50,12 +50,7 @@ def validate_sampling_tools(
"""
if tools is not None or tool_choice is not None:
if not check_sampling_tools_capability(client_caps):
raise McpError(
ErrorData(
code=INVALID_PARAMS,
message="Client does not support sampling tools capability",
)
)
raise McpError(ErrorData(code=INVALID_PARAMS, message="Client does not support sampling tools capability"))
def validate_tool_use_result_messages(messages: list[SamplingMessage]) -> None: