Documentation
¶
Index ¶
- Variables
- func AddExecuteSqlConfig(t *testing.T, config map[string]any, toolType string) map[string]any
- func AddMSSQLExecuteSqlConfig(t *testing.T, config map[string]any) map[string]any
- func AddMSSQLPrebuiltToolConfig(t *testing.T, config map[string]any) map[string]any
- func AddMySQLPrebuiltToolConfig(t *testing.T, config map[string]any) map[string]any
- func AddMySqlExecuteSqlConfig(t *testing.T, config map[string]any) map[string]any
- func AddPostgresPrebuiltConfig(t *testing.T, config map[string]any) map[string]any
- func AddSemanticSearchConfig(t *testing.T, config map[string]any, toolKind, insertStmt, searchStmt string) map[string]any
- func AddTemplateParamConfig(t *testing.T, config map[string]any, ...) map[string]any
- func AssertMCPError(t *testing.T, mcpResp *MCPCallToolResponse, wantErrMsg string)
- func CleanupBigQueryDatasets(t *testing.T, ctx context.Context, client *bigquery.Client, ...)
- func CleanupBigtableTables(t *testing.T, ctx context.Context, adminClient *bigtable.AdminClient, ...)
- func CleanupMSSQLTables(t *testing.T, ctx context.Context, pool *sql.DB)
- func CleanupMySQLTables(t *testing.T, ctx context.Context, pool *sql.DB)
- func CleanupPostgresTables(t *testing.T, ctx context.Context, pool *pgxpool.Pool, uniqueID string)
- func CreateAndLockPostgresTable(t *testing.T, ctx context.Context, pool *pgxpool.Pool, tableName string) func()
- func GetCloudSQLDialOpts(ipType string) ([]cloudsqlconn.DialOption, error)
- func GetCockroachDBAuthToolInfo(tableName string) (string, string, string, []any)
- func GetCockroachDBParamToolInfo(tableName string) (string, string, string, string, string, string, []any)
- func GetCockroachDBWants() (string, string, string, string)
- func GetGoogleIdToken(t *testing.T) (string, error)
- func GetMCPToolsList(t *testing.T, requestHeader map[string]string) (int, []any, error)
- func GetMSSQLAuthToolInfo(tableName string) (string, string, string, []any)
- func GetMSSQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any)
- func GetMSSQLTmplToolStatement() (string, string)
- func GetMSSQLWants() (string, string, string, string)
- func GetMySQLAuthToolInfo(tableName string) (string, string, string, []any)
- func GetMySQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any)
- func GetMySQLTmplToolStatement() (string, string)
- func GetMySQLWants() (string, string, string, string)
- func GetPostgresSQLAuthToolInfo(tableName string) (string, string, string, []any)
- func GetPostgresSQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any)
- func GetPostgresSQLTmplToolStatement() (string, string)
- func GetPostgresVectorSearchStmts(vectorTableName string) (string, string)
- func GetPostgresWants() (string, string, string, string)
- func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map[string]any
- func GetRedisValkeyWants() (string, string, string, string, string, string, string)
- func GetToolsConfig(sourceConfig map[string]any, ...) map[string]any
- func NewMCPRequestHeader(t *testing.T, customHeaders map[string]string) map[string]string
- func RunExecuteSqlToolInvokeTest(t *testing.T, createTableStatement, select1Want string, ...)
- func RunInitialize(t *testing.T, protocolVersion string) string
- func RunMCPCustomToolCallMethod(t *testing.T, toolName string, arguments map[string]any, want string)
- func RunMCPToolCallMethod(t *testing.T, myFailToolWant, select1Want string, options ...McpTestOption)
- func RunMCPToolInvokeTest(t *testing.T, select1Want string, options ...InvokeTestOption)
- func RunMCPToolsListMethod(t *testing.T, expectedOutput []MCPToolManifest)
- func RunMSSQLListTablesTest(t *testing.T, tableNameParam, tableNameAuth string)
- func RunMySQLGetQueryPlanTest(t *testing.T, ctx context.Context, pool *sql.DB, ...)
- func RunMySQLListActiveQueriesTest(t *testing.T, ctx context.Context, pool *sql.DB)
- func RunMySQLListTableFragmentationTest(t *testing.T, databaseName, tableNameParam, tableNameAuth string)
- func RunMySQLListTablesMissingUniqueIndexes(t *testing.T, ctx context.Context, pool *sql.DB, databaseName string)
- func RunMySQLListTablesTest(t *testing.T, ...)
- func RunPostgresDatabaseOverviewTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresGetColumnCardinalityTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListActiveQueriesTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListAvailableExtensionsTest(t *testing.T)
- func RunPostgresListDatabaseStatsTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListIndexesTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListInstalledExtensionsTest(t *testing.T)
- func RunPostgresListLocksTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListPgSettingsTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListPublicationTablesTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListQueryStatsTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListRolesTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListSchemasTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool, owner string, ...)
- func RunPostgresListSequencesTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListStoredProcedureTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListTableSpacesTest(t *testing.T)
- func RunPostgresListTableStatsTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListTablesTest(t *testing.T, tableNameParam, tableNameAuth, user string)
- func RunPostgresListTriggersTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresListViewsTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresLongRunningTransactionsTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunPostgresReplicationStatsTest(t *testing.T, ctx context.Context, pool *pgxpool.Pool)
- func RunRequest(t *testing.T, method, url string, body io.Reader, headers map[string]string) (*http.Response, []byte)
- func RunSemanticSearchToolInvokeTest(t *testing.T, insertWant, mcpInsertWant, searchWant string)
- func RunSourceConnectionTest(t *testing.T, sourceConfig map[string]any, toolType string) error
- func RunStatementToolsTest(t *testing.T, tools map[string]string)
- func RunToolGetTest(t *testing.T)
- func RunToolGetTestByName(t *testing.T, name string, want map[string]any)
- func RunToolInvokeParametersTest(t *testing.T, name string, params []byte, simpleWant string)
- func RunToolInvokeSimpleTest(t *testing.T, name string, simpleWant string)
- func RunToolInvokeTest(t *testing.T, select1Want string, options ...InvokeTestOption)
- func RunToolInvokeWithTemplateParameters(t *testing.T, tableName string, options ...TemplateParamOption)
- func SetupMsSQLTable(t *testing.T, ctx context.Context, pool *sql.DB, ...) func(*testing.T)
- func SetupMySQLTable(t *testing.T, ctx context.Context, pool *sql.DB, ...) func(*testing.T)
- func SetupPostgresSQLTable(t *testing.T, ctx context.Context, pool *pgxpool.Pool, ...) func(*testing.T)
- func SetupPostgresVectorTable(t *testing.T, ctx context.Context, pool *pgxpool.Pool) (string, func(*testing.T))
- func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T)
- type CallToolParams
- type CmdExec
- type ExecuteSqlOption
- type ExecuteSqlTestConfig
- type InvokeTestConfig
- type InvokeTestOption
- func DisableArrayTest() InvokeTestOption
- func DisableOptionalNullParamTest() InvokeTestOption
- func DisableSelect1AuthTest() InvokeTestOption
- func DisableSelect1Test() InvokeTestOption
- func EnableClientAuthTest() InvokeTestOption
- func WithMyArrayToolWant(s string) InvokeTestOption
- func WithMyAuthToolWant(s string) InvokeTestOption
- func WithMyToolById4Want(s string) InvokeTestOption
- func WithMyToolId3NameAliceWant(s string) InvokeTestOption
- func WithNullWant(s string) InvokeTestOption
- type MCPCallToolRequest
- type MCPCallToolResponse
- type MCPListToolsRequest
- type MCPListToolsResponse
- type MCPTestConfig
- type MCPToolManifest
- type McpTestOption
- type TemplateParamOption
- func DisableDdlTest() TemplateParamOption
- func DisableInsertTest() TemplateParamOption
- func DisableSelectFilterTest() TemplateParamOption
- func WithCreateColArray(s string) TemplateParamOption
- func WithDdlWant(s string) TemplateParamOption
- func WithInsert1Want(s string) TemplateParamOption
- func WithNameColFilter(s string) TemplateParamOption
- func WithNameFieldArray(s string) TemplateParamOption
- func WithSelectAllWant(s string) TemplateParamOption
- func WithSelectEmptyWant(s string) TemplateParamOption
- func WithTmplSelectId1Want(s string) TemplateParamOption
- func WithTmplSelectNameWant(s string) TemplateParamOption
- type TemplateParameterTestConfig
Constants ¶
This section is empty.
Variables ¶
var ClientId = os.Getenv("CLIENT_ID")
var ServiceAccountEmail = os.Getenv("SERVICE_ACCOUNT_EMAIL")
Functions ¶
func AddExecuteSqlConfig ¶
AddExecuteSqlConfig gets the tools config for `execute-sql` tools
func AddMSSQLExecuteSqlConfig ¶
AddMSSQLExecuteSqlConfig gets the tools config for `mssql-execute-sql`
func AddMSSQLPrebuiltToolConfig ¶
AddMSSQLPrebuiltToolConfig gets the tools config for mssql prebuilt tools
func AddMySQLPrebuiltToolConfig ¶
AddMySQLPrebuiltToolConfig gets the tools config for mysql prebuilt tools
func AddMySqlExecuteSqlConfig ¶
AddMySqlExecuteSqlConfig gets the tools config for `mysql-execute-sql`
func AddSemanticSearchConfig ¶
func AddSemanticSearchConfig(t *testing.T, config map[string]any, toolKind, insertStmt, searchStmt string) map[string]any
AddSemanticSearchConfig adds embedding models and semantic search tools to the config with configurable tool kind and SQL statements.
func AddTemplateParamConfig ¶
func AssertMCPError ¶
func AssertMCPError(t *testing.T, mcpResp *MCPCallToolResponse, wantErrMsg string)
AssertMCPError asserts that the response contains an error covering the expected message.
func CleanupBigQueryDatasets ¶
func CleanupBigtableTables ¶
func CleanupBigtableTables(t *testing.T, ctx context.Context, adminClient *bigtable.AdminClient, uniqueID string)
finds and deletes all tables in a Bigtable instance that match the uniqueID.
func CleanupMSSQLTables ¶
Finds and drops all tables in an mssql database.
func CleanupMySQLTables ¶
Finds and drops all tables in a mysql database.
func CleanupPostgresTables ¶
Finds and drops all tables in a postgres database.
func GetCloudSQLDialOpts ¶
func GetCloudSQLDialOpts(ipType string) ([]cloudsqlconn.DialOption, error)
GetCloudSQLDialOpts returns cloud sql connector's dial option for ip type.
func GetCockroachDBAuthToolInfo ¶
GetCockroachDBAuthToolInfo returns statements and param of my-auth-tool for cockroachdb-sql type Uses explicit INT PRIMARY KEY instead of SERIAL to ensure deterministic IDs
func GetCockroachDBParamToolInfo ¶
func GetCockroachDBParamToolInfo(tableName string) (string, string, string, string, string, string, []any)
GetCockroachDBParamToolInfo returns statements and param for my-tool cockroachdb-sql type Uses explicit INT PRIMARY KEY instead of SERIAL to ensure deterministic IDs
func GetCockroachDBWants ¶
GetCockroachDBWants return the expected wants for cockroachdb
func GetGoogleIdToken ¶
GetGoogleIdToken retrieve and return the Google ID token
func GetMCPToolsList ¶
GetMCPToolsList is a JSON-RPC harness that fetches the tools/list registry.
func GetMSSQLAuthToolInfo ¶
GetMSSQLAuthToolInfo returns statements and param of my-auth-tool for mssql-sql type
func GetMSSQLParamToolInfo ¶
func GetMSSQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any)
GetMSSQLParamToolInfo returns statements and param for my-tool mssql-sql type
func GetMSSQLTmplToolStatement ¶
GetMSSQLTmplToolStatement returns statements and param for template parameter test cases for mysql-sql type
func GetMSSQLWants ¶
GetMSSQLWants return the expected wants for mssql
func GetMySQLAuthToolInfo ¶
GetMySQLAuthToolInfo returns statements and param of my-auth-tool for mysql-sql type
func GetMySQLParamToolInfo ¶
func GetMySQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any)
GetMySQLParamToolInfo returns statements and param for my-tool mysql-sql type
func GetMySQLTmplToolStatement ¶
GetMySQLTmplToolStatement returns statements and param for template parameter test cases for mysql-sql type
func GetMySQLWants ¶
GetMySQLWants return the expected wants for mysql
func GetPostgresSQLAuthToolInfo ¶
GetPostgresSQLAuthToolInfo returns statements and param of my-auth-tool for postgres-sql type
func GetPostgresSQLParamToolInfo ¶
func GetPostgresSQLParamToolInfo(tableName string) (string, string, string, string, string, string, []any)
GetPostgresSQLParamToolInfo returns statements and param for my-tool postgres-sql type
func GetPostgresSQLTmplToolStatement ¶
GetPostgresSQLTmplToolStatement returns statements and param for template parameter test cases for postgres-sql type
func GetPostgresWants ¶
GetPostgresWants return the expected wants for postgres
func GetRedisValkeyWants ¶
GetRedisWants return the expected wants for redis
func GetToolsConfig ¶
func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any
GetToolsConfig returns a mock tools config file
func NewMCPRequestHeader ¶
NewMCPRequestHeader takes custom headers and appends headers required for MCP.
func RunExecuteSqlToolInvokeTest ¶
func RunExecuteSqlToolInvokeTest(t *testing.T, createTableStatement, select1Want string, options ...ExecuteSqlOption)
func RunInitialize ¶
RunInitialize runs the initialize lifecycle for mcp to set up client-server connection
func RunMCPCustomToolCallMethod ¶
func RunMCPCustomToolCallMethod(t *testing.T, toolName string, arguments map[string]any, want string)
RunMCPCustomToolCallMethod invokes a tool and compares the result with expected output.
func RunMCPToolCallMethod ¶
func RunMCPToolCallMethod(t *testing.T, myFailToolWant, select1Want string, options ...McpTestOption)
RunMCPToolCallMethod runs the tool/call for mcp endpoint
func RunMCPToolInvokeTest ¶
func RunMCPToolInvokeTest(t *testing.T, select1Want string, options ...InvokeTestOption)
RunMCPToolInvokeTest runs the tool invoke test cases over MCP protocol.
func RunMCPToolsListMethod ¶
func RunMCPToolsListMethod(t *testing.T, expectedOutput []MCPToolManifest)
RunMCPToolsListMethod calls tools/list and verifies that the returned tools match the expected list.
func RunMSSQLListTablesTest ¶
RunMSSQLListTablesTest run tests againsts the mssql-list-tables tools.
func RunMySQLListActiveQueriesTest ¶
RunMySQLListActiveQueriesTest run tests against the mysql-list-active-queries tests
func RunMySQLListTablesTest ¶
func RunMySQLListTablesTest(t *testing.T, databaseName, tableNameParam, tableNameAuth, expectedOwner string)
RunMySQLListTablesTest run tests against the mysql-list-tables tool
func RunPostgresListDatabaseStatsTest ¶
RunPostgresDatabaseStatsTest tests the database_stats tool by comparing API results against a direct query to the database.
func RunPostgresListLocksTest ¶
RunPostgresListLocksTest runs tests for the postgres list-locks tool
func RunPostgresListStoredProcedureTest ¶
RunPostgresListStoredProcedureTest runs tests for the postgres list-stored-procedure tool
func RunPostgresListTableStatsTest ¶
RunPostgresListTableStatsTest runs tests for the postgres list-table-stats tool
func RunPostgresLongRunningTransactionsTest ¶
RunPostgresLongRunningTransactionsTest runs tests for the postgres long-running-transactions tool
func RunPostgresReplicationStatsTest ¶
RunPostgresReplicationStatsTest runs tests for the postgres replication-stats tool
func RunRequest ¶
func RunRequest(t *testing.T, method, url string, body io.Reader, headers map[string]string) (*http.Response, []byte)
RunRequest is a helper function to send HTTP requests and return the response
func RunSemanticSearchToolInvokeTest ¶
RunSemanticSearchToolInvokeTest runs the insert_docs and search_docs tools via both HTTP and MCP endpoints and verifies the output.
func RunSourceConnectionTest ¶
RunSourceConnection test for source connection
func RunToolGetTestByName ¶
func RunToolInvokeSimpleTest ¶
RunToolInvokeSimpleTest runs the tool invoke endpoint with no parameters
func RunToolInvokeTest ¶
func RunToolInvokeTest(t *testing.T, select1Want string, options ...InvokeTestOption)
RunToolInvoke runs the tool invoke endpoint
func RunToolInvokeWithTemplateParameters ¶
func RunToolInvokeWithTemplateParameters(t *testing.T, tableName string, options ...TemplateParamOption)
RunToolInvokeWithTemplateParameters runs tool invoke test cases with template parameters.
func SetupMsSQLTable ¶
func SetupMsSQLTable(t *testing.T, ctx context.Context, pool *sql.DB, createStatement, insertStatement, tableName string, params []any) func(*testing.T)
SetupMsSQLTable creates and inserts data into a table of tool compatible with mssql-sql tool
func SetupMySQLTable ¶
func SetupMySQLTable(t *testing.T, ctx context.Context, pool *sql.DB, createStatement, insertStatement, tableName string, params []any) func(*testing.T)
SetupMySQLTable creates and inserts data into a table of tool compatible with mysql-sql tool
func SetupPostgresSQLTable ¶
func SetupPostgresSQLTable(t *testing.T, ctx context.Context, pool *pgxpool.Pool, createStatement, insertStatement, tableName string, params []any) func(*testing.T)
SetupPostgresSQLTable creates and inserts data into a table of tool compatible with postgres-sql tool
func SetupPostgresVectorTable ¶
func SetupPostgresVectorTable(t *testing.T, ctx context.Context, pool *pgxpool.Pool) (string, func(*testing.T))
SetupPostgresVectorTable sets up the vector extension and a vector table
func TestCloudSQLMySQL_IPTypeParsingFromYAML ¶
TestCloudSQLMySQL_IPTypeParsingFromYAML verifies the IPType field parsing from YAML for the cloud-sql-mysql source, mimicking the structure of tests in cloudsql_mysql_test.go.
Types ¶
type CallToolParams ¶
type CallToolParams struct {
Name string `json:"name"`
Arguments map[string]any `json:"arguments,omitempty"`
}
CallToolParams represents the internal payload of an MCP tool call request
type CmdExec ¶
type CmdExec struct {
Out io.ReadCloser
// contains filtered or unexported fields
}
CmdExec represents an invocation of a toolbox command.
func StartCmd ¶
func StartCmd(ctx context.Context, toolsFile map[string]any, args ...string) (*CmdExec, func(), error)
StartCmd returns a CmdExec representing a running instance of a toolbox command.
type ExecuteSqlOption ¶
type ExecuteSqlOption func(*ExecuteSqlTestConfig)
func WithExecuteCreateWant ¶
func WithExecuteCreateWant(s string) ExecuteSqlOption
WithExecuteCreateWant represents the expected response for a CREATE TABLE statement.
func WithExecuteDropWant ¶
func WithExecuteDropWant(s string) ExecuteSqlOption
WithExecuteDropWant represents the expected response for a DROP TABLE statement.
func WithExecuteSelectEmptyWant ¶
func WithExecuteSelectEmptyWant(s string) ExecuteSqlOption
WithExecuteSelectEmptyWant represents the expected response for a SELECT from an empty table.
func WithSelect1Statement ¶
func WithSelect1Statement(s string) ExecuteSqlOption
WithSelect1Statement represents the database's statement for `SELECT 1`. e.g. tests.RunExecuteSqlToolInvokeTest(t, createTableStatement, select1Want, tests.WithSelect1Statement("custom"))
type ExecuteSqlTestConfig ¶
type ExecuteSqlTestConfig struct {
// contains filtered or unexported fields
}
ExecuteSqlTestConfig represents the various configuration options for RunExecuteSqlToolInvokeTest()
type InvokeTestConfig ¶
type InvokeTestConfig struct {
// contains filtered or unexported fields
}
InvokeTestConfig represents the various configuration options for RunToolInvokeTest()
type InvokeTestOption ¶
type InvokeTestOption func(*InvokeTestConfig)
func DisableArrayTest ¶
func DisableArrayTest() InvokeTestOption
DisableArrayTest disables tests for sources that do not support array. e.g. tests.RunToolInvokeTest(t, select1Want, tests.DisableArrayTest())
func DisableOptionalNullParamTest ¶
func DisableOptionalNullParamTest() InvokeTestOption
DisableOptionalNullParamTest disables tests for optional null parameters. e.g. tests.RunToolInvokeTest(t, select1Want, tests.DisableOptionalNullParamTest())
func DisableSelect1AuthTest ¶
func DisableSelect1AuthTest() InvokeTestOption
DisableSelect1AuthTest disables auth tests for sources that do not support SELECT 1 query. e.g. tests.RunToolInvokeTest(t, "", tests.DisableSelect1AuthTest())
func DisableSelect1Test ¶
func DisableSelect1Test() InvokeTestOption
DisableSelect1Test disables tests for sources that do not support SELECT 1 query. e.g. tests.RunToolInvokeTest(t, "", tests.DisableSelect1Test())
func EnableClientAuthTest ¶
func EnableClientAuthTest() InvokeTestOption
EnableClientAuthTest runs the client authorization tests. Only enable it if your source supports the `useClientOAuth` configuration. Currently, this should only be used with the BigQuery tests.
func WithMyArrayToolWant ¶
func WithMyArrayToolWant(s string) InvokeTestOption
WithMyArrayToolWant represents the response value for my-array-tool. e.g. tests.RunToolInvokeTest(t, select1Want, tests.WithMyArrayToolWant("custom"))
func WithMyAuthToolWant ¶
func WithMyAuthToolWant(s string) InvokeTestOption
WithMyAuthToolWant represents the response value for my-auth-tool. e.g. tests.RunToolInvokeTest(t, select1Want, tests.WithMyAuthToolWant("custom"))
func WithMyToolById4Want ¶
func WithMyToolById4Want(s string) InvokeTestOption
WithMyToolById4Want represents the response value for my-tool-by-id with id=4. This response includes a null value column. e.g. tests.RunToolInvokeTest(t, select1Want, tests.WithMyToolById4Want("custom"))
func WithMyToolId3NameAliceWant ¶
func WithMyToolId3NameAliceWant(s string) InvokeTestOption
WithMyToolId3NameAliceWant represents the response value for my-tool with id=3 and name=Alice. e.g. tests.RunToolInvokeTest(t, select1Want, tests.WithMyToolId3NameAliceWant("custom"))
func WithNullWant ¶
func WithNullWant(s string) InvokeTestOption
WithNullWant represents a response value of null string. e.g. tests.RunToolInvokeTest(t, select1Want, tests.WithNullWant("custom"))
type MCPCallToolRequest ¶
type MCPCallToolRequest struct {
Jsonrpc string `json:"jsonrpc"`
Id jsonrpc.RequestId `json:"id"`
Method string `json:"method"`
Params CallToolParams `json:"params"`
}
MCPCallToolRequest encapsulates the standard JSON-RPC request format targeting tools/call
func NewMCPCallToolRequest ¶
func NewMCPCallToolRequest(id jsonrpc.RequestId, toolName string, args map[string]any) MCPCallToolRequest
NewMCPCallToolRequest is a helper to quickly generate a standard jsonrpc request payload.
type MCPCallToolResponse ¶
type MCPCallToolResponse struct {
Jsonrpc string `json:"jsonrpc"`
Id jsonrpc.RequestId `json:"id"`
Result v20251125.CallToolResult `json:"result,omitempty"`
Error *jsonrpc.Error `json:"error,omitempty"`
}
MCPCallToolResponse provides a strongly-typed unmarshal target for MCP tool call results, bypassing the generic interface{} Result used in the standard jsonrpc.JSONRPCResponse.
type MCPListToolsRequest ¶
type MCPListToolsRequest struct {
Jsonrpc string `json:"jsonrpc"`
Id jsonrpc.RequestId `json:"id"`
Method string `json:"method"`
}
MCPListToolsRequest encapsulates the standard JSON-RPC request format targeting tools/list
type MCPListToolsResponse ¶
type MCPListToolsResponse struct {
Jsonrpc string `json:"jsonrpc"`
Id jsonrpc.RequestId `json:"id"`
Result struct {
Tools []MCPToolManifest `json:"tools"`
} `json:"result,omitempty"`
Error *jsonrpc.Error `json:"error,omitempty"`
}
MCPListToolsResponse is a strongly-typed unmarshal target for tools/list results
type MCPTestConfig ¶
type MCPTestConfig struct {
// contains filtered or unexported fields
}
MCPTestConfig represents the various configuration options for mcp tool call tests.
type MCPToolManifest ¶
type MCPToolManifest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema map[string]any `json:"inputSchema,omitempty"`
}
MCPToolManifest is a copy of tools.McpManifest used for integration testing purposes
type McpTestOption ¶
type McpTestOption func(*MCPTestConfig)
func DisableMcpSelect1AuthTest ¶
func DisableMcpSelect1AuthTest() McpTestOption
DisableMcpSelect1AuthTest disables the auth tool tests which use select 1.
func EnableMcpClientAuthTest ¶
func EnableMcpClientAuthTest() McpTestOption
EnableMcpClientAuthTest runs the client authorization tests. Only enable it if your source supports the `useClientOAuth` configuration. Currently, this should only be used with the BigQuery tests.
func WithMcpMyToolId3NameAliceWant ¶
func WithMcpMyToolId3NameAliceWant(s string) McpTestOption
WithMcpMyToolId3NameAliceWant represents the response value for my-tool with id=3 and name=Alice. e.g. tests.RunMCPToolCallMethod(t, mcpMyFailToolWant, tests.WithMcpMyToolId3NameAliceWant("custom"))
func WithMcpSelect1Want ¶
func WithMcpSelect1Want(want string) McpTestOption
type TemplateParamOption ¶
type TemplateParamOption func(*TemplateParameterTestConfig)
func DisableDdlTest ¶
func DisableDdlTest() TemplateParamOption
DisableDdlTest disables tests for ddl statements for sources that do not support ddl. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.DisableDdlTest())
func DisableInsertTest ¶
func DisableInsertTest() TemplateParamOption
DisableInsertTest disables tests of insert statements for sources that do not support insert. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.DisableInsertTest())
func DisableSelectFilterTest ¶
func DisableSelectFilterTest() TemplateParamOption
DisableInsertTest disables tests of select-fields-templateParams-tool test. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.DisableSelectFilterTest())
func WithCreateColArray ¶
func WithCreateColArray(s string) TemplateParamOption
WithCreateColArray represents the columns array parameter for create-table-templateParams-tool. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithCreateColArray("custom"))
func WithDdlWant ¶
func WithDdlWant(s string) TemplateParamOption
WithDdlWant represents the response value of ddl statements. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithDdlWant("custom"))
func WithInsert1Want ¶
func WithInsert1Want(s string) TemplateParamOption
WithInsert1Want represents the response value of insert-table-templateParams-tool. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithInsert1Want("custom"))
func WithNameColFilter ¶
func WithNameColFilter(s string) TemplateParamOption
WithNameColFilter represents the columnFilter parameter for select-filter-templateParams-combined-tool. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithNameColFilter("custom"))
func WithNameFieldArray ¶
func WithNameFieldArray(s string) TemplateParamOption
WithNameFieldArray represents fields array parameter for select-fields-templateParams-tool. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithNameFieldArray("custom"))
func WithSelectAllWant ¶
func WithSelectAllWant(s string) TemplateParamOption
WithSelectAllWant represents the response value of select-templateParams-tool. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithSelectAllWant("custom"))
func WithSelectEmptyWant ¶
func WithSelectEmptyWant(s string) TemplateParamOption
WithSelectEmptyWant represents the response value of select-templateParams-combined-tool with no results. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithSelectEmptyWant("custom"))
func WithTmplSelectId1Want ¶
func WithTmplSelectId1Want(s string) TemplateParamOption
WithTmplSelectId1Want represents the response value of select-templateParams-combined-tool with id=1. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithTmplSelectId1Want("custom"))
func WithTmplSelectNameWant ¶
func WithTmplSelectNameWant(s string) TemplateParamOption
WithTmplSelectNameWant represents the response value of select-filter-templateParams-combined-tool with name. e.g. tests.RunToolInvokeWithTemplateParameters(t, tableNameTemplateParam, tests.WithTmplSelectNameWant("custom"))
type TemplateParameterTestConfig ¶
type TemplateParameterTestConfig struct {
// contains filtered or unexported fields
}
TemplateParameterTestConfig represents the various configuration options for template parameter tests.