mcp

package
v0.3.36 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgInputField added in v0.3.35

type ArgInputField struct {
	Name string `json:"name"`
	Type string `json:"type" jsonschema_description:"GraphQL type (e.g. String!, Int)"`
}

type DataObjectQuery

type DataObjectQuery struct {
	Name       string             `json:"name"        jsonschema_description:"Query field name in module (e.g. orders, orders_by_pk)"`
	QueryType  string             `json:"query_type"  jsonschema_description:"select, select_one, aggregate, bucket_agg"`
	ReturnType string             `` /* 131-byte string literal not displayed */
	QueryRoot  string             `` /* 195-byte string literal not displayed */
	Arguments  []FunctionArgument `` /* 144-byte string literal not displayed */
}

type DataObjectSearchItem

type DataObjectSearchItem struct {
	Name          string            `` /* 129-byte string literal not displayed */
	ObjectType    string            `json:"object_type"   jsonschema_description:"table or view"`
	Parameterized bool              `` /* 150-byte string literal not displayed */
	HasGeometry   bool              `json:"has_geometry"  jsonschema_description:"true when the object has at least one geometry field"`
	Module        string            `json:"module"        jsonschema_description:"Module path the object lives in — REQUIRED to nest the GraphQL query"`
	Catalog       string            `json:"catalog"       jsonschema_description:"Data source (catalog) name the object belongs to"`
	Description   string            `json:"description"`
	FieldsCount   int               `json:"fields_count"  jsonschema_description:"Number of fields on the object type"`
	Queries       []DataObjectQuery `json:"queries"       jsonschema_description:"Available query fields in the module namespace"`
	Score         float64           `json:"score"`
}

type DataSourceSearchItem

type DataSourceSearchItem struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Type        string  `json:"type"      jsonschema_description:"Source type: duckdb, postgres, http, etc"`
	ReadOnly    bool    `json:"read_only"`
	AsModule    bool    `json:"as_module"`
	Score       float64 `json:"score"`
}

type EnumValueInfo

type EnumValueInfo struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

type EnumValuesResult

type EnumValuesResult struct {
	Name        string          `json:"name"        jsonschema_description:"Enum type name"`
	Description string          `json:"description" jsonschema_description:"Enum type description"`
	Values      []EnumValueInfo `json:"values"      jsonschema_description:"List of enum values"`
}

type FieldArgumentInfo

type FieldArgumentInfo struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Required bool   `json:"required"`
	Desc     string `json:"description,omitempty"`
}

type FieldStats

type FieldStats struct {
	Min      any `json:"min,omitempty"`
	Max      any `json:"max,omitempty"`
	Avg      any `json:"avg,omitempty"`
	Distinct int `json:"distinct_count"`
}

type FieldValueCount

type FieldValueCount struct {
	Value any `json:"value"`
	Count int `json:"count"`
}

type FieldValuesResult

type FieldValuesResult struct {
	Stats  *FieldStats       `json:"stats,omitempty"`
	Values []FieldValueCount `json:"values,omitempty"`
}

type FunctionArgument

type FunctionArgument struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Required bool   `json:"required"`
	Desc     string `json:"description,omitempty"`
	// Fields expands an input-object argument into its input fields.
	// Populated by describe_data_objects for the `args` argument of a
	// parameterized view (the view's parameters); empty otherwise.
	Fields []ArgInputField `` /* 176-byte string literal not displayed */
}

type FunctionReturnField

type FunctionReturnField struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type FunctionReturnType

type FunctionReturnType struct {
	TypeName string                `json:"type_name"`
	IsList   bool                  `json:"is_list"`
	Fields   []FunctionReturnField `json:"fields,omitempty" jsonschema_description:"Top fields of return type (up to 10)"`
}

type FunctionSearchItem

type FunctionSearchItem struct {
	Name        string `json:"name"        jsonschema_description:"Function field name in module"`
	Module      string `json:"module"      jsonschema_description:"Module the function lives in — REQUIRED to nest the GraphQL call"`
	Description string `json:"description,omitempty"`
	IsMutation  bool   `json:"is_mutation"`
	IsList      bool   `json:"is_list"     jsonschema_description:"Returns array"`
	// Lean search fields.
	ReturnType     string  `` /* 143-byte string literal not displayed */
	ArgumentsCount int     `` /* 138-byte string literal not displayed */
	Score          float64 `json:"score,omitempty"`
	// Full detail — set by discovery-describe_functions only.
	Arguments []FunctionArgument  `json:"arguments,omitempty"`
	Returns   *FunctionReturnType `json:"returns,omitempty"`
}

type ModuleSearchItem

type ModuleSearchItem struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Score       float64 `json:"score" jsonschema_description:"Relevance score 0-1, higher is better"`
}

type SearchResult

type SearchResult[T any] struct {
	Total    int `json:"total"    jsonschema_description:"Total matching items in database"`
	Returned int `json:"returned" jsonschema_description:"Items returned in this page"`
	Items    []T `json:"items"`
}

SearchResult is a generic paginated wrapper for tool responses.

type Server

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

Server wraps the MCP server and its dependencies.

func New

func New(querier types.Querier, mcpServer *server.MCPServer, debug bool) *Server

New creates a new MCP server backed by the given query engine.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns an http.Handler for mounting at /mcp.

type TypeFieldInfo

type TypeFieldInfo struct {
	Name        string              `json:"name"`
	FieldType   string              `json:"field_type"      jsonschema_description:"Full GraphQL type (e.g. String!, [Int])"`
	HugrType    string              `json:"hugr_type"       jsonschema_description:"select=relation, aggregate, bucket_agg, extra_field, function"`
	IsList      bool                `json:"is_list"`
	Description string              `json:"description,omitempty"`
	ArgsCount   int                 `json:"arguments_count"`
	Arguments   []FieldArgumentInfo `json:"arguments,omitempty"`
	Score       float64             `json:"score,omitempty"`
}

type TypeInfo

type TypeInfo struct {
	Name             string `json:"name"`
	Kind             string `json:"kind"     jsonschema_description:"OBJECT, INPUT_OBJECT, ENUM, SCALAR"`
	Module           string `json:"module"`
	HugrType         string `json:"hugr_type" jsonschema_description:"table, view, module, filter, data_input, etc"`
	Catalog          string `json:"catalog"`
	FieldsTotal      int    `json:"fields_total"`
	HasGeometryField bool   `json:"has_geometry_field"`
	HasFieldWithArgs bool   `json:"has_field_with_arguments"`
	Description      string `json:"description,omitempty"`
	LongDescription  string `json:"long_description,omitempty"`
}

Jump to

Keyboard shortcuts

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