MCPcopy Index your code
hub / github.com/github/github-mcp-server / OptionalIntParamWithDefault

Function OptionalIntParamWithDefault

pkg/github/params.go:216–225  ·  view source on GitHub ↗

OptionalIntParamWithDefault is a helper function that can be used to fetch a requested parameter from the request similar to optionalIntParam, but it also takes a default value.

(args map[string]any, p string, d int)

Source from the content-addressed store, hash-verified

214// OptionalIntParamWithDefault is a helper function that can be used to fetch a requested parameter from the request
215// similar to optionalIntParam, but it also takes a default value.
216func OptionalIntParamWithDefault(args map[string]any, p string, d int) (int, error) {
217 v, err := OptionalIntParam(args, p)
218 if err != nil {
219 return 0, err
220 }
221 if v == 0 {
222 return d, nil
223 }
224 return v, nil
225}
226
227// OptionalBoolParamWithDefault is a helper function that can be used to fetch a requested parameter from the request
228// similar to optionalBoolParam, but it also takes a default value.

Calls 1

OptionalIntParamFunction · 0.85

Tested by 1