kagi

package
v0.59.27 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// KagiAPIBaseURL is the base URL for Kagi Search API
	KagiAPIBaseURL = "https://kagi.com/api/v0"

	// UserAgent for API requests
	UserAgent = "mcp-devtools/1.0"

	// DefaultTimeout for HTTP requests
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KagiClient

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

KagiClient handles HTTP requests to the Kagi Search API

func NewKagiClient

func NewKagiClient(apiKey string) *KagiClient

NewKagiClient creates a new Kagi API client with rate limiting

func (*KagiClient) Search

func (c *KagiClient) Search(ctx context.Context, logger *logrus.Logger, query string, limit int) (*KagiSearchResponse, error)

Search performs a web search using the Kagi API

type KagiError

type KagiError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Ref  string `json:"ref,omitempty"`
}

KagiError represents an error response from the API

type KagiMeta

type KagiMeta struct {
	ID   string  `json:"id"`
	Node string  `json:"node"`
	MS   float64 `json:"ms"`
}

KagiMeta contains metadata about the search request

type KagiProvider

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

KagiProvider implements the unified SearchProvider interface

func NewKagiProvider

func NewKagiProvider() *KagiProvider

NewKagiProvider creates a new Kagi search provider

func (*KagiProvider) GetName

func (p *KagiProvider) GetName() string

GetName returns the provider name

func (*KagiProvider) GetSupportedTypes

func (p *KagiProvider) GetSupportedTypes() []string

GetSupportedTypes returns the search types this provider supports

func (*KagiProvider) IsAvailable

func (p *KagiProvider) IsAvailable() bool

IsAvailable checks if the provider is available

func (*KagiProvider) Search

func (p *KagiProvider) Search(ctx context.Context, logger *logrus.Logger, searchType string, args map[string]any) (*internetsearch.SearchResponse, error)

Search executes a search using the Kagi provider

type KagiResult

type KagiResult struct {
	T         int            `json:"t"`                   // Result type (0=search result, 1=related search)
	Rank      int            `json:"rank"`                // Result ranking position
	URL       string         `json:"url"`                 // Result URL
	Title     string         `json:"title"`               // Result title
	Snippet   string         `json:"snippet"`             // Result snippet/description
	Published string         `json:"published,omitempty"` // Publication date if available
	Thumbnail *KagiThumbnail `json:"thumbnail,omitempty"` // Thumbnail if available
	List      []string       `json:"list,omitempty"`      // Related searches
}

KagiResult represents a single search result from Kagi

type KagiSearchResponse

type KagiSearchResponse struct {
	Meta  KagiMeta     `json:"meta"`
	Data  []KagiResult `json:"data"`
	Error []KagiError  `json:"error,omitempty"`
}

KagiSearchResponse represents the response from Kagi Search API

type KagiThumbnail

type KagiThumbnail struct {
	URL    string `json:"url"`
	Height int    `json:"height,omitempty"`
	Width  int    `json:"width,omitempty"`
}

KagiThumbnail contains thumbnail information for a result

Jump to

Keyboard shortcuts

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