google

package
v0.59.13 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent = "MCP-DevTools/1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleClient

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

GoogleClient handles communication with Google Custom Search API

func NewGoogleClient

func NewGoogleClient(apiKey, cx string) *GoogleClient

NewGoogleClient creates a new Google Custom Search API client

func (*GoogleClient) Search

func (c *GoogleClient) Search(ctx context.Context, logger *logrus.Logger, query string, searchType string, count int, start int) (*GoogleSearchResponse, error)

Search performs a search query

type GoogleImage

type GoogleImage struct {
	Src string `json:"src,omitempty"`
}

GoogleImage represents image information from pagemap

type GoogleImageInfo

type GoogleImageInfo struct {
	ContextLink     string `json:"contextLink,omitempty"`
	Height          int    `json:"height,omitempty"`
	Width           int    `json:"width,omitempty"`
	ByteSize        int    `json:"byteSize,omitempty"`
	ThumbnailLink   string `json:"thumbnailLink,omitempty"`
	ThumbnailHeight int    `json:"thumbnailHeight,omitempty"`
	ThumbnailWidth  int    `json:"thumbnailWidth,omitempty"`
}

GoogleImageInfo contains image-specific metadata

type GooglePageMap

type GooglePageMap struct {
	CSEThumbnail []GoogleThumbnail `json:"cse_thumbnail,omitempty"`
	CSEImage     []GoogleImage     `json:"cse_image,omitempty"`
}

GooglePageMap contains structured data from the page

type GoogleProvider

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

GoogleProvider implements the unified SearchProvider interface

func NewGoogleProvider

func NewGoogleProvider() *GoogleProvider

NewGoogleProvider creates a new Google Custom Search provider

func (*GoogleProvider) GetName

func (p *GoogleProvider) GetName() string

GetName returns the provider name

func (*GoogleProvider) GetSupportedTypes

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

GetSupportedTypes returns the search types this provider supports

func (*GoogleProvider) IsAvailable

func (p *GoogleProvider) IsAvailable() bool

IsAvailable checks if the provider is available

func (*GoogleProvider) Search

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

Search executes a search using the Google provider

type GoogleQueries

type GoogleQueries struct {
	Request      []GoogleQueryMetadata `json:"request,omitempty"`
	NextPage     []GoogleQueryMetadata `json:"nextPage,omitempty"`
	PreviousPage []GoogleQueryMetadata `json:"previousPage,omitempty"`
}

GoogleQueries contains query metadata

type GoogleQueryMetadata

type GoogleQueryMetadata struct {
	Title          string `json:"title,omitempty"`
	TotalResults   string `json:"totalResults,omitempty"`
	SearchTerms    string `json:"searchTerms,omitempty"`
	Count          int    `json:"count,omitempty"`
	StartIndex     int    `json:"startIndex,omitempty"`
	InputEncoding  string `json:"inputEncoding,omitempty"`
	OutputEncoding string `json:"outputEncoding,omitempty"`
}

GoogleQueryMetadata contains metadata about a query

type GoogleSearchInfo

type GoogleSearchInfo struct {
	SearchTime            float64 `json:"searchTime,omitempty"`
	FormattedSearchTime   string  `json:"formattedSearchTime,omitempty"`
	TotalResults          string  `json:"totalResults,omitempty"`
	FormattedTotalResults string  `json:"formattedTotalResults,omitempty"`
}

GoogleSearchInfo contains information about the search

type GoogleSearchResponse

type GoogleSearchResponse struct {
	Items             []GoogleSearchResult `json:"items"`
	Queries           GoogleQueries        `json:"queries"`
	SearchInformation GoogleSearchInfo     `json:"searchInformation"`
}

GoogleSearchResponse represents the response from Google Custom Search API

type GoogleSearchResult

type GoogleSearchResult struct {
	Title       string           `json:"title"`
	HTMLTitle   string           `json:"htmlTitle,omitempty"`
	Link        string           `json:"link"`
	DisplayLink string           `json:"displayLink,omitempty"`
	Snippet     string           `json:"snippet"`
	HTMLSnippet string           `json:"htmlSnippet,omitempty"`
	Image       *GoogleImageInfo `json:"image,omitempty"`
	PageMap     *GooglePageMap   `json:"pagemap,omitempty"`
}

GoogleSearchResult represents a single search result

type GoogleThumbnail

type GoogleThumbnail struct {
	Src    string `json:"src,omitempty"`
	Width  string `json:"width,omitempty"`
	Height string `json:"height,omitempty"`
}

GoogleThumbnail represents thumbnail information

Jump to

Keyboard shortcuts

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