Skip to content

Reject whitespace-only tool descriptions - #393

Open
sjdallst2 wants to merge 1 commit into
webmachinelearning:mainfrom
sjdallst2:issue-372-description-whitespace
Open

sjdallst2 wants to merge 1 commit into
webmachinelearning:mainfrom
sjdallst2:issue-372-description-whitespace

Conversation

@sjdallst2

@sjdallst2 sjdallst2 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Update the specification to reject whitespace only descriptions. Descriptions are fundamental to tool usage for agents, and the vast majority of existing MCP tools include descriptions. Rejecting known bad descriptions helps improve the guarantees given to agents from the browser.

Fixes #372.


Preview | Diff

Fixes webmachinelearning#372.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@beaufortfrancois beaufortfrancois left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits

Comment thread index.bs
Comment on lines +802 to 803
or if the {{ModelContextTool/inputSchema}}
or {{ModelContextTool/outputSchema}} is invalid.</p>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
or if the {{ModelContextTool/inputSchema}}
or {{ModelContextTool/outputSchema}} is invalid.</p>
or the {{ModelContextTool/inputSchema}} or {{ModelContextTool/outputSchema}} is invalid.</p>

Comment thread index.bs
<p>Registers a tool that [=agents=] can invoke. Returns a rejected promise if a tool with the
same name is already registered, if the given {{ModelContextTool/name}} or
{{ModelContextTool/description}} are empty strings, or if the {{ModelContextTool/inputSchema}}
same name is already registered, if the given {{ModelContextTool/name}} is the empty string,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "if the {{ModelContextTool/name}} is invalid, if the {{ModelContextTool/description}} is empty or contains only whitespace, or if the {{ModelContextTool/inputSchema}} or {{ModelContextTool/outputSchema}} is invalid."?

Comment thread index.bs

1. If |tool|'s {{ModelContextTool/description}} is the empty string, then return [=a promise
rejected with=] an {{InvalidStateError}} {{DOMException}}.
1. If the result of [=strip leading and trailing ASCII whitespace|stripping leading and trailing

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think* you can use [=stripping leading and trailing ASCII whitespace=] directly.

This branch has not been deployed

No deployments
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.

Tool description: make it optional to match MCP, or also reject whitespace-only strings?

2 participants