packagedocs

package
v0.59.134 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (

	// DefaultPackageDocsRateLimit is the default maximum requests per second for package docs
	DefaultPackageDocsRateLimit = 10
	// PackageDocsRateLimitEnvVar is the environment variable for configuring rate limit
	PackageDocsRateLimitEnvVar = "PACKAGE_DOCS_RATE_LIMIT"
	// Context7APIKeyEnvVar is the environment variable for the Context7 API key
	Context7APIKeyEnvVar = "CONTEXT7_API_KEY"
	// Context7SourceIdentifier is the source identifier sent in API requests
	Context7SourceIdentifier = "mcp-devtools"
)

Variables

This section is empty.

Functions

func ValidateLibraryID

func ValidateLibraryID(libraryID string) error

ValidateLibraryID validates a Context7 library ID format

Types

type Client

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

Client handles communication with the Context7 API

func NewClient

func NewClient(logger *logrus.Logger) *Client

NewClient creates a new Context7 API client with rate limiting

func (*Client) GetLibraryDocs

func (c *Client) GetLibraryDocs(ctx context.Context, libraryID string, params *SearchLibraryDocsParams) (string, error)

GetLibraryDocs retrieves documentation for a specific library

func (*Client) SearchLibraries

func (c *Client) SearchLibraries(ctx context.Context, query string) ([]*SearchResult, error)

SearchLibraries searches for libraries matching the given query

type GetLibraryDocsTool

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

GetLibraryDocsTool fetches documentation for a specific library

func (*GetLibraryDocsTool) Definition

func (t *GetLibraryDocsTool) Definition() mcpapi.Tool

Definition returns the tool's definition for MCP registration

func (*GetLibraryDocsTool) Execute

func (t *GetLibraryDocsTool) Execute(ctx context.Context, logger *logrus.Logger, cache *sync.Map, args map[string]any) (*mcpapi.CallToolResult, error)

Execute executes the get_library_documentation tool

func (*GetLibraryDocsTool) ProvideExtendedInfo added in v0.22.0

func (t *GetLibraryDocsTool) ProvideExtendedInfo() *tools.ExtendedHelp

ProvideExtendedInfo provides detailed usage information for the get_library_documentation tool

type HTTPClientInterface added in v0.21.1

type HTTPClientInterface interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClientInterface defines the interface for HTTP clients

type RateLimitedHTTPClient added in v0.21.1

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

RateLimitedHTTPClient implements a rate-limited HTTP client

func (*RateLimitedHTTPClient) Do added in v0.21.1

Do implements the HTTP client interface with rate limiting

type ResolveLibraryIDTool

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

ResolveLibraryIDTool resolves a library name to a Context7-compatible library ID

func (*ResolveLibraryIDTool) Definition

func (t *ResolveLibraryIDTool) Definition() mcpapi.Tool

Definition returns the tool's definition for MCP registration

func (*ResolveLibraryIDTool) Execute

func (t *ResolveLibraryIDTool) Execute(ctx context.Context, logger *logrus.Logger, cache *sync.Map, args map[string]any) (*mcpapi.CallToolResult, error)

Execute executes the resolve_library_id tool

func (*ResolveLibraryIDTool) ProvideExtendedInfo added in v0.22.0

func (t *ResolveLibraryIDTool) ProvideExtendedInfo() *tools.ExtendedHelp

ProvideExtendedInfo provides detailed usage information for the resolve_library_id tool

type SearchLibrariesResponse

type SearchLibrariesResponse struct {
	Results []*SearchResult `json:"results"`
}

SearchLibrariesResponse represents the response from the search API

type SearchLibraryDocsParams

type SearchLibraryDocsParams struct {
	Topic   string   `json:"topic,omitempty"`
	Tokens  int      `json:"tokens,omitempty"`
	Folders []string `json:"folders,omitempty"`
}

SearchLibraryDocsParams represents parameters for searching library documentation

type SearchResult

type SearchResult struct {
	ID            string    `json:"id"`
	Title         string    `json:"title"`
	Description   string    `json:"description"`
	LastUpdate    time.Time `json:"lastUpdateDate"`
	TotalTokens   int       `json:"totalTokens"`
	TotalSnippets int       `json:"totalSnippets"`
	Stars         int       `json:"stars"`
	TrustScore    float64   `json:"trustScore,omitempty"`
	Versions      []string  `json:"versions,omitempty"`
}

SearchResult represents a library search result

func (*SearchResult) GetResourceURI

func (s *SearchResult) GetResourceURI() string

GetResourceURI returns the Context7 resource URI for this search result

Jump to

Keyboard shortcuts

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