websearch

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(p Provider)

Register search providers

Types

type ExtractInput

type ExtractInput struct {
	Url string `json:"url" jsonschema:"the url the web page to extract content from"`
}

type ExtractReply

type ExtractReply struct {
	Content string `json:"content" jsonschema:"the content extracted from the web page"`
}

type Extractor

type Extractor interface {
	Extracts(ctx context.Context, req *mcp.CallToolRequest, input ExtractInput) (*mcp.CallToolResult, ExtractReply, error)
}

type Provider

type Provider interface {
	ID() string
	Close() error
}

type SearchInput

type SearchInput struct {
	Query   string   `json:"query" jsonschema:"the query to search for"`
	Hashtag []string `json:"hashtag,omitempty" jsonschema:"hashtag to scope search results"`
	Sort    Sort     `json:"sort,omitempty" jsonschema:"the sort order of the search results, 'relevance' or 'date'"`
}

type SearchReply

type SearchReply struct {
	Facts []websearch.Fact `json:"facts" jsonschema:"the facts to return to the client"`
}

type Searcher

type Searcher interface {
	Search(ctx context.Context, req *mcp.CallToolRequest, input SearchInput) (*mcp.CallToolResult, SearchReply, error)
}

type Server

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

func Make

func Make(id string) *Server

func New

func New(id string) (server *Server, err error)

func (*Server) Close

func (srv *Server) Close() error

func (*Server) Extracts

func (*Server) Run

func (srv *Server) Run(ctx context.Context) error

func (*Server) Search

type Sort

type Sort string
const (
	SortRelevance Sort = "relevance"
	SortDate      Sort = "date"
)

Jump to

Keyboard shortcuts

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