tools

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tools implements the MCP tools served by the cockroachdb-mcp-server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDatabaseParams

type CreateDatabaseParams struct {
	Name        string `json:"name" jsonschema:"Database name to create."`
	IfNotExists bool   `json:"if_not_exists,omitempty" jsonschema:"When true, the statement is a no-op if the database already exists."`
}

CreateDatabaseParams contains parameters for the create_database tool.

type CreateTableParams

type CreateTableParams struct {
	Statement string `` /* 146-byte string literal not displayed */
}

CreateTableParams contains parameters for the create_table tool.

type DBManager

type DBManager interface {
	Query(ctx context.Context, sql string) (*db.QueryResult, error)
	Exec(ctx context.Context, sql string) (int64, error)
}

DBManager is the narrow database surface that tool handlers depend on. The real *db.Manager satisfies it; tests use a fake.

type DeleteRowsParams

type DeleteRowsParams struct {
	Statement string `` /* 214-byte string literal not displayed */
}

DeleteRowsParams contains parameters for the delete_rows tool.

type ExplainQueryParams

type ExplainQueryParams struct {
	Query string `` /* 296-byte string literal not displayed */
}

ExplainQueryParams contains parameters for the explain_query tool.

type InsertRowsParams

type InsertRowsParams struct {
	Statement string `` /* 186-byte string literal not displayed */
}

InsertRowsParams contains parameters for the insert_rows tool.

type ListDatabasesParams

type ListDatabasesParams struct {
	PaginationParams
}

ListDatabasesParams contains parameters for the list_databases tool.

type ListSQLUsersParams

type ListSQLUsersParams struct {
	PaginationParams
}

ListSQLUsersParams contains parameters for the list_sql_users tool.

type ListTablesParams

type ListTablesParams struct {
	Database string `json:"database" jsonschema:"Database whose tables are listed."`
	PaginationParams
}

ListTablesParams contains parameters for the list_tables tool.

type MCPQueryResult

type MCPQueryResult struct {
	Rows []json.RawMessage `json:"rows"`
}

MCPQueryResult is the rows-shaped response returned by tabular read tools; get_cluster returns a flat object via writeOK instead.

type PaginationParams

type PaginationParams struct {
	Limit  *int64 `json:"limit,omitempty" jsonschema:"Max rows to return. Defaults to 100, capped at CRDB_MCP_MAX_ROWS_COUNT (default 10000)."`
	Offset *int64 `json:"offset,omitempty" jsonschema:"Rows to skip before returning results. Must be zero or positive. Defaults to 0."`
}

PaginationParams contains optional pagination parameters for list operations.

type SelectQueryParams

type SelectQueryParams struct {
	Query string `` /* 174-byte string literal not displayed */
}

SelectQueryParams contains parameters for the select_query tool.

type ShowRunningQueriesParams

type ShowRunningQueriesParams struct {
	PaginationParams
}

ShowRunningQueriesParams contains parameters for the show_running_queries tool.

type ShowStatementParams

type ShowStatementParams struct {
	Query string `` /* 173-byte string literal not displayed */
	PaginationParams
}

ShowStatementParams contains parameters for the show_statement tool.

type TableSchemaParams

type TableSchemaParams struct {
	Database string `json:"database" jsonschema:"Database containing the table."`
	Schema   string `json:"schema,omitempty" jsonschema:"Schema name. Defaults to 'public' when omitted."`
	Table    string `json:"table" jsonschema:"Table name."`
}

TableSchemaParams contains parameters for the get_table_schema tool. Schema defaults to "public" when empty.

type ToolHandlers

type ToolHandlers struct {
	// contains filtered or unexported fields
}

ToolHandlers wires MCP tool handlers to the underlying database querier and server configuration.

func NewToolHandlers

func NewToolHandlers(dm DBManager, cfg *config.Config) *ToolHandlers

NewToolHandlers constructs a handler bundle bound to the given database and server configuration.

func (*ToolHandlers) RegisterTools

func (h *ToolHandlers) RegisterTools(server *mcp.Server)

RegisterTools registers all MCP tools on the server. mcp.AddTool derives each tool's schema from its typed params struct (jsonschema tags) and validates input upstream.

type UpdateRowsParams

type UpdateRowsParams struct {
	Statement string `` /* 214-byte string literal not displayed */
}

UpdateRowsParams contains parameters for the update_rows tool.

Jump to

Keyboard shortcuts

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