@@ -258,21 +258,22 @@ func TestEndToEnd(t *testing.T) {
258258 }
259259
260260 // Check output schema validation.
261- tool , handler := ToolFor (& Tool {Name : "badout" },
262- func (_ context.Context , _ * CallToolRequest , arg map [string ]any ) (* CallToolResult , map [string ]any , error ) {
263- return nil , map [string ]any {"x" : 1 }, nil
264- })
265- tool .OutputSchema .Properties = map [string ]* jsonschema.Schema {
266- "x" : {Type : "string" },
261+ badout := & Tool {
262+ Name : "badout" ,
263+ OutputSchema : & jsonschema.Schema {
264+ Type : "object" ,
265+ Properties : map [string ]* jsonschema.Schema {
266+ "x" : {Type : "string" },
267+ },
268+ },
267269 }
268- s .AddTool (tool , handler )
270+ AddTool (s , badout , func (_ context.Context , _ * CallToolRequest , arg map [string ]any ) (* CallToolResult , map [string ]any , error ) {
271+ return nil , map [string ]any {"x" : 1 }, nil
272+ })
269273 gotFail , err = cs .CallTool (ctx , & CallToolParams {Name : "badout" })
270- if err != nil {
271- t .Fatal (err )
272- }
273- wantFail = & CallToolResult {IsError : true }
274- if diff := cmp .Diff (wantFail , gotFail ); diff != "" {
275- t .Errorf ("tools/call 'badout' mismatch (-want +got):\n %s" , diff )
274+ wantMsg := `has type "integer", want "string"`
275+ if err == nil || ! strings .Contains (err .Error (), wantMsg ) {
276+ t .Errorf ("\n got %q\n want error message containing %q" , err , wantMsg )
276277 }
277278
278279 // Check tools-changed notifications.
0 commit comments