Documentation
¶
Overview ¶
Package resource provides MCP resource handlers for domain knowledge.
Index ¶
- func GetQueryExamples(moduleReg *module.Registry) map[string]types.ExampleCategory
- func RegisterAPIResources(log logrus.FieldLogger, reg Registry, moduleReg *module.Registry)
- func RegisterDatasourcesResources(log logrus.FieldLogger, reg Registry, moduleReg *module.Registry)
- func RegisterExamplesResources(log logrus.FieldLogger, reg Registry, moduleReg *module.Registry)
- func RegisterGettingStartedResources(log logrus.FieldLogger, reg Registry, toolReg ToolLister, ...)
- func RegisterNetworksResources(log logrus.FieldLogger, reg Registry, client cartographoor.CartographoorClient)
- type ConsensusSpecIndex
- type ConsensusSpecSearchResult
- type ConstantSearchResult
- type DatasourceProvider
- type DatasourcesJSONResponse
- type EIPIndex
- type EIPSearchResult
- type ExampleIndex
- type GroupDetailResponse
- type NetworkDetailResponse
- type NetworkSummary
- type NetworkWithClusters
- type NetworksActiveResponse
- type NetworksAllResponse
- type ReadHandler
- type Registry
- type RunbookIndex
- type RunbookSearchResult
- type SearchResult
- type StaticResource
- type TemplateResource
- type ToolLister
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetQueryExamples ¶
func GetQueryExamples(moduleReg *module.Registry) map[string]types.ExampleCategory
GetQueryExamples returns query examples from initialized modules only.
func RegisterAPIResources ¶
func RegisterAPIResources(log logrus.FieldLogger, reg Registry, moduleReg *module.Registry)
RegisterAPIResources registers the python://ethpandaops resource with the registry.
func RegisterDatasourcesResources ¶
func RegisterDatasourcesResources( log logrus.FieldLogger, reg Registry, moduleReg *module.Registry, )
RegisterDatasourcesResources registers the datasources:// resources with the registry.
func RegisterExamplesResources ¶
func RegisterExamplesResources(log logrus.FieldLogger, reg Registry, moduleReg *module.Registry)
RegisterExamplesResources registers the examples://queries resource.
func RegisterGettingStartedResources ¶
func RegisterGettingStartedResources( log logrus.FieldLogger, reg Registry, toolReg ToolLister, moduleReg *module.Registry, )
RegisterGettingStartedResources registers the panda://getting-started resource.
func RegisterNetworksResources ¶
func RegisterNetworksResources(log logrus.FieldLogger, reg Registry, client cartographoor.CartographoorClient)
RegisterNetworksResources registers all network-related resources with the registry.
Types ¶
type ConsensusSpecIndex ¶ added in v0.21.0
type ConsensusSpecIndex struct {
// contains filtered or unexported fields
}
ConsensusSpecIndex provides semantic search over consensus specs with hybrid scoring and exact constant name matching.
func NewConsensusSpecIndex ¶ added in v0.21.0
func NewConsensusSpecIndex( log logrus.FieldLogger, embedder embedding.Embedder, specs []types.ConsensusSpec, constants []types.SpecConstant, ) (*ConsensusSpecIndex, error)
NewConsensusSpecIndex creates a semantic search index from consensus specs.
func (*ConsensusSpecIndex) SearchConstants ¶ added in v0.21.0
func (idx *ConsensusSpecIndex) SearchConstants( query string, limit int, ) []ConstantSearchResult
SearchConstants returns constants matching the query by exact name match, prefix match, or substring match.
func (*ConsensusSpecIndex) SearchSpecs ¶ added in v0.21.0
func (idx *ConsensusSpecIndex) SearchSpecs( query string, limit int, ) ([]ConsensusSpecSearchResult, error)
SearchSpecs returns the top-k semantically similar specs for a query.
type ConsensusSpecSearchResult ¶ added in v0.21.0
type ConsensusSpecSearchResult struct {
Spec types.ConsensusSpec `json:"spec"`
Score float64 `json:"similarity_score"`
}
ConsensusSpecSearchResult includes a spec and its similarity score.
type ConstantSearchResult ¶ added in v0.21.0
type ConstantSearchResult struct {
Constant types.SpecConstant `json:"constant"`
Score float64 `json:"similarity_score"`
}
ConstantSearchResult includes a constant and its similarity score.
type DatasourceProvider ¶
type DatasourceProvider struct {
// contains filtered or unexported fields
}
DatasourceProvider provides datasource information from the module registry.
func NewDatasourceProvider ¶
func NewDatasourceProvider(moduleReg *module.Registry) *DatasourceProvider
NewDatasourceProvider creates a new datasource provider.
func (*DatasourceProvider) DatasourceInfo ¶
func (p *DatasourceProvider) DatasourceInfo() []types.DatasourceInfo
DatasourceInfo returns aggregated datasource info from all initialized modules.
type DatasourcesJSONResponse ¶
type DatasourcesJSONResponse struct {
Datasources []types.DatasourceInfo `json:"datasources"`
}
DatasourcesJSONResponse is the JSON response for datasources resources.
type EIPIndex ¶ added in v0.12.0
type EIPIndex struct {
// contains filtered or unexported fields
}
EIPIndex provides semantic search over EIPs with hybrid scoring.
func NewEIPIndex ¶ added in v0.12.0
func NewEIPIndex( log logrus.FieldLogger, embedder embedding.Embedder, eips []types.EIP, ) (*EIPIndex, error)
NewEIPIndex creates a semantic search index from EIPs. All chunks are batch-embedded via the remote embedder (which handles its own model-aware caching on the proxy side).
type EIPSearchResult ¶ added in v0.12.0
EIPSearchResult includes the EIP and its similarity score.
type ExampleIndex ¶
type ExampleIndex struct {
// contains filtered or unexported fields
}
ExampleIndex provides semantic search over query examples.
func NewExampleIndex ¶
func NewExampleIndex( log logrus.FieldLogger, embedder embedding.Embedder, categories map[string]types.ExampleCategory, ) (*ExampleIndex, error)
NewExampleIndex creates and populates a semantic search index from query examples using batch embedding.
func (*ExampleIndex) Close ¶
func (idx *ExampleIndex) Close() error
Close releases resources held by the index.
func (*ExampleIndex) Search ¶
func (idx *ExampleIndex) Search(query string, limit int) ([]SearchResult, error)
Search returns the top-k semantically similar examples for a query.
type GroupDetailResponse ¶
type GroupDetailResponse struct {
Group string `json:"group"`
Networks map[string]NetworkWithClusters `json:"networks"`
}
GroupDetailResponse is the response for networks://{group} (devnet group).
type NetworkDetailResponse ¶
type NetworkDetailResponse struct {
Network NetworkWithClusters `json:"network"`
}
NetworkDetailResponse is the response for networks://{name} (single network).
type NetworkSummary ¶
type NetworkSummary struct {
Name string `json:"name"`
ChainID uint64 `json:"chain_id,omitempty"`
Clusters []string `json:"clusters"`
Status string `json:"status"`
}
NetworkSummary is a compact representation for the active networks list.
type NetworkWithClusters ¶
NetworkWithClusters wraps a discovery.Network with xatu-specific cluster info.
type NetworksActiveResponse ¶
type NetworksActiveResponse struct {
Networks []NetworkSummary `json:"networks"`
Groups []string `json:"groups"`
Usage string `json:"usage"`
}
NetworksActiveResponse is the response for networks://active.
type NetworksAllResponse ¶
type NetworksAllResponse struct {
Networks map[string]NetworkWithClusters `json:"networks"`
Groups []string `json:"groups"`
}
NetworksAllResponse is the response for networks://all.
type ReadHandler ¶
type ReadHandler = types.ReadHandler
ReadHandler is a function that reads a resource and returns its content.
type Registry ¶
type Registry interface {
// RegisterStatic registers a static resource with a fixed URI.
RegisterStatic(res StaticResource)
// RegisterTemplate registers a template resource with URI parameters.
RegisterTemplate(res TemplateResource)
// ListStatic returns all registered static resources.
ListStatic() []mcp.Resource
// ListTemplates returns all registered resource templates.
ListTemplates() []mcp.ResourceTemplate
// Read reads a resource by URI and returns its content, mime type, and any error.
Read(ctx context.Context, uri string) (content string, mimeType string, err error)
}
Registry manages MCP resources and their handlers.
func NewRegistry ¶
func NewRegistry(log logrus.FieldLogger) Registry
NewRegistry creates a new resource registry.
type RunbookIndex ¶
type RunbookIndex struct {
// contains filtered or unexported fields
}
RunbookIndex provides semantic search over runbooks.
func NewRunbookIndex ¶
func NewRunbookIndex( log logrus.FieldLogger, embedder embedding.Embedder, runbooks []types.Runbook, ) (*RunbookIndex, error)
NewRunbookIndex creates and populates a semantic search index from runbooks using batch embedding.
func (*RunbookIndex) Search ¶
func (idx *RunbookIndex) Search(query string, limit int) ([]RunbookSearchResult, error)
Search returns the top-k semantically similar runbooks for a query.
type RunbookSearchResult ¶
type RunbookSearchResult struct {
Runbook types.Runbook `json:"runbook"`
Score float64 `json:"similarity_score"`
}
RunbookSearchResult includes the runbook and its similarity score.
type SearchResult ¶
type SearchResult struct {
CategoryKey string `json:"category_key"`
CategoryName string `json:"category_name"`
Example types.Example `json:"example"`
Score float64 `json:"similarity_score"`
}
SearchResult includes the example and its similarity score.
type StaticResource ¶
type StaticResource = types.StaticResource
StaticResource represents a static resource with a fixed URI.
type TemplateResource ¶
type TemplateResource = types.TemplateResource
TemplateResource represents a resource template with URI parameters.
type ToolLister ¶
ToolLister provides access to registered tools.