docs: document completion support (#495)

This commit is contained in:
Robert Findley 2025-09-18 14:27:35 -04:00 • committed by GitHub
commit 28753c9f12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,6 +16,7 @@ import (
// a CompletionHandler to an MCP Server's options.
func main() {
// Define your custom CompletionHandler logic.
// !+completionhandler
myCompletionHandler := func(_ context.Context, req *mcp.CompleteRequest) (*mcp.CompleteResult, error) {
// In a real application, you'd implement actual completion logic here.
// For this example, we return a fixed set of suggestions.
@ -43,6 +44,7 @@ func main() {
_ = mcp.NewServer(&mcp.Implementation{Name: "server"}, &mcp.ServerOptions{
CompletionHandler: myCompletionHandler,
})
// !-completionhandler
log.Println("MCP Server instance created with a CompletionHandler assigned (but not running).")
log.Println("This example demonstrates configuration, not live interaction.")