mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-12-06 21:24:08 +00:00
29 lines
814 B
Go
29 lines
814 B
Go
// Copyright 2026 Beacon Contributors
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
package mcp
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
// Clients send every tool definition with each model request, so their total size is a running cost
|
|
// for whoever connects. Keep it bounded.
|
|
func TestToolDefinitionsStaySmall(t *testing.T) {
|
|
srv := newTestServer(t, testConfig(t, nil), newFakeReads())
|
|
res, err := connect(t, srv.URL, "").ListTools(context.Background(), nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
body, _ := json.Marshal(res.Tools)
|
|
t.Logf("tool definitions: %d bytes", len(body))
|
|
if len(body) > 49<<10 {
|
|
t.Errorf("tool definitions are %d bytes; trim descriptions before adding more", len(body))
|
|
}
|
|
if len(instructions) > 3<<10 {
|
|
t.Errorf("instructions are %d bytes", len(instructions))
|
|
}
|
|
}
|