Include context into completions (#966)

This commit is contained in:
Inna Harper 2025-06-17 09:33:25 +01:00 • committed by GitHub
commit a3bcabdce2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -433,6 +433,7 @@ class Server(Generic[LifespanResultT, RequestT]):
[
types.PromptReference | types.ResourceTemplateReference,
types.CompletionArgument,
types.CompletionContext | None,
],
Awaitable[types.Completion | None],
],
@ -440,7 +441,7 @@ class Server(Generic[LifespanResultT, RequestT]):
logger.debug("Registering handler for CompleteRequest")
async def handler(req: types.CompleteRequest):
completion = await func(req.params.ref, req.params.argument)
completion = await func(req.params.ref, req.params.argument, req.params.context)
return types.ServerResult(
types.CompleteResult(
completion=completion