mcp

package
v0.0.0-...-e58a392 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatementSelect   = sqlguard.StatementSelect
	StatementInsert   = sqlguard.StatementInsert
	StatementUpdate   = sqlguard.StatementUpdate
	StatementDelete   = sqlguard.StatementDelete
	StatementDrop     = sqlguard.StatementDrop
	StatementCreate   = sqlguard.StatementCreate
	StatementAlter    = sqlguard.StatementAlter
	StatementTruncate = sqlguard.StatementTruncate
	StatementShow     = sqlguard.StatementShow
	StatementDescribe = sqlguard.StatementDescribe
	StatementExplain  = sqlguard.StatementExplain
	StatementWith     = sqlguard.StatementWith
	StatementUnknown  = sqlguard.StatementUnknown
)

Statement type constants re-exported from the shared classifier.

Variables

View Source
var (
	ErrWriteNotAllowed      = errors.New("write operations are not allowed in read-only mode")
	ErrMultipleStatements   = errors.New("multiple SQL statements are not allowed")
	ErrDangerousFunction    = errors.New("dangerous database function detected")
	ErrDestructiveOperation = errors.New("destructive operation detected")
)

SQL validation errors

View Source
var (
	ErrQueryRequired      = errors.New("query is required and cannot be empty")
	ErrTableRequired      = errors.New("table is required - specify which table to describe")
	ErrTokenRequired      = errors.New("token is required - use the confirmation_token from the previous query response")
	ErrTokenInvalid       = errors.New("token is not a valid confirmation token format")
	ErrConnectionRequired = errors.New("connection is required when multiple connections are configured (use whodb_connections to list available connections)")
)

Input validation errors - designed to be helpful for AI assistants

Functions

func InitializeAnalytics

func InitializeAnalytics(cfg *AnalyticsConfig) error

InitializeAnalytics sets up PostHog analytics for the MCP server. Analytics are enabled by default and can be disabled via: - WHODB_MCP_ANALYTICS_DISABLED=true environment variable - --no-analytics flag

func IsAnalyticsEnabled

func IsAnalyticsEnabled() bool

IsAnalyticsEnabled returns whether analytics are currently active.

func IsReadOnlyStatement

func IsReadOnlyStatement(stmtType StatementType) bool

IsReadOnlyStatement returns true if the statement type is read-only.

func IsWriteStatement

func IsWriteStatement(stmtType StatementType) bool

IsWriteStatement returns true if the statement type modifies data.

func ListAvailableConnections

func ListAvailableConnections() ([]string, error)

ListAvailableConnections returns all available connection names from saved connections and environment profiles (for example, WHODB_POSTGRES='[...]' or WHODB_MYSQL_1='{...}').

func NewServer

func NewServer(opts *ServerOptions) *mcp.Server

NewServer creates a new WhoDB MCP server with all tools registered.

func ResolveConnection

func ResolveConnection(name string) (*dbmgr.Connection, error)

ResolveConnection resolves a connection name to a database.Connection using saved connections and environment profiles (for example, WHODB_POSTGRES='[...]' or WHODB_MYSQL_1='{...}').

func ResolveConnectionOrDefault

func ResolveConnectionOrDefault(name string) (*dbmgr.Connection, error)

ResolveConnectionOrDefault resolves a connection by name, or returns the default connection if name is empty and exactly one connection is available. Returns an error if name is empty and zero or multiple connections exist.

func Run

func Run(ctx context.Context, server *mcp.Server) error

Run starts the MCP server with stdio transport.

func RunHTTP

func RunHTTP(ctx context.Context, server *mcp.Server, opts *HTTPOptions, logger *slog.Logger) error

RunHTTP starts the MCP server as an HTTP service.

func ShutdownAnalytics

func ShutdownAnalytics()

ShutdownAnalytics flushes pending events and closes the analytics client.

func TrackError

func TrackError(ctx context.Context, toolName, requestID, operation string, errMsg string)

TrackError captures an MCP error event.

func TrackServerStart

func TrackServerStart(ctx context.Context, transport string, securityMode string, props map[string]any)

TrackServerStart captures an MCP server start event.

func TrackToolCall

func TrackToolCall(ctx context.Context, toolName, requestID string, success bool, durationMs int64, props map[string]any)

TrackToolCall captures an MCP tool invocation event.

func ValidateColumnsInput

func ValidateColumnsInput(input *ColumnsInput, connectionCount int) error

ValidateColumnsInput validates the input for whodb_columns tool.

func ValidateConfirmInput

func ValidateConfirmInput(input *ConfirmInput) error

ValidateConfirmInput validates the input for whodb_confirm tool.

func ValidateQueryInput

func ValidateQueryInput(input *QueryInput, connectionCount int) error

ValidateQueryInput validates the input for whodb_query tool.

func ValidateSQLStatement

func ValidateSQLStatement(query string, allowWrite bool, securityLevel SecurityLevel, allowMultiStatement bool, allowDestructive bool) error

ValidateSQLStatement validates a SQL statement against security rules. Parameters:

  • allowWrite: permits INSERT/UPDATE/DELETE/CREATE/ALTER
  • allowDestructive: permits DROP/TRUNCATE (requires explicit opt-in via --allow-drop or --confirm-writes)

func ValidateSchemasInput

func ValidateSchemasInput(input *SchemasInput, connectionCount int) error

ValidateSchemasInput validates the input for whodb_schemas tool.

func ValidateTablesInput

func ValidateTablesInput(input *TablesInput, connectionCount int) error

ValidateTablesInput validates the input for whodb_tables tool.

Types

type AnalyticsConfig

type AnalyticsConfig struct {
	// Enabled controls whether analytics are active. Default: true
	Enabled bool
	// AppVersion is the CLI version for tracking.
	AppVersion string
}

AnalyticsConfig holds MCP analytics configuration.

type AuditInput

type AuditInput struct {
	// Connection is the name of a saved connection or environment profile.
	Connection string `json:"connection" jsonschema:"Connection name (optional if only one exists)"`
	// Schema optionally overrides the schema/database to inspect.
	Schema string `json:"schema,omitempty" jsonschema:"Schema or database name override"`
	// Table restricts the audit to a single table.
	Table string `json:"table,omitempty" jsonschema:"Optional table name"`
	// NullWarning sets the warning threshold for null rates.
	NullWarning float64 `json:"null_warning,omitempty" jsonschema:"Warning threshold for null percentage"`
	// NullError sets the error threshold for null rates.
	NullError float64 `json:"null_error,omitempty" jsonschema:"Error threshold for null percentage"`
}

AuditInput is the input for the whodb_audit tool.

type AuditOutput

type AuditOutput struct {
	Summary   AuditSummary        `json:"summary"`
	Results   []*dbmgr.TableAudit `json:"results"`
	Error     string              `json:"error,omitempty"`
	RequestID string              `json:"request_id,omitempty"`
}

AuditOutput is the output for the whodb_audit tool.

func HandleAudit

func HandleAudit(ctx context.Context, req *mcp.CallToolRequest, input AuditInput) (*mcp.CallToolResult, AuditOutput, error)

HandleAudit runs data-quality checks across one schema or one table.

func (AuditOutput) MarshalJSON

func (o AuditOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type AuditSummary

type AuditSummary struct {
	TablesScanned int `json:"tables_scanned"`
	IssuesFound   int `json:"issues_found"`
}

AuditSummary reports the aggregate audit counts returned by whodb_audit.

type ColumnInfo

type ColumnInfo struct {
	Name             string `json:"name"`
	Type             string `json:"type"`
	IsPrimary        bool   `json:"is_primary"`
	IsForeignKey     bool   `json:"is_foreign_key"`
	ReferencedTable  string `json:"referenced_table,omitempty"`
	ReferencedColumn string `json:"referenced_column,omitempty"`
}

ColumnInfo represents information about a database column.

type ColumnsInput

type ColumnsInput struct {
	// Connection is the name of a saved connection or environment profile.
	Connection string `json:"connection" jsonschema:"Connection name (optional if only one exists)"`
	// Schema containing the table
	Schema string `json:"schema,omitempty" jsonschema:"Schema name (uses default if omitted)"`
	// Table name to describe
	Table string `json:"table" jsonschema:"Table name to describe"`
}

ColumnsInput is the input for the whodb_columns tool.

type ColumnsOutput

type ColumnsOutput struct {
	Columns   []ColumnInfo `json:"columns"`
	Table     string       `json:"table"`
	Schema    string       `json:"schema"`
	Error     string       `json:"error,omitempty"`
	RequestID string       `json:"request_id,omitempty"` // Unique ID for request tracing
}

ColumnsOutput is the output for the whodb_columns tool.

func HandleColumns

HandleColumns describes columns in a table.

func (ColumnsOutput) MarshalJSON

func (o ColumnsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type ConfirmInput

type ConfirmInput struct {
	// Token is the confirmation token from a previous write response.
	Token string `json:"token" jsonschema:"Confirmation token from a previous whodb_query or hosted platform write response"`
}

ConfirmInput is the input for the whodb_confirm tool.

type ConfirmOutput

type ConfirmOutput struct {
	PlatformSetupGuidance
	Columns     []string `json:"columns"`
	ColumnTypes []string `json:"column_types,omitempty"`
	Rows        [][]any  `json:"rows"`
	Error       string   `json:"error,omitempty"`
	Message     string   `json:"message,omitempty"`
	RequestID   string   `json:"request_id,omitempty"` // Unique ID for request tracing
}

ConfirmOutput is the output for the whodb_confirm tool.

func HandleConfirm

func HandleConfirm(ctx context.Context, req *mcp.CallToolRequest, input ConfirmInput, secOpts *SecurityOptions) (*mcp.CallToolResult, ConfirmOutput, error)

HandleConfirm confirms and executes a pending write operation.

func HandlePlatformConfirm

func HandlePlatformConfirm(ctx context.Context, req *mcp.CallToolRequest, input ConfirmInput) (*mcp.CallToolResult, ConfirmOutput, error)

HandlePlatformConfirm confirms and executes a pending hosted platform write.

func (ConfirmOutput) MarshalJSON

func (o ConfirmOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null, which the MCP SDK's output schema validator requires.

type ConnectionInfo

type ConnectionInfo struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Host     string `json:"host,omitempty"`
	Port     int    `json:"port,omitempty"`
	Database string `json:"database,omitempty"`
	Schema   string `json:"schema,omitempty"`
	Source   string `json:"source"` // "env" or "saved"
}

ConnectionInfo represents a connection (without sensitive data).

type ConnectionsInput

type ConnectionsInput struct{}

ConnectionsInput is the input for the whodb_connections tool.

type ConnectionsOutput

type ConnectionsOutput struct {
	Connections []ConnectionInfo `json:"connections"`
	Error       string           `json:"error,omitempty"`
	RequestID   string           `json:"request_id,omitempty"` // Unique ID for request tracing
}

ConnectionsOutput is the output for the whodb_connections tool.

func HandleConnections

HandleConnections lists all available connections.

func (ConnectionsOutput) MarshalJSON

func (o ConnectionsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type ERDColumn

type ERDColumn struct {
	Name             string `json:"name"`
	Type             string `json:"type,omitempty"`
	IsPrimary        bool   `json:"is_primary,omitempty"`
	IsForeignKey     bool   `json:"is_foreign_key,omitempty"`
	ReferencedTable  string `json:"referenced_table,omitempty"`
	ReferencedColumn string `json:"referenced_column,omitempty"`
}

ERDColumn describes one column in the whodb_erd response.

type ERDInput

type ERDInput struct {
	// Connection is the name of a saved connection or environment profile.
	Connection string `json:"connection" jsonschema:"Connection name (optional if only one exists)"`
	// Schema optionally overrides the schema/database to inspect.
	Schema string `json:"schema,omitempty" jsonschema:"Schema or database name override"`
}

ERDInput is the input for the whodb_erd tool.

type ERDOutput

type ERDOutput struct {
	Schema        string            `json:"schema,omitempty"`
	StorageUnits  []ERDStorageUnit  `json:"storage_units"`
	Relationships []ERDRelationship `json:"relationships"`
	Error         string            `json:"error,omitempty"`
	RequestID     string            `json:"request_id,omitempty"`
}

ERDOutput is the output for the whodb_erd tool.

func HandleERD

func HandleERD(ctx context.Context, req *mcp.CallToolRequest, input ERDInput) (*mcp.CallToolResult, ERDOutput, error)

HandleERD loads backend graph metadata for a connection.

func (ERDOutput) MarshalJSON

func (o ERDOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type ERDRelationship

type ERDRelationship struct {
	SourceStorageUnit string `json:"source_storage_unit"`
	SourceColumn      string `json:"source_column,omitempty"`
	TargetStorageUnit string `json:"target_storage_unit"`
	TargetColumn      string `json:"target_column,omitempty"`
	RelationshipType  string `json:"relationship_type,omitempty"`
}

ERDRelationship describes a normalized relationship edge in the whodb_erd response.

type ERDStorageUnit

type ERDStorageUnit struct {
	Name    string      `json:"name"`
	Kind    string      `json:"kind,omitempty"`
	Columns []ERDColumn `json:"columns,omitempty"`
}

ERDStorageUnit describes one storage unit in the whodb_erd response.

type ExplainInput

type ExplainInput struct {
	// Connection is the name of a saved connection or environment profile.
	Connection string `json:"connection" jsonschema:"Connection name (optional if only one exists)"`
	// Query is the SQL query to explain.
	Query string `json:"query" jsonschema:"SQL query to explain"`
}

ExplainInput is the input for the whodb_explain tool.

type ExplainOutput

type ExplainOutput struct {
	Columns     []string `json:"columns"`
	ColumnTypes []string `json:"column_types,omitempty"`
	Rows        [][]any  `json:"rows"`
	Error       string   `json:"error,omitempty"`
	RequestID   string   `json:"request_id,omitempty"`
}

ExplainOutput is the output for the whodb_explain tool.

func HandleExplain

HandleExplain runs EXPLAIN for a SQL query against the specified connection.

func (ExplainOutput) MarshalJSON

func (o ExplainOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type HTTPOptions

type HTTPOptions struct {
	// Host to bind to (default: "localhost").
	Host string
	// Port to listen on (default: 3000).
	Port int
	// AuthToken, when non-empty, requires every /mcp request to present a matching
	// "Authorization: Bearer <token>" header. Recommended whenever the server binds
	// to a non-loopback interface.
	AuthToken string
}

HTTPOptions configures the HTTP transport.

type PendingConfirmation

type PendingConfirmation struct {
	Token      string
	Query      string
	Connection string
	ExpiresAt  time.Time
	// contains filtered or unexported fields
}

PendingConfirmation stores a query awaiting user confirmation

type PendingInfo

type PendingInfo struct {
	Token      string `json:"token"`
	Query      string `json:"query,omitempty"`
	Connection string `json:"connection,omitempty"`
	ExpiresAt  string `json:"expires_at"` // ISO 8601
}

PendingInfo represents a pending confirmation visible to the LLM.

type PendingInput

type PendingInput struct{}

PendingInput is the input for the whodb_pending tool (no parameters needed).

type PendingOutput

type PendingOutput struct {
	Pending   []PendingInfo `json:"pending"`
	Error     string        `json:"error,omitempty"`
	RequestID string        `json:"request_id,omitempty"`
}

PendingOutput is the output for the whodb_pending tool.

func HandlePending

func HandlePending(ctx context.Context, req *mcp.CallToolRequest, input PendingInput, secOpts *SecurityOptions) (*mcp.CallToolResult, PendingOutput, error)

HandlePending lists all non-expired pending confirmations.

func (PendingOutput) MarshalJSON

func (o PendingOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PendingPlatformAction

type PendingPlatformAction struct {
	Token          string
	Operation      string
	Resource       string
	Action         string
	Summary        string
	Host           string
	OrgID          string
	ProjectID      string
	ProjectName    string
	SourceID       string
	SourceName     string
	SourceType     string
	Changes        []string
	CreateInput    platformapi.CreateSourceInput
	UpdateInput    platformapi.UpdateSourceInput
	Mutation       string
	Variables      map[string]any
	BundlePlan     *platformapi.BundlePlan
	WorkflowPlanID string
	WorkflowSteps  int
	IdempotencyKey string
	ExpiresAt      time.Time
	// contains filtered or unexported fields
}

PendingPlatformAction stores a hosted platform write awaiting confirmation.

func (*PendingPlatformAction) Preview

func (action *PendingPlatformAction) Preview() *PlatformActionPreview

func (*PendingPlatformAction) WorkflowStepCount

func (action *PendingPlatformAction) WorkflowStepCount() int

type PlatformAccessInput

type PlatformAccessInput struct {
	ResourceType string   `json:"resource_type,omitempty" jsonschema:"Resource type, for example dataset, app, or function"`
	ResourceID   string   `json:"resource_id,omitempty" jsonschema:"Resource id"`
	TeamID       string   `json:"team_id,omitempty" jsonschema:"Team id for team members"`
	Fields       []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields"`
}

PlatformAccessInput selects resource access information.

type PlatformActionPreview

type PlatformActionPreview struct {
	Operation    string                `json:"operation"`
	Resource     string                `json:"resource,omitempty"`
	Action       string                `json:"action,omitempty"`
	Summary      string                `json:"summary,omitempty"`
	Host         string                `json:"host"`
	OrgID        string                `json:"org_id"`
	ProjectID    string                `json:"project_id"`
	ProjectName  string                `json:"project_name,omitempty"`
	SourceID     string                `json:"source_id,omitempty"`
	SourceName   string                `json:"source_name,omitempty"`
	SourceType   string                `json:"source_type,omitempty"`
	Changes      []string              `json:"changes,omitempty"`
	FieldChanges []PlatformFieldChange `json:"field_changes,omitempty"`
	WillAffect   []string              `json:"will_affect,omitempty"`
	WorkflowID   string                `json:"workflow_id,omitempty"`
	StepCount    int                   `json:"step_count,omitempty"`
}

PlatformActionPreview describes a pending hosted source write without secrets.

type PlatformAppInput

type PlatformAppInput struct {
	ID      string   `json:"id,omitempty" jsonschema:"App id for detail, files, or version view"`
	Version int      `json:"version,omitempty" jsonschema:"App version for a version view"`
	Env     string   `json:"env,omitempty" jsonschema:"Optional app environment for the current view"`
	Fields  []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields"`
}

PlatformAppInput selects one hosted app or app-related view.

type PlatformBuildPlan

type PlatformBuildPlan struct {
	Goal          string                  `json:"goal"`
	Scope         *PlatformOutputScope    `json:"scope,omitempty"`
	Prerequisites []PlatformWorkflowCheck `json:"prerequisites"`
	Phases        []PlatformPlanPhase     `json:"phases"`
	Gaps          []PlatformWorkflowGap   `json:"gaps"`
	Warnings      []string                `json:"warnings"`
}

PlatformBuildPlan is an end-to-end platform workflow plan for a user goal.

type PlatformBuildPlanInput

type PlatformBuildPlanInput struct {
	Goal        string   `json:"goal" jsonschema:"User goal or desired app/data workflow to plan against."`
	OmitFiles   bool     `json:"omit_files,omitempty" jsonschema:"Omit root folder file and folder summaries. Defaults to false."`
	OmitLineage bool     `json:"omit_lineage,omitempty" jsonschema:"Omit project lineage summary. Defaults to false."`
	Fields      []string `json:"fields,omitempty" jsonschema:"Top-level output fields to include, for example phases, prerequisites, warnings."`
}

PlatformBuildPlanInput is the input for the whodb_platform_build_plan tool.

type PlatformBundleExportInput

type PlatformBundleExportInput struct {
	IncludeFiles bool `json:"include_files,omitempty" jsonschema:"Include previewable uploaded file content up to max_file_bytes per file"`
	MaxFileBytes int  `json:"max_file_bytes,omitempty" jsonschema:"Maximum bytes to include per uploaded file when include_files is true"`
}

PlatformBundleExportInput is the input for whodb_platform_bundle_export.

type PlatformBundleExportOutput

type PlatformBundleExportOutput struct {
	PlatformSetupGuidance
	Bundle    *platformapi.ProjectBundle `json:"bundle,omitempty"`
	Counts    map[string]int             `json:"counts,omitempty"`
	Error     string                     `json:"error,omitempty"`
	RequestID string                     `json:"request_id,omitempty"`
}

PlatformBundleExportOutput returns a selected-project metadata bundle.

func HandlePlatformBundleExport

HandlePlatformBundleExport exports selected-project metadata as a bundle.

type PlatformBundlePlanInput

type PlatformBundlePlanInput struct {
	BundleJSON         string `json:"bundle_json" jsonschema:"Project bundle JSON from whodb_platform_bundle_export or resources export"`
	Prefix             string `json:"prefix,omitempty" jsonschema:"Optional prefix added to imported resource names"`
	RenameConflicts    bool   `json:"rename_conflicts,omitempty" jsonschema:"Create unique names for resources that conflict with existing resources"`
	OverwriteConflicts bool   `json:"overwrite_conflicts,omitempty" jsonschema:"Update resources that conflict with existing resources"`
}

PlatformBundlePlanInput is the input for bundle diff and import-plan tools.

type PlatformBundlePlanOutput

type PlatformBundlePlanOutput struct {
	PlatformSetupGuidance
	Plan      *platformapi.BundlePlan `json:"plan,omitempty"`
	Counts    map[string]int          `json:"counts,omitempty"`
	Error     string                  `json:"error,omitempty"`
	RequestID string                  `json:"request_id,omitempty"`
}

PlatformBundlePlanOutput returns a bundle import plan for the selected project.

func HandlePlatformBundlePlan

func HandlePlatformBundlePlan(ctx context.Context, req *mcp.CallToolRequest, input PlatformBundlePlanInput, dryRun bool, toolName string) (*mcp.CallToolResult, PlatformBundlePlanOutput, error)

HandlePlatformBundlePlan plans a bundle import into the selected project.

type PlatformChangeImpact

type PlatformChangeImpact struct {
	Target         PlatformResourceGraphNode   `json:"target"`
	Action         string                      `json:"action,omitempty"`
	Affected       []PlatformResourceGraphNode `json:"affected"`
	Edges          []PlatformResourceGraphEdge `json:"edges"`
	SuggestedReads []string                    `json:"suggested_reads"`
	Warnings       []string                    `json:"warnings"`
}

PlatformChangeImpact summarizes direct graph impact for a planned change.

type PlatformChangeImpactInput

type PlatformChangeImpactInput struct {
	Resource    string   `` /* 129-byte string literal not displayed */
	ID          string   `json:"id" jsonschema:"Resource id"`
	Action      string   `json:"action,omitempty" jsonschema:"Optional planned action, for example update, delete, run, deploy, promote_to_dataset"`
	OmitFiles   bool     `json:"omit_files,omitempty" jsonschema:"Omit root folder file and folder nodes. Defaults to false."`
	OmitLineage bool     `json:"omit_lineage,omitempty" jsonschema:"Omit hosted lineage edges. Defaults to false."`
	Fields      []string `json:"fields,omitempty" jsonschema:"Top-level output fields to include, for example target, affected, warnings."`
}

PlatformChangeImpactInput is the input for the whodb_platform_change_impact tool.

type PlatformCloneInput

type PlatformCloneInput struct {
	Resource string `json:"resource" jsonschema:"Resource to clone: dataset, ontology, transform, or function"`
	Source   string `json:"source" jsonschema:"Source resource id, name, or api name"`
	NewName  string `json:"new_name" jsonschema:"New resource name or ontology api name/display name"`
}

PlatformCloneInput is the input for whodb_platform_clone.

type PlatformCreateDatasetInput

type PlatformCreateDatasetInput struct {
	Name            string                       `json:"name" jsonschema:"Dataset name"`
	Description     string                       `json:"description,omitempty" jsonschema:"Optional dataset description"`
	SchemaMode      string                       `json:"schema_mode,omitempty" jsonschema:"Dataset schema mode, for example manual"`
	SourceID        string                       `json:"source_id,omitempty" jsonschema:"Optional hosted source id for source-backed datasets"`
	SourceObjectRef string                       `` /* 171-byte string literal not displayed */
	Columns         []PlatformDatasetColumnInput `json:"columns,omitempty" jsonschema:"Manual schema columns"`
}

PlatformCreateDatasetInput is the input for whodb_platform_create_dataset.

type PlatformDataModelSummary

type PlatformDataModelSummary struct {
	Sources        []PlatformWorkspaceItem     `json:"sources"`
	Datasets       []PlatformWorkspaceItem     `json:"datasets"`
	Ontologies     []PlatformWorkspaceItem     `json:"ontologies"`
	Relationships  []PlatformResourceGraphEdge `json:"relationships"`
	Gaps           []string                    `json:"gaps"`
	SuggestedTools []string                    `json:"suggested_tools"`
}

PlatformDataModelSummary summarizes data-model resources and gaps.

type PlatformDatasetColumnInput

type PlatformDatasetColumnInput struct {
	Name       string `json:"name" jsonschema:"Column name"`
	Type       string `json:"type" jsonschema:"Column data type"`
	IsNullable bool   `json:"is_nullable,omitempty" jsonschema:"Whether the column may be null"`
	IsPrimary  bool   `json:"is_primary,omitempty" jsonschema:"Whether the column is part of the primary key"`
}

PlatformDatasetColumnInput describes a dataset column for typed MCP writes.

type PlatformDoctorInput

type PlatformDoctorInput struct{}

PlatformDoctorInput is the input for whodb_platform_doctor.

type PlatformDoctorOutput

type PlatformDoctorOutput struct {
	Host                    string   `json:"host,omitempty"`
	Email                   string   `json:"email,omitempty"`
	WorkspaceSelected       bool     `json:"workspace_selected"`
	OrgID                   string   `json:"org_id,omitempty"`
	OrgName                 string   `json:"org_name,omitempty"`
	ProjectID               string   `json:"project_id,omitempty"`
	ProjectName             string   `json:"project_name,omitempty"`
	PlatformVersion         string   `json:"platform_version,omitempty"`
	ManifestProtocolVersion string   `json:"manifest_protocol_version,omitempty"`
	Checks                  []string `json:"checks"`
	Warnings                []string `json:"warnings,omitempty"`
	NextSteps               []string `json:"next_steps,omitempty"`
	Commands                []string `json:"commands,omitempty"`
	Error                   string   `json:"error,omitempty"`
	RequestID               string   `json:"request_id,omitempty"`
}

PlatformDoctorOutput reports hosted platform readiness for MCP tools.

func HandlePlatformDoctor

HandlePlatformDoctor reports whether hosted platform MCP tools are ready to use.

type PlatformEmptyInput

type PlatformEmptyInput struct {
	Name       string   `json:"name,omitempty" jsonschema:"Optional case-insensitive name substring filter for list tools"`
	Search     string   `json:"search,omitempty" jsonschema:"Optional case-insensitive search term; currently aliases name for list tools"`
	Type       string   `` /* 128-byte string literal not displayed */
	Status     string   `json:"status,omitempty" jsonschema:"Optional status filter for resources that expose status"`
	SchemaMode string   `json:"schema_mode,omitempty" jsonschema:"Optional dataset schema mode filter"`
	Deployed   string   `json:"deployed,omitempty" jsonschema:"Optional function deployment filter: true or false"`
	Limit      int      `json:"limit,omitempty" jsonschema:"Maximum list items to return; use offset to continue"`
	Offset     int      `json:"offset,omitempty" jsonschema:"Number of matching list items to skip"`
	Fields     []string `` /* 142-byte string literal not displayed */
}

PlatformEmptyInput is the input for selected-project list tools.

type PlatformEntityInput

type PlatformEntityInput struct {
	ID     string   `json:"id" jsonschema:"Resource id"`
	Fields []string `` /* 142-byte string literal not displayed */
}

PlatformEntityInput is a selected-project input with one resource id.

type PlatformEntityWriteInput

type PlatformEntityWriteInput struct {
	ID string `json:"id" jsonschema:"Resource id"`
}

PlatformEntityWriteInput is a typed write input with one resource id.

type PlatformErrorCode

type PlatformErrorCode string

PlatformErrorCode is a stable category an agent can use to decide whether to retry, ask for setup, or change the requested operation.

const (
	PlatformErrorAuth        PlatformErrorCode = "authentication_required"
	PlatformErrorWorkspace   PlatformErrorCode = "workspace_required"
	PlatformErrorValidation  PlatformErrorCode = "invalid_input"
	PlatformErrorNotFound    PlatformErrorCode = "not_found"
	PlatformErrorPermission  PlatformErrorCode = "permission_denied"
	PlatformErrorConflict    PlatformErrorCode = "conflict"
	PlatformErrorRateLimited PlatformErrorCode = "rate_limited"
	PlatformErrorBackend     PlatformErrorCode = "platform_error"
)

type PlatformFieldChange

type PlatformFieldChange struct {
	Field    string         `json:"field"`
	After    map[string]any `json:"after,omitempty"`
	Redacted bool           `json:"redacted,omitempty"`
}

PlatformFieldChange is a redacted before/after summary for a pending write.

type PlatformFileColumnMapInput

type PlatformFileColumnMapInput struct {
	SourceColumn  string `json:"source_column" jsonschema:"Column name in the file"`
	DatasetColumn string `json:"dataset_column" jsonschema:"Column name in the dataset"`
	DataType      string `json:"data_type" jsonschema:"Dataset data type"`
	IsNullable    bool   `json:"is_nullable,omitempty" jsonschema:"Whether the dataset column may be null"`
	IsPrimary     bool   `json:"is_primary,omitempty" jsonschema:"Whether the dataset column is part of the primary key"`
}

PlatformFileColumnMapInput describes one file-to-dataset promotion column.

type PlatformFileInspectInput

type PlatformFileInspectInput struct {
	FileID      string   `json:"file_id" jsonschema:"Project file id"`
	SheetIndex  *int     `json:"sheet_index,omitempty" jsonschema:"Optional spreadsheet sheet index"`
	IncludeRows bool     `json:"include_rows,omitempty" jsonschema:"Include preview rows. Defaults to false to keep context compact."`
	Fields      []string `` /* 132-byte string literal not displayed */
}

PlatformFileInspectInput is the input for the whodb_platform_file_inspect tool.

type PlatformFilePreviewInput

type PlatformFilePreviewInput struct {
	FileID     string   `json:"file_id" jsonschema:"Project file id"`
	SheetIndex *int     `json:"sheet_index,omitempty" jsonschema:"Optional spreadsheet sheet index"`
	Fields     []string `` /* 139-byte string literal not displayed */
}

PlatformFilePreviewInput is the input for the whodb_platform_file_preview tool.

type PlatformFileSearchInput

type PlatformFileSearchInput struct {
	Query  string   `json:"query" jsonschema:"File search query"`
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformFileSearchInput is the input for the whodb_platform_file_search tool.

type PlatformFilesInput

type PlatformFilesInput struct {
	FolderID string   `json:"folder_id,omitempty" jsonschema:"Folder id. Omit for project root."`
	Name     string   `json:"name,omitempty" jsonschema:"Optional case-insensitive name substring filter"`
	Kind     string   `json:"kind,omitempty" jsonschema:"Optional entry kind filter: file or folder"`
	MIMEType string   `json:"mime_type,omitempty" jsonschema:"Optional file MIME type substring filter"`
	Fields   []string `` /* 142-byte string literal not displayed */
}

PlatformFilesInput is the input for the whodb_platform_files tool.

type PlatformGapAnalysis

type PlatformGapAnalysis struct {
	Goal        string                `json:"goal,omitempty"`
	Scope       *PlatformOutputScope  `json:"scope,omitempty"`
	Counts      map[string]int        `json:"counts"`
	Ready       []string              `json:"ready"`
	Gaps        []PlatformWorkflowGap `json:"gaps"`
	NextActions []PlatformNextAction  `json:"next_actions"`
	Warnings    []string              `json:"warnings"`
}

PlatformGapAnalysis is a goal-aware readiness and missing-capability report.

type PlatformGapAnalysisInput

type PlatformGapAnalysisInput struct {
	Goal        string   `json:"goal,omitempty" jsonschema:"Optional user goal or desired app/data workflow to analyze gaps against."`
	OmitFiles   bool     `json:"omit_files,omitempty" jsonschema:"Omit root folder file and folder summaries. Defaults to false."`
	OmitLineage bool     `json:"omit_lineage,omitempty" jsonschema:"Omit project lineage summary. Defaults to false."`
	Fields      []string `json:"fields,omitempty" jsonschema:"Top-level output fields to include, for example gaps, ready, counts, next_actions."`
}

PlatformGapAnalysisInput is the input for the whodb_platform_gap_analysis tool.

type PlatformGenericWriteInput

type PlatformGenericWriteInput struct {
	Resource       string         `` /* 144-byte string literal not displayed */
	ID             string         `json:"id,omitempty" jsonschema:"Resource id for update, delete, or action operations"`
	Action         string         `` /* 133-byte string literal not displayed */
	IdempotencyKey string         `` /* 147-byte string literal not displayed */
	Payload        map[string]any `` /* 164-byte string literal not displayed */
	PayloadJSON    string         `` /* 159-byte string literal not displayed */
}

PlatformGenericWriteInput describes a hosted platform create, update, delete, or action request.

type PlatformGenericWriteOutput

type PlatformGenericWriteOutput struct {
	PlatformSetupGuidance
	ConfirmationRequired bool                    `json:"confirmation_required,omitempty"`
	ConfirmationToken    string                  `json:"confirmation_token,omitempty"`
	ConfirmationAction   string                  `json:"confirmation_action,omitempty"`
	ConfirmationPreview  *PlatformActionPreview  `json:"confirmation_preview,omitempty"`
	ConfirmationExpiry   string                  `json:"confirmation_expiry,omitempty"`
	Warning              string                  `json:"warning,omitempty"`
	Status               string                  `json:"status,omitempty"`
	IdempotencyReplayed  bool                    `json:"idempotency_replayed,omitempty"`
	ResultJSON           string                  `json:"result_json,omitempty"`
	Error                string                  `json:"error,omitempty"`
	ErrorCode            string                  `json:"error_code,omitempty"`
	Retryable            bool                    `json:"retryable,omitempty"`
	SuggestedTools       []string                `json:"suggested_tools,omitempty"`
	Recovery             *PlatformRecoveryAdvice `json:"recovery,omitempty"`
	RequestID            string                  `json:"request_id,omitempty"`
}

PlatformGenericWriteOutput reports a hosted platform write result or pending confirmation.

func HandlePlatformBundleImport

func HandlePlatformBundleImport(ctx context.Context, req *mcp.CallToolRequest, input PlatformBundlePlanInput, confirmWrites bool) (*mcp.CallToolResult, PlatformGenericWriteOutput, error)

HandlePlatformBundleImport prepares or executes a bundle import into the selected project.

func HandlePlatformClone

func HandlePlatformClone(ctx context.Context, req *mcp.CallToolRequest, input PlatformCloneInput, confirmWrites bool) (*mcp.CallToolResult, PlatformGenericWriteOutput, error)

HandlePlatformClone clones a dataset, ontology, transform, or function.

func HandlePlatformProjectCreate

func HandlePlatformProjectCreate(ctx context.Context, req *mcp.CallToolRequest, input PlatformProjectCreateInput, confirmWrites bool) (*mcp.CallToolResult, PlatformGenericWriteOutput, error)

HandlePlatformProjectCreate prepares or executes a hosted project creation.

func HandlePlatformProjectDelete

func HandlePlatformProjectDelete(ctx context.Context, req *mcp.CallToolRequest, input PlatformProjectDeleteInput, confirmWrites bool) (*mcp.CallToolResult, PlatformGenericWriteOutput, error)

HandlePlatformProjectDelete prepares or executes a hosted project deletion.

func HandlePlatformProjectRename

func HandlePlatformProjectRename(ctx context.Context, req *mcp.CallToolRequest, input PlatformProjectRenameInput, confirmWrites bool) (*mcp.CallToolResult, PlatformGenericWriteOutput, error)

HandlePlatformProjectRename prepares or executes a hosted project rename.

type PlatformLineageInput

type PlatformLineageInput struct {
	RootID    string   `json:"root_id" jsonschema:"Root node id"`
	RootType  string   `json:"root_type" jsonschema:"Root node type"`
	Direction string   `json:"direction,omitempty" jsonschema:"Optional lineage direction"`
	MaxDepth  int      `json:"max_depth,omitempty" jsonschema:"Optional maximum graph depth"`
	Fields    []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformLineageInput is the input for the whodb_platform_lineage tool.

type PlatformLineageNeighborsInput

type PlatformLineageNeighborsInput struct {
	NodeID   string   `json:"node_id" jsonschema:"Node id"`
	NodeType string   `json:"node_type" jsonschema:"Node type"`
	Fields   []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformLineageNeighborsInput is the input for the whodb_platform_lineage_neighbors tool.

type PlatformLineageSummary

type PlatformLineageSummary struct {
	NodeCount int `json:"node_count"`
	EdgeCount int `json:"edge_count"`
}

PlatformLineageSummary is a compact lineage overview.

type PlatformNextAction

type PlatformNextAction struct {
	Priority       int      `json:"priority"`
	Area           string   `json:"area"`
	Title          string   `json:"title"`
	Reason         string   `json:"reason"`
	SuggestedTools []string `json:"suggested_tools"`
	ReadOnly       bool     `json:"read_only"`
}

PlatformNextAction describes one deterministic suggested next step for an agent.

type PlatformNextActions

type PlatformNextActions struct {
	Goal     string               `json:"goal,omitempty"`
	Actions  []PlatformNextAction `json:"actions"`
	Warnings []string             `json:"warnings"`
}

PlatformNextActions describes suggested next steps based on the selected project.

type PlatformNextActionsInput

type PlatformNextActionsInput struct {
	Goal        string   `json:"goal,omitempty" jsonschema:"Optional user goal used to keep suggested actions relevant."`
	OmitFiles   bool     `json:"omit_files,omitempty" jsonschema:"Omit root folder file and folder summaries. Defaults to false."`
	OmitLineage bool     `json:"omit_lineage,omitempty" jsonschema:"Omit project lineage summary. Defaults to false."`
	Fields      []string `json:"fields,omitempty" jsonschema:"Top-level output fields to include, for example actions, warnings, goal."`
}

PlatformNextActionsInput is the input for the whodb_platform_next_actions tool.

type PlatformOntologyFastLookupInput

type PlatformOntologyFastLookupInput struct {
	EntityID string   `json:"entity_id" jsonschema:"Ontology id"`
	Fields   []string `json:"fields" jsonschema:"Ontology properties to include in the lookup"`
	Reason   string   `json:"reason,omitempty" jsonschema:"Optional reason for the lookup"`
}

PlatformOntologyFastLookupInput is the input for whodb_platform_create_ontology_fast_lookup.

type PlatformOntologyFollowLinkInput

type PlatformOntologyFollowLinkInput struct {
	EntityID    string   `json:"entity_id" jsonschema:"Ontology id"`
	PrimaryKey  string   `json:"primary_key" jsonschema:"Primary key value of the source ontology row"`
	LinkAPIName string   `json:"link_api_name" jsonschema:"Ontology link apiName to follow"`
	Limit       int      `json:"limit,omitempty" jsonschema:"Maximum rows to return"`
	Offset      int      `json:"offset,omitempty" jsonschema:"Row offset"`
	Fields      []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformOntologyFollowLinkInput is the input for the whodb_platform_ontology_follow_link tool.

type PlatformOntologyRecordInput

type PlatformOntologyRecordInput struct {
	EntityID      string            `json:"entity_id" jsonschema:"Ontology id"`
	Values        map[string]string `json:"values" jsonschema:"Record values keyed by ontology property"`
	UpdateColumns []string          `json:"update_columns,omitempty" jsonschema:"Ontology properties to update; required for update"`
}

PlatformOntologyRecordInput is the input for ontology record write tools.

type PlatformOrgInfo

type PlatformOrgInfo struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Slug     string `json:"slug"`
	Selected bool   `json:"selected"`
}

PlatformOrgInfo describes an organization visible to the hosted user.

type PlatformOrgsInput

type PlatformOrgsInput struct {
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include in items"`
}

PlatformOrgsInput is the input for the whodb_platform_orgs tool.

type PlatformOrgsOutput

type PlatformOrgsOutput struct {
	PlatformSetupGuidance
	Host      string               `json:"host,omitempty"`
	Orgs      []PlatformOrgInfo    `json:"orgs"`
	Items     []map[string]any     `json:"items,omitempty"`
	Count     int                  `json:"count"`
	Scope     *PlatformOutputScope `json:"scope,omitempty"`
	Fields    []string             `json:"fields,omitempty"`
	Warnings  []string             `json:"warnings,omitempty"`
	Error     string               `json:"error,omitempty"`
	RequestID string               `json:"request_id,omitempty"`
}

PlatformOrgsOutput lists organizations visible to the hosted user.

func HandlePlatformOrgs

HandlePlatformOrgs lists hosted organizations visible to the authenticated user.

func (PlatformOrgsOutput) MarshalJSON

func (o PlatformOrgsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformOutputScope

type PlatformOutputScope struct {
	Host        string `json:"host,omitempty"`
	OrgID       string `json:"org_id,omitempty"`
	OrgName     string `json:"org_name,omitempty"`
	ProjectID   string `json:"project_id,omitempty"`
	ProjectName string `json:"project_name,omitempty"`
}

PlatformOutputScope identifies the hosted workspace used for a platform MCP read.

type PlatformPackageInput

type PlatformPackageInput struct {
	ID     string   `json:"id,omitempty" jsonschema:"Package or installation id"`
	Search string   `json:"search,omitempty" jsonschema:"Optional package library search"`
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields"`
}

PlatformPackageInput selects one hosted package or installation.

type PlatformPackagePreviewInput

type PlatformPackagePreviewInput struct {
	InputJSON string   `json:"input_json" jsonschema:"JSON object matching the selected package preview input type"`
	Fields    []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields"`
}

PlatformPackagePreviewInput describes the input object for a package dry run.

type PlatformPendingInfo

type PlatformPendingInfo struct {
	Token     string                `json:"token"`
	Action    PlatformActionPreview `json:"action"`
	ExpiresAt string                `json:"expires_at"`
}

PlatformPendingInfo represents a pending hosted platform confirmation.

type PlatformPendingInput

type PlatformPendingInput struct{}

PlatformPendingInput is the input for the whodb_platform_pending tool.

type PlatformPendingOutput

type PlatformPendingOutput struct {
	Pending   []PlatformPendingInfo `json:"pending"`
	Error     string                `json:"error,omitempty"`
	RequestID string                `json:"request_id,omitempty"`
}

PlatformPendingOutput lists pending hosted platform confirmations.

func HandlePlatformPending

HandlePlatformPending lists pending hosted platform confirmations.

func (PlatformPendingOutput) MarshalJSON

func (o PlatformPendingOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformPlanPhase

type PlatformPlanPhase struct {
	Phase       string   `json:"phase"`
	Objective   string   `json:"objective"`
	ReadTools   []string `json:"read_tools,omitempty"`
	WriteTools  []string `json:"write_tools,omitempty"`
	VerifyTools []string `json:"verify_tools,omitempty"`
	Notes       []string `json:"notes,omitempty"`
}

PlatformPlanPhase is one phase in a recommended platform workflow.

type PlatformProjectCreateInput

type PlatformProjectCreateInput struct {
	Org         string `json:"org,omitempty" jsonschema:"Organization id, slug, or name. Defaults to the selected organization when available."`
	Name        string `json:"name" jsonschema:"Project name"`
	Description string `json:"description,omitempty" jsonschema:"Project description"`
}

PlatformProjectCreateInput is the input for whodb_platform_project_create.

type PlatformProjectDeleteInput

type PlatformProjectDeleteInput struct {
	Org     string `json:"org,omitempty" jsonschema:"Organization id, slug, or name. Defaults to the selected organization when available."`
	Project string `json:"project" jsonschema:"Project id, slug, or name"`
}

PlatformProjectDeleteInput is the input for whodb_platform_project_delete.

type PlatformProjectHealth

type PlatformProjectHealth struct {
	Counts   map[string]int          `json:"counts"`
	Checks   []PlatformWorkflowCheck `json:"checks"`
	Warnings []string                `json:"warnings"`
	Scope    *PlatformOutputScope    `json:"scope,omitempty"`
	Next     []PlatformNextAction    `json:"next,omitempty"`
	Graph    *PlatformLineageSummary `json:"graph,omitempty"`
}

PlatformProjectHealth summarizes project-level health for agents.

type PlatformProjectInfo

type PlatformProjectInfo struct {
	ID          string `json:"id"`
	OrgID       string `json:"org_id"`
	OrgName     string `json:"org_name,omitempty"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description,omitempty"`
	Selected    bool   `json:"selected"`
}

PlatformProjectInfo describes a project visible to the hosted user.

type PlatformProjectRenameInput

type PlatformProjectRenameInput struct {
	Org     string `json:"org,omitempty" jsonschema:"Organization id, slug, or name. Defaults to the selected organization when available."`
	Project string `json:"project" jsonschema:"Project id, slug, or name"`
	Name    string `json:"name" jsonschema:"New project name"`
	Slug    string `json:"slug,omitempty" jsonschema:"Optional new project slug"`
}

PlatformProjectRenameInput is the input for whodb_platform_project_rename.

type PlatformProjectsInput

type PlatformProjectsInput struct {
	Org    string   `json:"org,omitempty" jsonschema:"Organization id, slug, or name. Defaults to the selected organization when available."`
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include in items"`
}

PlatformProjectsInput is the input for the whodb_platform_projects tool.

type PlatformProjectsOutput

type PlatformProjectsOutput struct {
	PlatformSetupGuidance
	Host      string                `json:"host,omitempty"`
	OrgID     string                `json:"org_id,omitempty"`
	OrgName   string                `json:"org_name,omitempty"`
	Projects  []PlatformProjectInfo `json:"projects"`
	Items     []map[string]any      `json:"items,omitempty"`
	Count     int                   `json:"count"`
	Scope     *PlatformOutputScope  `json:"scope,omitempty"`
	Fields    []string              `json:"fields,omitempty"`
	Warnings  []string              `json:"warnings,omitempty"`
	Error     string                `json:"error,omitempty"`
	RequestID string                `json:"request_id,omitempty"`
}

PlatformProjectsOutput lists projects visible in one hosted organization.

func HandlePlatformProjects

HandlePlatformProjects lists hosted projects in one organization.

func (PlatformProjectsOutput) MarshalJSON

func (o PlatformProjectsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformPromoteFileToDatasetInput

type PlatformPromoteFileToDatasetInput struct {
	FileID      string                       `json:"file_id" jsonschema:"Hosted project file id"`
	Name        string                       `json:"name" jsonschema:"Dataset name"`
	Description string                       `json:"description,omitempty" jsonschema:"Optional dataset description"`
	SheetIndex  *int                         `json:"sheet_index,omitempty" jsonschema:"Optional tabular sheet index"`
	ColumnMap   []PlatformFileColumnMapInput `json:"column_map" jsonschema:"Column mappings, usually from whodb_platform_file_inspect"`
}

PlatformPromoteFileToDatasetInput is the input for whodb_platform_promote_file_to_dataset.

type PlatformProviderModelsInput

type PlatformProviderModelsInput struct {
	ProviderID string   `json:"provider_id" jsonschema:"Hosted AI provider id"`
	Fields     []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformProviderModelsInput is the input for the whodb_platform_ai_provider_models tool.

type PlatformReadOutput

type PlatformReadOutput struct {
	PlatformSetupGuidance
	Data           any                     `json:"data,omitempty"`
	Items          []map[string]any        `json:"items,omitempty"`
	Count          int                     `json:"count"`
	Scope          *PlatformOutputScope    `json:"scope,omitempty"`
	Fields         []string                `json:"fields,omitempty"`
	Warnings       []string                `json:"warnings,omitempty"`
	Truncated      bool                    `json:"truncated"`
	Error          string                  `json:"error,omitempty"`
	ErrorCode      string                  `json:"error_code,omitempty"`
	Retryable      bool                    `json:"retryable,omitempty"`
	SuggestedTools []string                `json:"suggested_tools,omitempty"`
	Recovery       *PlatformRecoveryAdvice `json:"recovery,omitempty"`
	RequestID      string                  `json:"request_id,omitempty"`
}

PlatformReadOutput is the common output for read-only hosted platform tools.

func HandlePlatformAIProviderModels

func HandlePlatformAIProviderModels(ctx context.Context, req *mcp.CallToolRequest, input PlatformProviderModelsInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformAIProviderModels lists model names for one hosted AI provider.

func HandlePlatformAIProviders

func HandlePlatformAIProviders(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformAIProviders lists hosted AI provider metadata.

func HandlePlatformBuildPlan

HandlePlatformBuildPlan returns an end-to-end platform plan for a user goal.

func HandlePlatformChangeImpact

func HandlePlatformChangeImpact(ctx context.Context, req *mcp.CallToolRequest, input PlatformChangeImpactInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformChangeImpact returns direct graph impact for a planned resource change.

func HandlePlatformDataModelSummary

func HandlePlatformDataModelSummary(ctx context.Context, req *mcp.CallToolRequest, input PlatformResourceGraphInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformDataModelSummary returns an agent-focused data model summary.

func HandlePlatformDataset

HandlePlatformDataset returns one hosted dataset.

func HandlePlatformDatasetRows

func HandlePlatformDatasetRows(ctx context.Context, req *mcp.CallToolRequest, input PlatformRowsInput, secOpts *SecurityOptions) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformDatasetRows previews rows for one hosted dataset.

func HandlePlatformDatasets

func HandlePlatformDatasets(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformDatasets lists hosted datasets.

func HandlePlatformFileInspect

func HandlePlatformFileInspect(ctx context.Context, req *mcp.CallToolRequest, input PlatformFileInspectInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformFileInspect inspects one hosted tabular file for dataset promotion.

func HandlePlatformFilePreview

func HandlePlatformFilePreview(ctx context.Context, req *mcp.CallToolRequest, input PlatformFilePreviewInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformFilePreview previews one hosted project file.

func HandlePlatformFileSearch

HandlePlatformFileSearch searches hosted project files.

func HandlePlatformFiles

HandlePlatformFiles lists hosted files in one project folder.

func HandlePlatformFunction

func HandlePlatformFunction(ctx context.Context, req *mcp.CallToolRequest, input PlatformEntityInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformFunction returns one hosted ontology function.

func HandlePlatformFunctions

func HandlePlatformFunctions(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformFunctions lists hosted ontology functions.

func HandlePlatformGapAnalysis

func HandlePlatformGapAnalysis(ctx context.Context, req *mcp.CallToolRequest, input PlatformGapAnalysisInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformGapAnalysis returns a goal-aware workspace gap analysis.

func HandlePlatformLineage

HandlePlatformLineage returns lineage around one root node.

func HandlePlatformLineageNeighbors

func HandlePlatformLineageNeighbors(ctx context.Context, req *mcp.CallToolRequest, input PlatformLineageNeighborsInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformLineageNeighbors returns immediate lineage neighbors for one node.

func HandlePlatformNextActions

func HandlePlatformNextActions(ctx context.Context, req *mcp.CallToolRequest, input PlatformNextActionsInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformNextActions returns deterministic next steps for the selected project.

func HandlePlatformOntologies

func HandlePlatformOntologies(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformOntologies lists hosted ontology object types.

func HandlePlatformOntology

func HandlePlatformOntology(ctx context.Context, req *mcp.CallToolRequest, input PlatformEntityInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformOntology returns one hosted ontology object type.

func HandlePlatformOntologyFastLookupSuggestions

func HandlePlatformOntologyFastLookupSuggestions(ctx context.Context, req *mcp.CallToolRequest, input PlatformEntityInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformOntologyFastLookupSuggestions lists suggested fast lookups for one ontology.

func HandlePlatformOntologyFastLookups

func HandlePlatformOntologyFastLookups(ctx context.Context, req *mcp.CallToolRequest, input PlatformEntityInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformOntologyFastLookups lists fast lookups for one ontology.

func HandlePlatformOntologyFollowLink(ctx context.Context, req *mcp.CallToolRequest, input PlatformOntologyFollowLinkInput, secOpts *SecurityOptions) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformOntologyFollowLink follows one ontology link from a row primary key.

func HandlePlatformOntologyRows

func HandlePlatformOntologyRows(ctx context.Context, req *mcp.CallToolRequest, input PlatformRowsInput, secOpts *SecurityOptions) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformOntologyRows previews rows for one ontology.

func HandlePlatformProjectHealth

func HandlePlatformProjectHealth(ctx context.Context, req *mcp.CallToolRequest, input PlatformNextActionsInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformProjectHealth returns an agent-focused project health summary.

func HandlePlatformProjectLineage

func HandlePlatformProjectLineage(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformProjectLineage returns hosted project lineage.

func HandlePlatformResourceGraph

func HandlePlatformResourceGraph(ctx context.Context, req *mcp.CallToolRequest, input PlatformResourceGraphInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformResourceGraph returns a normalized selected-project resource graph.

func HandlePlatformRuntimeReadiness

func HandlePlatformRuntimeReadiness(ctx context.Context, req *mcp.CallToolRequest, input PlatformNextActionsInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformRuntimeReadiness returns an agent-focused runtime readiness summary.

func HandlePlatformSecrets

func HandlePlatformSecrets(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformSecrets lists secret metadata and usage without values.

func HandlePlatformSourceConstraints

func HandlePlatformSourceConstraints(ctx context.Context, req *mcp.CallToolRequest, input PlatformSourceConstraintsInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformSourceConstraints returns field constraints for one hosted source object.

func HandlePlatformSourceContent

func HandlePlatformSourceContent(ctx context.Context, req *mcp.CallToolRequest, input PlatformSourceContentInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformSourceContent returns content for one hosted source object.

func HandlePlatformStorageUsage

func HandlePlatformStorageUsage(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformStorageUsage returns hosted project storage usage in bytes.

func HandlePlatformTabularFiles

func HandlePlatformTabularFiles(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformTabularFiles lists hosted tabular project files.

func HandlePlatformTransform

func HandlePlatformTransform(ctx context.Context, req *mcp.CallToolRequest, input PlatformEntityInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformTransform returns one hosted transform.

func HandlePlatformTransformRuns

func HandlePlatformTransformRuns(ctx context.Context, req *mcp.CallToolRequest, input PlatformTransformRunsInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformTransformRuns lists runs for one hosted transform.

func HandlePlatformTransformWait

func HandlePlatformTransformWait(ctx context.Context, req *mcp.CallToolRequest, input PlatformTransformWaitInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformTransformWait polls the real hosted transform-run history and returns a terminal run.

func HandlePlatformTransforms

func HandlePlatformTransforms(ctx context.Context, req *mcp.CallToolRequest, input PlatformEmptyInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformTransforms lists hosted transforms.

func HandlePlatformWorkspaceMap

func HandlePlatformWorkspaceMap(ctx context.Context, req *mcp.CallToolRequest, input PlatformWorkspaceMapInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformWorkspaceMap returns a compact selected-project workspace map.

func HandlePlatformWorkspaceSummary

func HandlePlatformWorkspaceSummary(ctx context.Context, req *mcp.CallToolRequest, input PlatformWorkspaceSummaryInput) (*mcp.CallToolResult, PlatformReadOutput, error)

HandlePlatformWorkspaceSummary returns a compact workspace-wide summary for agents.

func HandlePlatformWritePlan

HandlePlatformWritePlan validates and summarizes a hosted write without executing it.

type PlatformRecipeStep

type PlatformRecipeStep struct {
	Order       int      `json:"order"`
	Name        string   `json:"name"`
	Objective   string   `json:"objective"`
	ReadTools   []string `json:"read_tools,omitempty"`
	WriteTools  []string `json:"write_tools,omitempty"`
	VerifyTools []string `json:"verify_tools,omitempty"`
	Notes       []string `json:"notes,omitempty"`
}

PlatformRecipeStep is one phase in a goal-oriented workflow recipe.

type PlatformRecoveryAdvice

type PlatformRecoveryAdvice struct {
	LikelyCause string
	NextSteps   []string
}

PlatformRecoveryAdvice is deterministic guidance an agent can follow after a failed call.

type PlatformResolveResourceInput

type PlatformResolveResourceInput struct {
	Resource string `json:"resource" jsonschema:"Resource type such as source, dataset, ontology, transform, function, secret, or ai_provider"`
	Query    string `json:"query" jsonschema:"Resource id, exact name, or name fragment"`
}

PlatformResolveResourceInput resolves a human resource reference in the selected project.

type PlatformResolveResourceOutput

type PlatformResolveResourceOutput struct {
	PlatformSetupGuidance
	Resource       string                     `json:"resource,omitempty"`
	Query          string                     `json:"query,omitempty"`
	Resolved       *PlatformResolvedResource  `json:"resolved,omitempty"`
	Candidates     []PlatformResolvedResource `json:"candidates,omitempty"`
	Ambiguous      bool                       `json:"ambiguous,omitempty"`
	Error          string                     `json:"error,omitempty"`
	ErrorCode      string                     `json:"error_code,omitempty"`
	Retryable      bool                       `json:"retryable,omitempty"`
	SuggestedTools []string                   `json:"suggested_tools,omitempty"`
	RequestID      string                     `json:"request_id,omitempty"`
}

PlatformResolveResourceOutput describes a deterministic or ambiguous resolution.

func HandlePlatformResolveResource

HandlePlatformResolveResource resolves resource names without executing a write.

type PlatformResolvedResource

type PlatformResolvedResource struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Type  string `json:"type"`
	Match string `json:"match"`
}

PlatformResolvedResource is one candidate returned by resource resolution.

type PlatformResourceGraph

type PlatformResourceGraph struct {
	Nodes    []PlatformResourceGraphNode `json:"nodes"`
	Edges    []PlatformResourceGraphEdge `json:"edges"`
	Counts   map[string]int              `json:"counts"`
	Warnings []string                    `json:"warnings"`
}

PlatformResourceGraph is a normalized relationship graph for hosted platform resources.

type PlatformResourceGraphEdge

type PlatformResourceGraphEdge struct {
	FromID   string `json:"from_id"`
	FromType string `json:"from_type"`
	ToID     string `json:"to_id"`
	ToType   string `json:"to_type"`
	Kind     string `json:"kind"`
}

PlatformResourceGraphEdge is one relationship in the hosted platform resource graph.

type PlatformResourceGraphInput

type PlatformResourceGraphInput struct {
	OmitFiles   bool     `json:"omit_files,omitempty" jsonschema:"Omit root folder file and folder nodes. Defaults to false."`
	OmitLineage bool     `json:"omit_lineage,omitempty" jsonschema:"Omit hosted lineage edges. Defaults to false."`
	Fields      []string `json:"fields,omitempty" jsonschema:"Top-level output fields to include, for example nodes, edges, warnings."`
}

PlatformResourceGraphInput is the input for the whodb_platform_resource_graph tool.

type PlatformResourceGraphNode

type PlatformResourceGraphNode struct {
	ID       string            `json:"id"`
	Type     string            `json:"type"`
	Name     string            `json:"name,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

PlatformResourceGraphNode is one node in the hosted platform resource graph.

type PlatformRestoreInput

type PlatformRestoreInput struct {
	Resource string `json:"resource" jsonschema:"Soft-deletable resource: source, ontology, dataset, transform, function, app, folder, or file"`
	ID       string `json:"id" jsonschema:"Deleted resource id"`
}

PlatformRestoreInput restores a soft-deleted hosted platform resource.

type PlatformRowsInput

type PlatformRowsInput struct {
	ID     string   `json:"id" jsonschema:"Resource id"`
	Limit  int      `json:"limit,omitempty" jsonschema:"Maximum rows to return"`
	Offset int      `json:"offset,omitempty" jsonschema:"Row offset"`
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformRowsInput is a selected-project row-preview input.

type PlatformRuntimeReadiness

type PlatformRuntimeReadiness struct {
	AIProviders []PlatformWorkspaceItem `json:"ai_providers"`
	Secrets     []PlatformWorkspaceItem `json:"secrets"`
	Functions   []PlatformWorkspaceItem `json:"functions"`
	Transforms  []PlatformWorkspaceItem `json:"transforms"`
	Checks      []PlatformWorkflowCheck `json:"checks"`
	Warnings    []string                `json:"warnings"`
}

PlatformRuntimeReadiness summarizes executable/runtime readiness.

type PlatformSetupGuidance

type PlatformSetupGuidance struct {
	SetupStatus string   `json:"setup_status,omitempty"`
	Commands    []string `json:"commands,omitempty"`
	NextSteps   []string `json:"next_steps,omitempty"`
}

PlatformSetupGuidance gives agents recovery instructions for setup-related failures.

type PlatformSetupStatusInput

type PlatformSetupStatusInput struct{}

PlatformSetupStatusInput is the input for whodb_platform_setup_status.

type PlatformSetupStatusOutput

type PlatformSetupStatusOutput struct {
	Host              string   `json:"host"`
	Status            string   `json:"status"`
	Authenticated     bool     `json:"authenticated"`
	WorkspaceSelected bool     `json:"workspace_selected"`
	Email             string   `json:"email,omitempty"`
	AccountID         string   `json:"account_id,omitempty"`
	OrgID             string   `json:"org_id,omitempty"`
	OrgName           string   `json:"org_name,omitempty"`
	ProjectID         string   `json:"project_id,omitempty"`
	ProjectName       string   `json:"project_name,omitempty"`
	Commands          []string `json:"commands"`
	NextSteps         []string `json:"next_steps"`
	Error             string   `json:"error,omitempty"`
	RequestID         string   `json:"request_id,omitempty"`
}

PlatformSetupStatusOutput reports local hosted platform MCP setup state.

func HandlePlatformSetupStatus

HandlePlatformSetupStatus reports local hosted platform setup without requiring a valid session.

type PlatformSourceColumnsInput

type PlatformSourceColumnsInput struct {
	Source string   `json:"source" jsonschema:"Hosted source id or name"`
	Ref    string   `json:"ref" jsonschema:"Object ref as kind:path, for example table:public.users"`
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include in items"`
}

PlatformSourceColumnsInput is the input for the whodb_platform_source_columns tool.

type PlatformSourceColumnsOutput

type PlatformSourceColumnsOutput struct {
	PlatformSetupGuidance
	Columns   []platformapi.Column `json:"columns"`
	Items     []map[string]any     `json:"items,omitempty"`
	Count     int                  `json:"count"`
	Scope     *PlatformOutputScope `json:"scope,omitempty"`
	Fields    []string             `json:"fields,omitempty"`
	Warnings  []string             `json:"warnings,omitempty"`
	Error     string               `json:"error,omitempty"`
	RequestID string               `json:"request_id,omitempty"`
}

PlatformSourceColumnsOutput lists columns for one hosted source object.

func HandlePlatformSourceColumns

HandlePlatformSourceColumns returns columns for one hosted source object.

func (PlatformSourceColumnsOutput) MarshalJSON

func (o PlatformSourceColumnsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformSourceConfigInput

type PlatformSourceConfigInput struct {
	Source string `json:"source" jsonschema:"Hosted source id or name"`
}

PlatformSourceConfigInput is the input for the whodb_platform_source_config tool.

type PlatformSourceConfigOutput

type PlatformSourceConfigOutput struct {
	PlatformSetupGuidance
	Source    *platformapi.Source              `json:"source,omitempty"`
	Config    platformapi.RedactedSourceConfig `json:"config"`
	Error     string                           `json:"error,omitempty"`
	RequestID string                           `json:"request_id,omitempty"`
}

PlatformSourceConfigOutput returns redacted hosted source connection config.

func HandlePlatformSourceConfig

HandlePlatformSourceConfig returns redacted config for one hosted source.

type PlatformSourceConstraintsInput

type PlatformSourceConstraintsInput struct {
	Source string   `json:"source" jsonschema:"Hosted source id or name"`
	Ref    string   `json:"ref" jsonschema:"Object ref as kind:path, for example table:public.users"`
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformSourceConstraintsInput is the input for the whodb_platform_source_constraints tool.

type PlatformSourceContentInput

type PlatformSourceContentInput struct {
	Source string   `json:"source" jsonschema:"Hosted source id or name"`
	Ref    string   `json:"ref" jsonschema:"Object ref as kind:path, for example file:notes/report.txt"`
	Fields []string `` /* 142-byte string literal not displayed */
}

PlatformSourceContentInput is the input for the whodb_platform_source_content tool.

type PlatformSourceCreateInput

type PlatformSourceCreateInput struct {
	SourceType string            `json:"source_type" jsonschema:"Hosted source type id"`
	Name       string            `json:"name" jsonschema:"Source display name"`
	Hostname   string            `json:"hostname,omitempty"`
	Port       string            `json:"port,omitempty"`
	Username   string            `json:"username,omitempty"`
	Password   string            `json:"password,omitempty"`
	Database   string            `json:"database,omitempty"`
	Advanced   map[string]string `json:"advanced,omitempty"`
}

PlatformSourceCreateInput is the input for the whodb_platform_source_create tool.

type PlatformSourceDeleteInput

type PlatformSourceDeleteInput struct {
	Source string `json:"source" jsonschema:"Hosted source id or name"`
}

PlatformSourceDeleteInput is the input for the whodb_platform_source_delete tool.

type PlatformSourceFieldsInput

type PlatformSourceFieldsInput struct {
	SourceType string   `json:"source_type" jsonschema:"Hosted source type id"`
	Fields     []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include in items"`
}

PlatformSourceFieldsInput is the input for the whodb_platform_source_fields tool.

type PlatformSourceFieldsOutput

type PlatformSourceFieldsOutput struct {
	PlatformSetupGuidance
	SourceType     string                              `json:"source_type,omitempty"`
	Fields         []platformapi.SourceConnectionField `json:"fields"`
	Items          []map[string]any                    `json:"items,omitempty"`
	Count          int                                 `json:"count"`
	Scope          *PlatformOutputScope                `json:"scope,omitempty"`
	SelectedFields []string                            `json:"selected_fields,omitempty"`
	Warnings       []string                            `json:"warnings,omitempty"`
	Error          string                              `json:"error,omitempty"`
	RequestID      string                              `json:"request_id,omitempty"`
}

PlatformSourceFieldsOutput lists connection fields for one hosted source type.

func HandlePlatformSourceFields

HandlePlatformSourceFields lists connection fields for one hosted source type.

func (PlatformSourceFieldsOutput) MarshalJSON

func (o PlatformSourceFieldsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformSourceObjectsInput

type PlatformSourceObjectsInput struct {
	Source     string   `json:"source" jsonschema:"Hosted source id or name"`
	Parent     string   `json:"parent,omitempty" jsonschema:"Parent object ref as kind:path, for example schema:public"`
	Kinds      []string `json:"kinds,omitempty" jsonschema:"Object kinds to include, for example Table or View"`
	PageSize   int      `json:"page_size,omitempty" jsonschema:"Maximum objects to return"`
	PageOffset int      `json:"page_offset,omitempty" jsonschema:"Object offset"`
	Fields     []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include in items"`
}

PlatformSourceObjectsInput is the input for the whodb_platform_source_objects tool.

type PlatformSourceObjectsOutput

type PlatformSourceObjectsOutput struct {
	PlatformSetupGuidance
	Objects   []platformapi.SourceObject `json:"objects"`
	Items     []map[string]any           `json:"items,omitempty"`
	Count     int                        `json:"count"`
	Scope     *PlatformOutputScope       `json:"scope,omitempty"`
	Fields    []string                   `json:"fields,omitempty"`
	Warnings  []string                   `json:"warnings,omitempty"`
	Error     string                     `json:"error,omitempty"`
	RequestID string                     `json:"request_id,omitempty"`
}

PlatformSourceObjectsOutput lists hosted source objects.

func HandlePlatformSourceObjects

HandlePlatformSourceObjects lists objects in one hosted source.

func (PlatformSourceObjectsOutput) MarshalJSON

func (o PlatformSourceObjectsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformSourceRowsInput

type PlatformSourceRowsInput struct {
	Source string `json:"source" jsonschema:"Hosted source id or name"`
	Ref    string `json:"ref" jsonschema:"Object ref as kind:path, for example table:public.users"`
	Limit  int    `json:"limit,omitempty" jsonschema:"Maximum rows to return"`
	Offset int    `json:"offset,omitempty" jsonschema:"Row offset"`
}

PlatformSourceRowsInput is the input for the whodb_platform_source_rows tool.

type PlatformSourceRowsOutput

type PlatformSourceRowsOutput struct {
	PlatformSetupGuidance
	Columns   []platformapi.Column `json:"columns"`
	Rows      [][]string           `json:"rows"`
	Total     int                  `json:"total"`
	Truncated bool                 `json:"truncated"`
	Error     string               `json:"error,omitempty"`
	RequestID string               `json:"request_id,omitempty"`
}

PlatformSourceRowsOutput previews rows for one hosted source object.

func HandlePlatformSourceRows

HandlePlatformSourceRows previews rows for one hosted source object.

func (PlatformSourceRowsOutput) MarshalJSON

func (o PlatformSourceRowsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformSourceTestInput

type PlatformSourceTestInput struct {
	Source     string            `` /* 131-byte string literal not displayed */
	SourceType string            `json:"source_type,omitempty" jsonschema:"Hosted source type id for draft connection tests"`
	Hostname   string            `json:"hostname,omitempty"`
	Port       string            `json:"port,omitempty"`
	Username   string            `json:"username,omitempty"`
	Password   string            `json:"password,omitempty"`
	Database   string            `json:"database,omitempty"`
	Advanced   map[string]string `json:"advanced,omitempty"`
}

PlatformSourceTestInput is the input for the whodb_platform_source_test tool.

type PlatformSourceTestOutput

type PlatformSourceTestOutput struct {
	PlatformSetupGuidance
	Status     string              `json:"status,omitempty"`
	Source     *platformapi.Source `json:"source,omitempty"`
	SourceType string              `json:"source_type,omitempty"`
	Error      string              `json:"error,omitempty"`
	RequestID  string              `json:"request_id,omitempty"`
}

PlatformSourceTestOutput reports hosted source connection test status.

func HandlePlatformSourceTest

HandlePlatformSourceTest checks a saved or draft hosted source connection.

type PlatformSourceTypesInput

type PlatformSourceTypesInput struct {
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include in items"`
}

PlatformSourceTypesInput is the input for the whodb_platform_source_types tool.

type PlatformSourceTypesOutput

type PlatformSourceTypesOutput struct {
	PlatformSetupGuidance
	SourceTypes []platformapi.SourceType `json:"source_types"`
	Items       []map[string]any         `json:"items,omitempty"`
	Count       int                      `json:"count"`
	Scope       *PlatformOutputScope     `json:"scope,omitempty"`
	Fields      []string                 `json:"fields,omitempty"`
	Warnings    []string                 `json:"warnings,omitempty"`
	Error       string                   `json:"error,omitempty"`
	RequestID   string                   `json:"request_id,omitempty"`
}

PlatformSourceTypesOutput lists hosted source types available for creation.

func HandlePlatformSourceTypes

HandlePlatformSourceTypes lists hosted source types available for creation.

func (PlatformSourceTypesOutput) MarshalJSON

func (o PlatformSourceTypesOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformSourceUpdateInput

type PlatformSourceUpdateInput struct {
	Source   string            `json:"source" jsonschema:"Hosted source id or name"`
	Name     string            `json:"name,omitempty" jsonschema:"New source display name"`
	Hostname string            `json:"hostname,omitempty"`
	Port     string            `json:"port,omitempty"`
	Username string            `json:"username,omitempty"`
	Password string            `json:"password,omitempty"`
	Database string            `json:"database,omitempty"`
	Advanced map[string]string `json:"advanced,omitempty"`
}

PlatformSourceUpdateInput is the input for the whodb_platform_source_update tool.

type PlatformSourceWriteOutput

type PlatformSourceWriteOutput struct {
	PlatformSetupGuidance
	ConfirmationRequired bool                   `json:"confirmation_required,omitempty"`
	ConfirmationToken    string                 `json:"confirmation_token,omitempty"`
	ConfirmationAction   string                 `json:"confirmation_action,omitempty"`
	ConfirmationPreview  *PlatformActionPreview `json:"confirmation_preview,omitempty"`
	ConfirmationExpiry   string                 `json:"confirmation_expiry,omitempty"`
	Warning              string                 `json:"warning,omitempty"`
	Source               *platformapi.Source    `json:"source,omitempty"`
	Status               string                 `json:"status,omitempty"`
	Error                string                 `json:"error,omitempty"`
	RequestID            string                 `json:"request_id,omitempty"`
}

PlatformSourceWriteOutput reports a hosted platform write prepared for confirmation.

func HandlePlatformSourceCreate

HandlePlatformSourceCreate prepares a hosted source creation for confirmation.

func HandlePlatformSourceDelete

HandlePlatformSourceDelete prepares a hosted source deletion for confirmation.

func HandlePlatformSourceUpdate

HandlePlatformSourceUpdate prepares a hosted source update for confirmation.

type PlatformSourcesInput

type PlatformSourcesInput struct {
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include in items"`
}

PlatformSourcesInput is the input for the whodb_platform_sources tool.

type PlatformSourcesOutput

type PlatformSourcesOutput struct {
	PlatformSetupGuidance
	Host      string               `json:"host,omitempty"`
	OrgID     string               `json:"org_id,omitempty"`
	ProjectID string               `json:"project_id,omitempty"`
	Sources   []platformapi.Source `json:"sources"`
	Items     []map[string]any     `json:"items,omitempty"`
	Count     int                  `json:"count"`
	Scope     *PlatformOutputScope `json:"scope,omitempty"`
	Fields    []string             `json:"fields,omitempty"`
	Warnings  []string             `json:"warnings,omitempty"`
	Error     string               `json:"error,omitempty"`
	RequestID string               `json:"request_id,omitempty"`
}

PlatformSourcesOutput lists hosted sources in the selected project.

func HandlePlatformSources

HandlePlatformSources lists hosted sources in the selected workspace.

func (PlatformSourcesOutput) MarshalJSON

func (o PlatformSourcesOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type PlatformStatusInput

type PlatformStatusInput struct{}

PlatformStatusInput is the input for the whodb_platform_status tool.

type PlatformStatusOutput

type PlatformStatusOutput struct {
	PlatformSetupGuidance
	Host                    string   `json:"host,omitempty"`
	UserID                  string   `json:"user_id,omitempty"`
	Email                   string   `json:"email,omitempty"`
	DefaultOrgID            string   `json:"default_org_id,omitempty"`
	DefaultOrgName          string   `json:"default_org_name,omitempty"`
	DefaultProjectID        string   `json:"default_project_id,omitempty"`
	DefaultProjectName      string   `json:"default_project_name,omitempty"`
	WorkspaceSelected       bool     `json:"workspace_selected"`
	PlatformVersion         string   `json:"platform_version,omitempty"`
	ManifestProtocolVersion string   `json:"manifest_protocol_version,omitempty"`
	AutoSelected            []string `json:"auto_selected,omitempty"`
	Error                   string   `json:"error,omitempty"`
	RequestID               string   `json:"request_id,omitempty"`
}

PlatformStatusOutput reports hosted WhoDB login and selected workspace state.

func HandlePlatformStatus

HandlePlatformStatus reports hosted WhoDB login and workspace state.

type PlatformTransformRunsInput

type PlatformTransformRunsInput struct {
	TransformID string   `json:"transform_id" jsonschema:"Transform id"`
	Limit       int      `json:"limit,omitempty" jsonschema:"Maximum runs to return"`
	Fields      []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformTransformRunsInput is the input for the whodb_platform_transform_runs tool.

type PlatformTransformWaitInput

type PlatformTransformWaitInput struct {
	TransformID string   `json:"transform_id" jsonschema:"Hosted transform id"`
	RunID       string   `json:"run_id" jsonschema:"Transform run id returned by the run action or transform_runs tool"`
	TimeoutSecs int      `json:"timeout_seconds,omitempty" jsonschema:"Maximum wait time, default 60 seconds"`
	PollSecs    int      `json:"poll_seconds,omitempty" jsonschema:"Polling interval, default 2 seconds"`
	Fields      []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformTransformWaitInput waits for one hosted transform run to finish.

type PlatformVersionInput

type PlatformVersionInput struct {
	ID         string   `json:"id" jsonschema:"Object id"`
	ObjectType string   `json:"object_type" jsonschema:"Versionable object type: app, function, transform, dataset, or ontology"`
	Fields     []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields"`
}

PlatformVersionInput selects an object version history.

type PlatformWorkflowApplyInput

type PlatformWorkflowApplyInput struct {
	PlanID string `json:"plan_id" jsonschema:"Workflow plan id returned by whodb_platform_workflow_plan"`
}

PlatformWorkflowApplyInput applies or resumes a persisted workflow plan.

type PlatformWorkflowCheck

type PlatformWorkflowCheck struct {
	Name     string `json:"name"`
	Status   string `json:"status"`
	Reason   string `json:"reason,omitempty"`
	ToolHint string `json:"tool_hint,omitempty"`
}

PlatformWorkflowCheck describes one workspace workflow readiness check.

type PlatformWorkflowGap

type PlatformWorkflowGap struct {
	Area           string   `json:"area"`
	Severity       string   `json:"severity"`
	Missing        string   `json:"missing"`
	Reason         string   `json:"reason"`
	SuggestedTools []string `json:"suggested_tools"`
}

PlatformWorkflowGap describes one missing or weak platform capability.

type PlatformWorkflowGetInput

type PlatformWorkflowGetInput struct {
	PlanID string `json:"plan_id" jsonschema:"Workflow plan id"`
}

PlatformWorkflowGetInput identifies one persisted workflow plan.

type PlatformWorkflowListInput

type PlatformWorkflowListInput struct{}

PlatformWorkflowListInput lists persisted workflow plans for the current host and workspace.

type PlatformWorkflowOutput

type PlatformWorkflowOutput struct {
	PlatformSetupGuidance
	ConfirmationRequired bool                    `json:"confirmation_required,omitempty"`
	ConfirmationToken    string                  `json:"confirmation_token,omitempty"`
	ConfirmationExpiry   string                  `json:"confirmation_expiry,omitempty"`
	Plan                 map[string]any          `json:"plan,omitempty"`
	Plans                []map[string]any        `json:"plans,omitempty"`
	Status               string                  `json:"status,omitempty"`
	Message              string                  `json:"message,omitempty"`
	Error                string                  `json:"error,omitempty"`
	ErrorCode            string                  `json:"error_code,omitempty"`
	Retryable            bool                    `json:"retryable,omitempty"`
	SuggestedTools       []string                `json:"suggested_tools,omitempty"`
	Recovery             *PlatformRecoveryAdvice `json:"recovery,omitempty"`
	RequestID            string                  `json:"request_id,omitempty"`
}

PlatformWorkflowOutput is the compact, non-secret workflow response.

type PlatformWorkflowPlanInput

type PlatformWorkflowPlanInput struct {
	Goal  string                      `json:"goal" jsonschema:"Desired end state for this hosted platform workflow"`
	Steps []PlatformWorkflowStepInput `json:"steps" jsonschema:"Ordered hosted platform writes to validate and execute"`
}

PlatformWorkflowPlanInput creates a persisted plan without executing it.

type PlatformWorkflowRecipeInput

type PlatformWorkflowRecipeInput struct {
	Goal   string   `json:"goal" jsonschema:"Desired end-to-end platform outcome, for example set up ETL or create an ontology"`
	Fields []string `json:"fields,omitempty" jsonschema:"Optional top-level output fields to include"`
}

PlatformWorkflowRecipeInput requests a goal-oriented platform workflow recipe.

type PlatformWorkflowRecipeOutput

type PlatformWorkflowRecipeOutput struct {
	Goal        string               `json:"goal"`
	Recipe      string               `json:"recipe"`
	Description string               `json:"description"`
	Steps       []PlatformRecipeStep `json:"steps"`
	ReadFirst   []string             `json:"read_first"`
	VerifyWith  []string             `json:"verify_with"`
	Warnings    []string             `json:"warnings,omitempty"`
}

PlatformWorkflowRecipeOutput describes a safe, ordered workflow without executing writes.

func HandlePlatformWorkflowRecipe

HandlePlatformWorkflowRecipe returns a deterministic recipe without contacting the hosted platform.

type PlatformWorkflowStepInput

type PlatformWorkflowStepInput struct {
	ID        string         `json:"id" jsonschema:"Stable step id used for dependencies and retries."`
	Operation string         `json:"operation" jsonschema:"create, update, delete, or action"`
	Resource  string         `json:"resource" jsonschema:"Platform resource such as dataset, transform, function, or app"`
	Action    string         `json:"action,omitempty" jsonschema:"Action name when operation is action"`
	TargetID  string         `json:"target_id,omitempty" jsonschema:"Existing resource id for update, delete, or action"`
	Payload   map[string]any `json:"payload,omitempty" jsonschema:"Structured non-secret mutation payload"`
	DependsOn []string       `json:"depends_on,omitempty" jsonschema:"Step ids that must complete first"`
}

PlatformWorkflowStepInput describes one validated generic platform write in a workflow.

type PlatformWorkspaceItem

type PlatformWorkspaceItem struct {
	ID       string            `json:"id,omitempty"`
	Type     string            `json:"type"`
	Name     string            `json:"name,omitempty"`
	Status   string            `json:"status,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

PlatformWorkspaceItem is a compact platform resource summary for agents.

type PlatformWorkspaceMap

type PlatformWorkspaceMap struct {
	Host        string                  `json:"host,omitempty"`
	OrgID       string                  `json:"org_id,omitempty"`
	OrgName     string                  `json:"org_name,omitempty"`
	ProjectID   string                  `json:"project_id,omitempty"`
	ProjectName string                  `json:"project_name,omitempty"`
	Counts      map[string]int          `json:"counts"`
	Sources     []PlatformWorkspaceItem `json:"sources"`
	Secrets     []PlatformWorkspaceItem `json:"secrets"`
	AIProviders []PlatformWorkspaceItem `json:"ai_providers"`
	Datasets    []PlatformWorkspaceItem `json:"datasets"`
	Ontologies  []PlatformWorkspaceItem `json:"ontologies"`
	Transforms  []PlatformWorkspaceItem `json:"transforms"`
	Functions   []PlatformWorkspaceItem `json:"functions"`
	Files       []PlatformWorkspaceItem `json:"files,omitempty"`
	Folders     []PlatformWorkspaceItem `json:"folders,omitempty"`
	StorageUsed int                     `json:"storage_used"`
	Lineage     *PlatformLineageSummary `json:"lineage,omitempty"`
	Warnings    []string                `json:"warnings"`
}

PlatformWorkspaceMap is a project-level map of hosted platform resources.

type PlatformWorkspaceMapInput

type PlatformWorkspaceMapInput struct {
	OmitFiles   bool     `json:"omit_files,omitempty" jsonschema:"Omit root folder file and folder summaries. Defaults to false."`
	OmitLineage bool     `json:"omit_lineage,omitempty" jsonschema:"Omit project lineage summary. Defaults to false."`
	Fields      []string `json:"fields,omitempty" jsonschema:"Top-level output fields to include, for example counts, sources, datasets, warnings."`
}

PlatformWorkspaceMapInput is the input for the whodb_platform_workspace_map tool.

type PlatformWorkspaceSummary

type PlatformWorkspaceSummary struct {
	Goal             string                  `json:"goal,omitempty"`
	Scope            *PlatformOutputScope    `json:"scope,omitempty"`
	Counts           map[string]int          `json:"counts"`
	Highlights       []string                `json:"highlights"`
	Gaps             []PlatformWorkflowGap   `json:"gaps"`
	NextActions      []PlatformNextAction    `json:"next_actions"`
	RecommendedTools []string                `json:"recommended_tools"`
	Lineage          *PlatformLineageSummary `json:"lineage,omitempty"`
	Warnings         []string                `json:"warnings"`
}

PlatformWorkspaceSummary is a compact, goal-aware workspace overview for agents.

type PlatformWorkspaceSummaryInput

type PlatformWorkspaceSummaryInput struct {
	Goal        string   `json:"goal,omitempty" jsonschema:"Optional user goal used to tailor highlights and recommended next tools."`
	OmitFiles   bool     `json:"omit_files,omitempty" jsonschema:"Omit root folder file and folder summaries. Defaults to false."`
	OmitLineage bool     `json:"omit_lineage,omitempty" jsonschema:"Omit project lineage summary. Defaults to false."`
	Fields      []string `` /* 131-byte string literal not displayed */
}

PlatformWorkspaceSummaryInput is the input for the whodb_platform_workspace_summary tool.

type PlatformWritePlan

type PlatformWritePlan struct {
	Operation            string                      `json:"operation"`
	Resource             string                      `json:"resource"`
	Action               string                      `json:"action,omitempty"`
	Mutation             string                      `json:"mutation"`
	ConfirmationRequired bool                        `json:"confirmation_required"`
	Preview              *PlatformActionPreview      `json:"preview,omitempty"`
	PayloadKeys          []string                    `json:"payload_keys,omitempty"`
	SuggestedReads       []string                    `json:"suggested_reads"`
	Affected             []PlatformResourceGraphNode `json:"affected,omitempty"`
	Warnings             []string                    `json:"warnings"`
	Preflight            []PlatformWritePreflight    `json:"preflight"`
}

PlatformWritePlan validates and summarizes a hosted write without executing it.

type PlatformWritePlanInput

type PlatformWritePlanInput struct {
	Resource    string         `` /* 144-byte string literal not displayed */
	ID          string         `json:"id,omitempty" jsonschema:"Resource id for update, delete, or action operations"`
	Action      string         `` /* 132-byte string literal not displayed */
	Operation   string         `json:"operation" jsonschema:"Write operation: create, update, delete, or action"`
	Payload     map[string]any `json:"payload,omitempty" jsonschema:"Structured payload to validate and summarize. This tool never executes it."`
	PayloadJSON string         `json:"payload_json,omitempty" jsonschema:"Legacy JSON object payload. Prefer payload; this tool never executes it."`
	OmitFiles   bool           `json:"omit_files,omitempty" jsonschema:"Omit root folder file and folder nodes for impact lookup. Defaults to false."`
	OmitLineage bool           `json:"omit_lineage,omitempty" jsonschema:"Omit hosted lineage edges for impact lookup. Defaults to false."`
	Fields      []string       `json:"fields,omitempty" jsonschema:"Top-level output fields to include, for example preview, affected, warnings."`
}

PlatformWritePlanInput is the input for the whodb_platform_write_plan tool.

type PlatformWritePreflight

type PlatformWritePreflight struct {
	Name   string `json:"name"`
	Status string `json:"status"`
	Reason string `json:"reason,omitempty"`
	Tool   string `json:"tool,omitempty"`
}

PlatformWritePreflight summarizes checks made before a write is confirmed.

type QueryInput

type QueryInput struct {
	// Connection is the name of a saved connection or environment profile.
	Connection string `json:"connection" jsonschema:"Connection name (optional if only one exists)"`
	// Query is the SQL query to execute
	Query string `json:"query" jsonschema:"SQL query to execute"`
	// Parameters for parameterized queries (optional).
	// Use placeholders in the query ($1, $2 for Postgres; ? for MySQL/SQLite).
	// Example: query="SELECT * FROM users WHERE id = $1", parameters=[42]
	Parameters []any `json:"parameters,omitempty" jsonschema:"Parameterized query values ($1/$2 for Postgres or ? for MySQL/SQLite)"`
}

QueryInput is the input for the whodb_query tool.

type QueryOutput

type QueryOutput struct {
	Columns              []string `json:"columns"`
	ColumnTypes          []string `json:"column_types,omitempty"`
	Rows                 [][]any  `json:"rows"`
	Error                string   `json:"error,omitempty"`
	Warning              string   `json:"warning,omitempty"`
	ConfirmationRequired bool     `json:"confirmation_required,omitempty"`
	ConfirmationToken    string   `json:"confirmation_token,omitempty"`
	ConfirmationQuery    string   `json:"confirmation_query,omitempty"`
	ConfirmationExpiry   string   `json:"confirmation_expiry,omitempty"` // ISO 8601 timestamp when the token expires
	RequestID            string   `json:"request_id,omitempty"`          // Unique ID for request tracing
}

QueryOutput is the output for the whodb_query tool.

func HandleQuery

func HandleQuery(ctx context.Context, req *mcp.CallToolRequest, input QueryInput, secOpts *SecurityOptions) (*mcp.CallToolResult, QueryOutput, error)

HandleQuery executes a SQL query against the specified connection with security validation.

func (QueryOutput) MarshalJSON

func (o QueryOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null, which the MCP SDK's output schema validator requires.

type SchemaDetail

type SchemaDetail struct {
	Name   string      `json:"name"`
	Tables []TableInfo `json:"tables,omitempty"`
}

SchemaDetail holds a schema name and optionally its tables.

type SchemaDiffInput

type SchemaDiffInput struct {
	// FromConnection is the base connection to compare from.
	FromConnection string `json:"from_connection" jsonschema:"Source connection name"`
	// ToConnection is the target connection to compare against.
	ToConnection string `json:"to_connection" jsonschema:"Target connection name"`
	// FromSchema optionally overrides the source schema/database name.
	FromSchema string `json:"from_schema,omitempty" jsonschema:"Source schema override"`
	// ToSchema optionally overrides the target schema/database name.
	ToSchema string `json:"to_schema,omitempty" jsonschema:"Target schema override"`
}

SchemaDiffInput is the input for the whodb_diff tool.

type SchemaDiffOutput

type SchemaDiffOutput struct {
	Result    *schemadiff.Result `json:"result,omitempty"`
	Error     string             `json:"error,omitempty"`
	RequestID string             `json:"request_id,omitempty"`
}

SchemaDiffOutput is the output for the whodb_diff tool.

func HandleSchemaDiff

HandleSchemaDiff compares schema metadata between two saved connections.

type SchemasInput

type SchemasInput struct {
	// Connection is the name of a saved connection or environment profile.
	Connection string `json:"connection" jsonschema:"Connection name (optional if only one exists)"`
	// IncludeTables returns the tables within each schema in a single call.
	// Reduces round-trips when you need both schemas and tables.
	IncludeTables bool `json:"include_tables,omitempty" jsonschema:"Set true to also return tables within each schema in a single call"`
}

SchemasInput is the input for the whodb_schemas tool.

type SchemasOutput

type SchemasOutput struct {
	Schemas   []string       `json:"schemas"`
	Details   []SchemaDetail `json:"details,omitempty"` // Populated when include_tables=true
	Error     string         `json:"error,omitempty"`
	RequestID string         `json:"request_id,omitempty"` // Unique ID for request tracing
}

SchemasOutput is the output for the whodb_schemas tool.

func HandleSchemas

HandleSchemas lists all schemas in the database.

func (SchemasOutput) MarshalJSON

func (o SchemasOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type SecurityLevel

type SecurityLevel string

SecurityLevel defines the strictness of SQL validation for MCP access control.

const (
	SecurityLevelStrict   SecurityLevel = "strict"   // Blocks writes + dangerous functions
	SecurityLevelStandard SecurityLevel = "standard" // Blocks writes
	SecurityLevelMinimal  SecurityLevel = "minimal"  // Only blocks DROP/TRUNCATE/DELETE without WHERE
)

type SecurityOptions

type SecurityOptions struct {
	ReadOnly            bool
	ConfirmWrites       bool
	AllowWrite          bool
	SecurityLevel       SecurityLevel
	QueryTimeout        time.Duration
	MaxRows             int
	AllowMultiStatement bool
	AllowDrop           bool
	DefaultConnection   string   // Injected connection when not specified
	AllowedConnections  []string // If set, only these connections are accessible
}

SecurityOptions contains runtime security settings for query execution

type ServerOptions

type ServerOptions struct {
	// Logger for server messages (defaults to stderr).
	Logger *slog.Logger
	// Instructions provides guidance to LLMs on how to use this server.
	Instructions string
	// ReadOnly prevents INSERT, UPDATE, DELETE, DROP, CREATE, ALTER, TRUNCATE operations.
	// Default: true
	ReadOnly bool
	// ConfirmWrites enables human-in-the-loop confirmation for write operations.
	// When enabled, write operations return a confirmation token that must be approved.
	// Default: false
	ConfirmWrites bool
	// AllowWrite permits write operations without confirmation.
	// Default: false
	AllowWrite bool
	// SecurityLevel controls the strictness of query validation.
	// Options: "strict", "standard", "minimal". Default: "standard"
	SecurityLevel SecurityLevel
	// QueryTimeout is the maximum time a query can run before being cancelled.
	// Default: 30 seconds
	QueryTimeout time.Duration
	// MaxRows limits the number of rows returned by queries.
	// Default: 0 (unlimited). Set via --max-rows to enable truncation.
	MaxRows int
	// AllowMultiStatement permits multiple SQL statements in one query (separated by semicolons).
	// WARNING: Enabling this increases SQL injection risk.
	// Default: false
	AllowMultiStatement bool
	// AllowDrop permits DROP/TRUNCATE operations even in allow-write mode.
	// Without this, DROP is blocked unless --confirm-writes is used
	// Default: false
	AllowDrop bool
	// EnabledTools specifies which tools to enable. If empty, all tools are enabled.
	// Valid values: "query", "schemas", "tables", "columns", "connections", "confirm",
	// "pending", "explain", "diff", "erd", "audit", "suggestions"
	EnabledTools []string
	// DisabledTools specifies which tools to disable. Takes precedence over EnabledTools.
	// Valid values: "query", "schemas", "tables", "columns", "connections", "confirm",
	// "pending", "explain", "diff", "erd", "audit", "suggestions"
	DisabledTools []string
	// DefaultConnection is the connection to use when none is specified.
	// This simplifies AI interaction when working with a single database.
	DefaultConnection string
	// AllowedConnections restricts which connections can be used.
	// When set, only these connections are visible and accessible.
	// If DefaultConnection is not set, the first allowed connection becomes the default.
	AllowedConnections []string
	// PlatformEnabled runs hosted WhoDB platform mode.
	// When enabled, only hosted platform tools are registered.
	PlatformEnabled bool
}

ServerOptions configures the MCP server.

type StatementType

type StatementType = sqlguard.StatementType

StatementType re-exports the shared classifier's statement type so existing MCP callers and analytics payloads keep the same type.

func DetectStatementType

func DetectStatementType(query string) StatementType

DetectStatementType returns the type of SQL statement based on its first significant token.

type SuggestionsInput

type SuggestionsInput struct {
	// Connection is the name of a saved connection or environment profile.
	Connection string `json:"connection" jsonschema:"Connection name (optional if only one exists)"`
	// Schema optionally overrides the schema/database to inspect.
	Schema string `json:"schema,omitempty" jsonschema:"Schema or database name override"`
}

SuggestionsInput is the input for the whodb_suggestions tool.

type SuggestionsOutput

type SuggestionsOutput struct {
	Suggestions []dbmgr.QuerySuggestion `json:"suggestions"`
	Error       string                  `json:"error,omitempty"`
	RequestID   string                  `json:"request_id,omitempty"`
}

SuggestionsOutput is the output for the whodb_suggestions tool.

func HandleSuggestions

HandleSuggestions loads backend-generated query suggestions for a connection.

func (SuggestionsOutput) MarshalJSON

func (o SuggestionsOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type TableInfo

type TableInfo struct {
	Name       string            `json:"name"`
	Attributes map[string]string `json:"attributes,omitempty"`
	Columns    []ColumnInfo      `json:"columns,omitempty"` // Populated when include_columns=true
}

TableInfo represents information about a database table.

type TablesInput

type TablesInput struct {
	// Connection is the name of a saved connection or environment profile.
	Connection string `json:"connection" jsonschema:"Connection name (optional if only one exists)"`
	// Schema to list tables from (uses default if not specified)
	Schema string `json:"schema,omitempty" jsonschema:"Schema name (uses default if omitted)"`
	// IncludeColumns returns column details for each table in a single call.
	// Reduces round-trips when you need both tables and their columns.
	IncludeColumns bool `json:"include_columns,omitempty" jsonschema:"Set true to also return column details for each table in a single call"`
}

TablesInput is the input for the whodb_tables tool.

type TablesOutput

type TablesOutput struct {
	Tables    []TableInfo `json:"tables"`
	Schema    string      `json:"schema"`
	Error     string      `json:"error,omitempty"`
	RequestID string      `json:"request_id,omitempty"` // Unique ID for request tracing
}

TablesOutput is the output for the whodb_tables tool.

func HandleTables

HandleTables lists all tables in a schema.

func (TablesOutput) MarshalJSON

func (o TablesOutput) MarshalJSON() ([]byte, error)

MarshalJSON ensures nil slices are serialized as [] instead of null.

type ToolEnablement

type ToolEnablement struct {
	EnabledTools  []string
	DisabledTools []string
}

ToolEnablement tracks which tools should be registered.

type TransportType

type TransportType string

TransportType specifies the transport mechanism for the MCP server.

const (
	// TransportStdio uses stdin/stdout for communication (default, for CLI integration).
	TransportStdio TransportType = "stdio"
	// TransportHTTP runs as an HTTP server with streaming support.
	TransportHTTP TransportType = "http"
)

Jump to

Keyboard shortcuts

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