Documentation
¶
Index ¶
Constants ¶
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" )
Variables ¶
This section is empty.
Functions ¶
func ValidateLibraryID ¶
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 (*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 ¶
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() mcp.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) (*mcp.CallToolResult, error)
Execute executes the get_library_docs tool
func (*GetLibraryDocsTool) ProvideExtendedInfo ¶ added in v0.22.0
func (t *GetLibraryDocsTool) ProvideExtendedInfo() *tools.ExtendedHelp
ProvideExtendedInfo provides detailed usage information for the get_library_docs tool
type HTTPClientInterface ¶ added in v0.21.1
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
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() mcp.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) (*mcp.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"`
}
SearchResult represents a library search result
func (*SearchResult) GetResourceURI ¶
func (s *SearchResult) GetResourceURI() string
GetResourceURI returns the Context7 resource URI for this search result