refactor: split RequestContext between server and client (#1987)

This commit is contained in:
Marcelo Trylesinski 2026-02-03 14:35:07 +01:00 • committed by GitHub
commit b1f7eec3cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 210 additions and 212 deletions

View file

@ -19,7 +19,7 @@ server_params = StdioServerParameters(
# Optional: create a sampling callback
async def handle_sampling_message(
context: RequestContext[ClientSession, None], params: types.CreateMessageRequestParams
context: RequestContext[ClientSession], params: types.CreateMessageRequestParams
) -> types.CreateMessageResult:
print(f"Sampling request: {params.messages}")
return types.CreateMessageResult(

View file

@ -38,7 +38,7 @@ from mcp.types import URL_ELICITATION_REQUIRED
async def handle_elicitation(
context: RequestContext[ClientSession, Any],
context: RequestContext[ClientSession],
params: types.ElicitRequestParams,
) -> types.ElicitResult | types.ErrorData:
"""Handle elicitation requests from the server.