test(schema): add test for setting tool schemas with no argument input
Some checks failed
CI / build-and-test (push) Failing after -30m38s

This commit is contained in:
2026-04-05 16:19:55 +02:00
parent 5f48a197e8
commit 02bcbdabd8
2 changed files with 25 additions and 0 deletions

View File

@@ -13,6 +13,24 @@ import (
"git.warky.dev/wdevs/amcs/internal/tools"
)
func TestSetToolSchemasAddsEmptyPropertiesForNoArgInput(t *testing.T) {
type noArgInput struct{}
type anyOutput struct{}
tool := &mcp.Tool{Name: "no_args"}
if err := setToolSchemas[noArgInput, anyOutput](tool); err != nil {
t.Fatalf("set tool schemas: %v", err)
}
schema, ok := tool.InputSchema.(*jsonschema.Schema)
if !ok {
t.Fatalf("input schema type = %T, want *jsonschema.Schema", tool.InputSchema)
}
if schema.Properties == nil {
t.Fatal("input schema missing properties: strict MCP clients require properties:{} on object schemas")
}
}
func TestSetToolSchemasUsesStringUUIDsInListOutput(t *testing.T) {
tool := &mcp.Tool{Name: "list_thoughts"}