Skip to content

Commit 0cc0840

Browse files
committed
lint: type assertion in RequiredParam
1 parent b2d94b0 commit 0cc0840

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/github/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ func RequiredParam[T comparable](r mcp.CallToolRequest, p string) (T, error) {
7474
}
7575

7676
// Check if the parameter is of the expected type
77-
if _, ok := r.GetArguments()[p].(T); !ok {
77+
val, ok := r.GetArguments()[p].(T)
78+
if !ok {
7879
return zero, fmt.Errorf("parameter %s is not of type %T", p, zero)
7980
}
8081

81-
if r.GetArguments()[p].(T) == zero {
82+
if val == zero {
8283
return zero, fmt.Errorf("missing required parameter: %s", p)
83-
8484
}
8585

86-
return r.GetArguments()[p].(T), nil
86+
return val, nil
8787
}
8888

8989
// RequiredInt is a helper function that can be used to fetch a requested parameter from the request.

0 commit comments

Comments
 (0)