Skip to content

Converting multiple submit buttons in forms to an MCP tool #63

@khushalsagar

Description

@khushalsagar

With #22, we'll be tackling multiple cases to define how forms map to MCP tools. Here's a fun edge case:

<form action="/submit" method="GET">
  <input type="text" name="title" value="My Post">
  
  <button type="submit" name="action" value="save_draft">Save Draft</button>

  <button type="submit" name="action" value="publish_now">Publish</button>
</form>

The common case would be a single submit button in which case it doesn't need to be in input json-schema. The action the button takes would be described by the form's attributes. But what should be the behaviour when there are multiple buttons?

@mfreed7 had an interesting idea that we could expose all these values as an enum in the input schema. Since the model should be selecting between one of these actions based on the user request. This maps to how a user would use them: click one button at a time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions