Skip to content

Commit 1467efe

Browse files
committed
Improve docs
1 parent 6315dd1 commit 1467efe

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

contrib/mark3labs/mcp-go/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ func main() {
1717
tracer.Start()
1818
defer tracer.Stop()
1919

20+
// Do not use with `server.WithHooks(...)`, as this overwrites the tracing hooks.
21+
// Pass custom hooks via TracingConfig.Hooks instead which in turn is passed to server.WithHooks(...).
2022
srv := server.NewMCPServer("my-server", "1.0.0",
2123
mcpgotrace.WithTracing(&mcpgotrace.TracingConfig{}))
2224
}

contrib/mark3labs/mcp-go/option.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ type TracingConfig struct {
1616
}
1717

1818
// Pass to server.NewMCPServer to add tracing to the server.
19-
// Do not use with `server.WithHooks(...)`, as this overwrites the hooks. Pass custom hooks in the TracingConfig instead.
19+
// Do not use with `server.WithHooks(...)`, as this overwrites the hooks.
20+
// Pass custom hooks in the TracingConfig instead, which in turn is passed to server.WithHooks(...).
2021
func WithTracing(options *TracingConfig) server.ServerOption {
2122
return func(s *server.MCPServer) {
23+
if options == nil {
24+
options = new(TracingConfig)
25+
}
26+
2227
hooks := options.Hooks
2328

2429
// Append hooks (hooks is a private field)

0 commit comments

Comments
 (0)