resource

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package resource provides MCP resource handlers for domain knowledge.

Index

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 ethpandaops://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 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 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.

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

type NetworkWithClusters struct {
	discovery.Network
	Clusters []string `json:"clusters"`
}

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.

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

type ToolLister interface {
	List() []mcp.Tool
}

ToolLister provides access to registered tools.

Jump to

Keyboard shortcuts

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