1// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
2//
3// SPDX-License-Identifier: LicenseRef-MutuaL-1.2
4
5package mcp
6
7import (
8 "context"
9 "strings"
10 "testing"
11)
12
13// tools.READ_TOOL.7 tools.SCHEMA.3
14func TestCallToolACIDToolsReadTool7ReadsExampleRecipes(t *testing.T) {
15 backend := &fakeBackend{}
16 server := NewServer(backend, "test")
17
18 result, output, err := server.callReadTool(context.Background(), nil, ReadArguments{Target: "example_recipes"})
19 if err != nil {
20 t.Fatalf("callReadTool() error = %v", err)
21 }
22
23 text := requireTextContent(t, result)
24 for _, want := range []string{
25 "Title and portions are separate fields",
26 "# Yudane dough improver",
27 "This is a note between steps",
28 "# Toast",
29 } {
30 if !strings.Contains(text, want) {
31 t.Fatalf("example_recipes text missing %q: %q", want, text)
32 }
33 if !strings.Contains(output.ExampleRecipes, want) {
34 t.Fatalf("example_recipes output missing %q: %q", want, output.ExampleRecipes)
35 }
36 }
37 if backend.readShoppingListCalls != 0 || backend.page != 0 || backend.limit != 0 || backend.metadataCalls != 0 {
38 t.Fatalf(
39 "backend calls = shopping list %d list recipes page/limit %d/%d metadata %d, want none",
40 backend.readShoppingListCalls,
41 backend.page,
42 backend.limit,
43 backend.metadataCalls,
44 )
45 }
46}