Skip to content

Commit 1af73bc

Browse files
authored
auto validate tool arguments, improve validation messages (#200)
Marking this as closing #197 - it should significantly help the LLM figure out what it did wrong. The error would now be something like "Value `<root>` is not of type `List<dynamic>` at path #root["roots"]". I made a fair number of changes to the validation errors here, namely only emitting errors for the leaf node where the error actually happened and not the entire path up. I don't think that extra info was helpful. cc @kenzieschmoll
1 parent 0b22b67 commit 1af73bc

File tree

15 files changed

+591
-406
lines changed

15 files changed

+591
-406
lines changed

pkgs/dart_mcp/CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
## 0.2.3-wip
1+
## 0.3.0-wip
22

33
- Added error checking to required fields of all `Request` subclasses so that
44
they will throw helpful errors when accessed and not set.
55
- Added enum support to Schema.
6+
- Add more detail to type validation errors.
7+
- Remove some duplicate validation errors, errors are only reported for the
8+
leaf nodes and not all the way up the tree.
9+
- Deprecated a few validation error types as a part of this, including
10+
`propertyNamesInvalid`, `propertyValueInvalid`, `itemInvalid` and
11+
`prefixItemInvalid`.
12+
- Added a `custom` validation error type.
13+
- Auto-validate schemas for all tools by default. This can be disabled by
14+
passing `validateArguments: false` to `registerTool`.
15+
- This is breaking since this method is overridden by the Dart MCP server.
616
- Updates to the latest MCP spec, [2025-06-08](https://modelcontextprotocol.io/specification/2025-06-18/changelog)
717
- Adds support for Elicitations to allow the server to ask the user questions.
818
- Adds `ResourceLink` as a tool return content type.

0 commit comments

Comments
 (0)