Skip to content

required is ignored — all parameters treated as required, breaking optional params #20

Description

@givensik

Related: #19

Description

get_tool_params_description only iterates inputSchema["properties"] and never
reads inputSchema["required"], so every parameter is registered as required.
Calling a tool while omitting a genuinely optional parameter then fails, and
there is no way to satisfy both the gateway and the downstream server.

Reproduction

Notion MCP server, tool API-get-block-children, which has an optional
start_cursor parameter:

  • Include start_cursor: the caller has no value to send, so a placeholder
    such as the string "undefined" is passed, and Notion rejects it:
    query.start_cursor should be a valid uuid or 'undefined', instead was "undefined"
    
    (Notion expects the JS undefined / field absence, which a Python caller
    cannot express.)
  • Omit start_cursor: the gateway rejects the call because its generated
    signature marks the parameter as required.

Either way the tool is uncallable.

Root cause

mcp_gateway/config.pyget_tool_params_description:

properties = tool.inputSchema.get("properties", {})
for param_name, param_schema in properties.items():
    ...
    param_signatures.append((param_name, param_type, param_description))
# the "required" list is never read

Proposed fix

Read inputSchema.get("required", []), mark non-required parameters as optional
with a default, order required parameters before optional ones (so the resulting
inspect.Signature is valid), and drop unset optionals before forwarding the
call downstream.

Working implementation ready — will include it in the same PR as #19.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions