test

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package test provides integration testing helper functions for cobrax It assumes cobrax.Command is a root level subcommand

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdPathsToToolNames

func CmdPathsToToolNames(paths []string) []string

CmdPathsToToolNames converts command names with spaces to tool names with underscores

func GetInputSchema

func GetInputSchema(t *testing.T, tool *mcp.Tool) *jsonschema.Schema

GetInputSchema extracts and returns the input schema from a tool. It reads from RawInputSchema when available, falling back to InputSchema.

func GetTools

func GetTools(t *testing.T, cmd *cobra.Command) []*mcp.Tool

GetTools runs `mcp tools` command and returns the parsed list of tools. It assumes the cobrax command uses the default name "mcp". For custom command names, use GetToolsForCommand.

func GetToolsForCommand

func GetToolsForCommand(t *testing.T, cmd *cobra.Command, commandName string) []*mcp.Tool

GetToolsForCommand runs `<commandName> tools` and returns the parsed list of tools. commandName is the Use name of the cobrax command in the Cobra tree (e.g. "mcp" or "agent").

func ToolNames

func ToolNames(t *testing.T, tools []*mcp.Tool, expectedNames ...string)

ToolNames checks that the provided tools match the expectedNames

func Tools

func Tools(t *testing.T, cmd *cobra.Command, expectedNames ...string)

Tools runs `mcp tools` and checks the output tool names against expectedNames. It assumes the cobrax command uses the default name "mcp". For custom command names, use ToolsForCommand.

func ToolsForCommand

func ToolsForCommand(t *testing.T, cmd *cobra.Command, commandName string, expectedNames ...string)

ToolsForCommand runs `<commandName> tools` and checks the output tool names against expectedNames. commandName is the Use name of the cobrax command in the Cobra tree.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL