@@ -137,19 +137,19 @@ type CreateResourceArgs struct {
137137}
138138
139139// SayHi is a simple MCP tool that requires authentication
140- func SayHi (ctx context.Context , req * mcp.ServerRequest [ * mcp. CallToolParamsFor [ struct {}]] ) (* mcp.CallToolResultFor [ struct {}] , error ) {
140+ func SayHi (ctx context.Context , req * mcp.CallToolRequest , args struct {}) (* mcp.CallToolResult , any , error ) {
141141 // Extract user information from context (set by auth middleware)
142142 userInfo := ctx .Value ("user_info" ).(* auth.TokenInfo )
143143
144- return & mcp.CallToolResultFor [ struct {}] {
144+ return & mcp.CallToolResult {
145145 Content : []mcp.Content {
146146 & mcp.TextContent {Text : fmt .Sprintf ("Hello! You have scopes: %v" , userInfo .Scopes )},
147147 },
148- }, nil
148+ }, nil , nil
149149}
150150
151151// GetUserInfo is an MCP tool that requires read scope
152- func GetUserInfo (ctx context.Context , req * mcp.ServerRequest [ * mcp. CallToolParamsFor [ GetUserInfoArgs ]] ) (* mcp.CallToolResultFor [ struct {}] , error ) {
152+ func GetUserInfo (ctx context.Context , req * mcp.CallToolRequest , args GetUserInfoArgs ) (* mcp.CallToolResult , any , error ) {
153153 // Extract user information from context (set by auth middleware)
154154 userInfo := ctx .Value ("user_info" ).(* auth.TokenInfo )
155155
@@ -163,26 +163,26 @@ func GetUserInfo(ctx context.Context, req *mcp.ServerRequest[*mcp.CallToolParams
163163 }
164164
165165 if ! hasReadScope {
166- return nil , fmt .Errorf ("insufficient permissions: read scope required" )
166+ return nil , nil , fmt .Errorf ("insufficient permissions: read scope required" )
167167 }
168168
169169 userData := map [string ]interface {}{
170- "requested_user_id" : req . Params . Arguments .UserID ,
170+ "requested_user_id" : args .UserID ,
171171 "your_scopes" : userInfo .Scopes ,
172172 "message" : "User information retrieved successfully" ,
173173 }
174174
175175 userDataJSON , _ := json .Marshal (userData )
176176
177- return & mcp.CallToolResultFor [ struct {}] {
177+ return & mcp.CallToolResult {
178178 Content : []mcp.Content {
179179 & mcp.TextContent {Text : string (userDataJSON )},
180180 },
181- }, nil
181+ }, nil , nil
182182}
183183
184184// CreateResource is an MCP tool that requires write scope
185- func CreateResource (ctx context.Context , req * mcp.ServerRequest [ * mcp. CallToolParamsFor [ CreateResourceArgs ]] ) (* mcp.CallToolResultFor [ struct {}] , error ) {
185+ func CreateResource (ctx context.Context , req * mcp.CallToolRequest , args CreateResourceArgs ) (* mcp.CallToolResult , any , error ) {
186186 // Extract user information from context (set by auth middleware)
187187 userInfo := ctx .Value ("user_info" ).(* auth.TokenInfo )
188188
@@ -196,24 +196,24 @@ func CreateResource(ctx context.Context, req *mcp.ServerRequest[*mcp.CallToolPar
196196 }
197197
198198 if ! hasWriteScope {
199- return nil , fmt .Errorf ("insufficient permissions: write scope required" )
199+ return nil , nil , fmt .Errorf ("insufficient permissions: write scope required" )
200200 }
201201
202202 resourceInfo := map [string ]interface {}{
203- "name" : req . Params . Arguments .Name ,
204- "description" : req . Params . Arguments .Description ,
205- "content" : req . Params . Arguments .Content ,
203+ "name" : args .Name ,
204+ "description" : args .Description ,
205+ "content" : args .Content ,
206206 "created_by" : "authenticated_user" ,
207207 "created_at" : time .Now ().Format (time .RFC3339 ),
208208 }
209209
210210 resourceInfoJSON , _ := json .Marshal (resourceInfo )
211211
212- return & mcp.CallToolResultFor [ struct {}] {
212+ return & mcp.CallToolResult {
213213 Content : []mcp.Content {
214214 & mcp.TextContent {Text : fmt .Sprintf ("Resource created successfully: %s" , string (resourceInfoJSON ))},
215215 },
216- }, nil
216+ }, nil , nil
217217}
218218
219219// authMiddleware extracts token information and adds it to the context
0 commit comments