( ctx context.Context, t *testing.T, server *Server, parentChat database.Chat, currentModelConfigID uuid.UUID, toolName string, args any, )
| 828 | } |
| 829 | |
| 830 | func runSubagentTool( |
| 831 | ctx context.Context, |
| 832 | t *testing.T, |
| 833 | server *Server, |
| 834 | parentChat database.Chat, |
| 835 | currentModelConfigID uuid.UUID, |
| 836 | toolName string, |
| 837 | args any, |
| 838 | ) fantasy.ToolResponse { |
| 839 | t.Helper() |
| 840 | |
| 841 | tools := server.subagentTools( |
| 842 | ctx, |
| 843 | func() database.Chat { return parentChat }, |
| 844 | currentModelConfigID, |
| 845 | ) |
| 846 | tool := findToolByName(tools, toolName) |
| 847 | require.NotNil(t, tool, "%s tool must be present", toolName) |
| 848 | |
| 849 | input, err := json.Marshal(args) |
| 850 | require.NoError(t, err) |
| 851 | |
| 852 | resp, err := tool.Run(ctx, fantasy.ToolCall{ |
| 853 | ID: uuid.NewString(), |
| 854 | Name: toolName, |
| 855 | Input: string(input), |
| 856 | }) |
| 857 | require.NoError(t, err) |
| 858 | |
| 859 | return resp |
| 860 | } |
| 861 | |
| 862 | func runSpawnAgentTool( |
| 863 | ctx context.Context, |
no test coverage detected