@@ -30,27 +30,27 @@ const (
30
30
31
31
func NewMCPServer () * server.MCPServer {
32
32
33
- callbacks := & server.Callbacks {}
33
+ hooks := & server.Hooks {}
34
34
35
- callbacks .AddBeforeAny (func (id any , method mcp.MCPMethod , message any ) {
35
+ hooks .AddBeforeAny (func (id any , method mcp.MCPMethod , message any ) {
36
36
fmt .Printf ("beforeAny: %s, %v, %v\n " , method , id , message )
37
37
})
38
- callbacks .AddAfterAny (func (id any , method mcp.MCPMethod , message any , result any ) {
38
+ hooks .AddAfterAny (func (id any , method mcp.MCPMethod , message any , result any ) {
39
39
fmt .Printf ("afterAny: %s, %v, %v, %v\n " , method , id , message , result )
40
40
})
41
- callbacks .AddOnError (func (id any , method mcp.MCPMethod , message any , err error ) {
41
+ hooks .AddOnError (func (id any , method mcp.MCPMethod , message any , err error ) {
42
42
fmt .Printf ("onError: %s, %v, %v, %v\n " , method , id , message , err )
43
43
})
44
- callbacks .AddBeforeInitialize (func (id any , message * mcp.InitializeRequest ) {
44
+ hooks .AddBeforeInitialize (func (id any , message * mcp.InitializeRequest ) {
45
45
fmt .Printf ("beforeInitialize: %v, %v\n " , id , message )
46
46
})
47
- callbacks .AddAfterInitialize (func (id any , message * mcp.InitializeRequest , result * mcp.InitializeResult ) {
47
+ hooks .AddAfterInitialize (func (id any , message * mcp.InitializeRequest , result * mcp.InitializeResult ) {
48
48
fmt .Printf ("afterInitialize: %v, %v, %v\n " , id , message , result )
49
49
})
50
- callbacks .AddAfterCallTool (func (id any , message * mcp.CallToolRequest , result * mcp.CallToolResult ) {
50
+ hooks .AddAfterCallTool (func (id any , message * mcp.CallToolRequest , result * mcp.CallToolResult ) {
51
51
fmt .Printf ("afterCallTool: %v, %v, %v\n " , id , message , result )
52
52
})
53
- callbacks .AddBeforeCallTool (func (id any , message * mcp.CallToolRequest ) {
53
+ hooks .AddBeforeCallTool (func (id any , message * mcp.CallToolRequest ) {
54
54
fmt .Printf ("beforeCallTool: %v, %v\n " , id , message )
55
55
})
56
56
@@ -60,7 +60,7 @@ func NewMCPServer() *server.MCPServer {
60
60
server .WithResourceCapabilities (true , true ),
61
61
server .WithPromptCapabilities (true ),
62
62
server .WithLogging (),
63
- server .WithCallbacks ( callbacks ),
63
+ server .WithHooks ( hooks ),
64
64
)
65
65
66
66
mcpServer .AddResource (mcp .NewResource ("test://static/resource" ,
0 commit comments