File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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(...).
2021func 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)
You can’t perform that action at this time.
0 commit comments