Skip to content

fix: remove Required() from parameters with DefaultString() - #70

Open
vikasprogrammer wants to merge 1 commit into
zerodha:masterfrom
vikasprogrammer:fix/variety-required-default
Open

fix: remove Required() from parameters with DefaultString()#70
vikasprogrammer wants to merge 1 commit into
zerodha:masterfrom
vikasprogrammer:fix/variety-required-default

Conversation

@vikasprogrammer

Copy link
Copy Markdown

Summary

  • Removes mcp.Required() from parameters that have mcp.DefaultString() set (variety, exchange, quantity) across all order tools
  • The MCP Go SDK does not apply default values when Required() is set and the client omits the field, causing validation errors like parameter 'variety': is required
  • Updates corresponding ValidateRequired() calls in handlers to match

Affected tools

  • place_order (variety, exchange, quantity)
  • modify_order (variety)
  • cancel_order (variety)
  • place_gtt_order (exchange)
  • modify_gtt_order (exchange)

Fixes #69

Test plan

  • Call place_order without specifying variety — should default to "regular" instead of erroring
  • Call place_order with explicit variety value — should still work
  • Call cancel_order and modify_order without variety — should default to "regular"
  • Call GTT tools without exchange — should default to "NSE"

🤖 Generated with Claude Code

The MCP Go SDK does not apply default values when Required() is set and
the client omits the field, causing validation errors like "parameter
'variety': is required". This removes Required() from variety, exchange,
and quantity parameters that already have sensible defaults via
DefaultString(), and updates the corresponding ValidateRequired() calls.

Affected tools: place_order, modify_order, cancel_order, place_gtt_order,
modify_gtt_order.

Fixes zerodha#69

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

place_order fails: 'variety' required despite having DefaultString("regular")

1 participant