github/github-mcp-server · error
parameter %s is not of type %T
Error message
parameter %s is not of type %T
What it means
Thrown by RequiredParam in pkg/github/params.go when a required argument is present but its type does not match the expected Go type T. It is the second check of the generic extractor: the key exists, but args[p].(T) fails, e.g. a number where a string is required.
Source
Thrown at pkg/github/params.go:139
}
// RequiredParam is a helper function that can be used to fetch a requested parameter from the request.
// It does the following checks:
// 1. Checks if the parameter is present in the request.
// 2. Checks if the parameter is of the expected type.
// 3. Checks if the parameter is not empty, i.e: non-zero value
func RequiredParam[T comparable](args map[string]any, p string) (T, error) {
var zero T
// Check if the parameter is present in the request
if _, ok := args[p]; !ok {
return zero, fmt.Errorf("missing required parameter: %s", p)
}
// Check if the parameter is of the expected type
val, ok := args[p].(T)
if !ok {
return zero, fmt.Errorf("parameter %s is not of type %T", p, zero)
}
if val == zero {
return zero, fmt.Errorf("missing required parameter: %s", p)
}
return val, nil
}
// RequiredInt is a helper function that can be used to fetch a requested parameter from the request.
// It does the following checks:
// 1. Checks if the parameter is present in the request.
// 2. Checks if the parameter is of the expected type (float64 or numeric string).
// 3. Checks if the parameter is not empty, i.e: non-zero value
func RequiredInt(args map[string]any, p string) (int, error) {
v, ok := args[p]
if !ok {
return 0, fmt.Errorf("missing required parameter: %s", p)View on GitHub (pinned to 0ea1f775a7)
Solutions
- Match the exact JSON type declared in the tool's inputSchema for that key.
- Read the error text: it states the parameter name and the expected type.
- For numeric fields that must be strings, prefer tools whose params accept numeric strings (RequiredInt/RequiredBigInt paths).
- Add client-side schema validation to catch type mismatches before the request.
Example fix
// before
arguments = { owner: "octocat", repo: "hello", pull_number: "5" }
// after
arguments = { owner: "octocat", repo: "hello", pull_number: 5 } Defensive patterns
Strategy: type-guard
Validate before calling
function assertType(name, v, expected) {
if (v !== undefined && typeof v !== expected) {
throw new Error(`${name} must be ${expected}, got ${typeof v}`);
}
} Type guard
function isStringParam(v: unknown): v is string {
return typeof v === "string";
} Try / catch
Parse 'parameter X is not of type T' from the error result, coerce the named argument to the declared JSON type, and retry once.
Prevention
- Do not quote numbers or stringify booleans when building arguments.
- Derive argument types from the tool schema, not from loose any-typed objects.
- Add a client-side JSON-schema validator for outgoing tool calls.
When it happens
Trigger: owner: 42 or pull_number: "5" (when the handler uses RequiredParam[int]-style extraction) instead of the schema-declared type; arrays/objects passed to scalar required fields.
Common situations: Quoted numbers from form input or LLM output; client serializers that stringify everything; key-value confusion after schema changes.
Related errors
- parameter %s is not of type %T, is %T
- parameter %s is not of type string or null, is %T
- expected number, got %T
- invalid detail %q: must be one of "none", "stats", "full_pat
- parameter %s must not be empty
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/8e6f6db4dad30743.
Report an issue: GitHub.