(t *testing.T)
| 1289 | } |
| 1290 | |
| 1291 | func TestModelIntent_Info_WrapsSchema(t *testing.T) { |
| 1292 | t.Parallel() |
| 1293 | ctx := context.Background() |
| 1294 | logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true}) |
| 1295 | |
| 1296 | ts := newTestMCPServer(t, echoTool()) |
| 1297 | |
| 1298 | cfg := makeConfig("intent-srv", ts.URL) |
| 1299 | cfg.ModelIntent = true |
| 1300 | |
| 1301 | tools, cleanup := mcpclient.ConnectAll(ctx, logger, []database.MCPServerConfig{cfg}, nil, uuid.Nil, nil, nil) |
| 1302 | t.Cleanup(cleanup) |
| 1303 | require.Len(t, tools, 1) |
| 1304 | |
| 1305 | info := tools[0].Info() |
| 1306 | |
| 1307 | // Top-level schema should have model_intent and properties. |
| 1308 | _, hasModelIntent := info.Parameters["model_intent"] |
| 1309 | _, hasProperties := info.Parameters["properties"] |
| 1310 | assert.True(t, hasModelIntent, "schema should contain model_intent") |
| 1311 | assert.True(t, hasProperties, "schema should contain properties") |
| 1312 | |
| 1313 | // Required should include both. |
| 1314 | assert.Contains(t, info.Required, "model_intent") |
| 1315 | assert.Contains(t, info.Required, "properties") |
| 1316 | |
| 1317 | // The original "input" parameter should be nested under |
| 1318 | // properties.properties. |
| 1319 | propsObj, ok := info.Parameters["properties"].(map[string]any) |
| 1320 | require.True(t, ok) |
| 1321 | innerProps, ok := propsObj["properties"].(map[string]any) |
| 1322 | require.True(t, ok) |
| 1323 | _, hasInput := innerProps["input"] |
| 1324 | assert.True(t, hasInput, "original 'input' param should be nested") |
| 1325 | } |
| 1326 | |
| 1327 | func TestModelIntent_Info_NoWrapWhenDisabled(t *testing.T) { |
| 1328 | t.Parallel() |
nothing calls this directly
no test coverage detected