Documentation
¶
Index ¶
Constants ¶
const ( // DefaultTimeout for HTTP requests DefaultTimeout = 15 * time.Second // UserAgent for web requests UserAgent = "mcp-devtools-fetch/1.0 (AI Assistant Tool)" // MaxContentSize to prevent memory issues (20MB) MaxContentSize = 20 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func ProcessContent ¶
ProcessContent determines how to process content based on its type
Types ¶
type ContentTypeInfo ¶
ContentTypeInfo represents information about detected content type
func DetectContentType ¶
func DetectContentType(contentType, content string) ContentTypeInfo
DetectContentType analyses the content type and determines how to process it
type FetchURLRequest ¶
type FetchURLRequest struct {
URL string `json:"url"`
MaxLength int `json:"max_length,omitempty"`
StartIndex int `json:"start_index,omitempty"`
Raw bool `json:"raw,omitempty"`
}
FetchURLRequest represents the parameters for the fetch-url tool
type FetchURLResponse ¶
type FetchURLResponse struct {
ContentType string `json:"content_type,omitempty"`
StatusCode int `json:"status_code,omitempty"`
Content string `json:"content"`
Truncated bool `json:"truncated"`
StartIndex int `json:"start_index"`
EndIndex int `json:"end_index"`
TotalLength int `json:"total_length"`
TotalLines int `json:"total_lines"`
StartLine int `json:"start_line"`
EndLine int `json:"end_line"`
NextChunkPreview string `json:"next_chunk_preview,omitempty"`
RemainingLines int `json:"remaining_lines"`
Message string `json:"message,omitempty"`
}
FetchURLResponse represents the response from the fetch-url tool
type FetchURLTool ¶
type FetchURLTool struct{}
FetchURLTool implements URL fetching with HTML-to-markdown conversion
func (*FetchURLTool) Definition ¶
func (t *FetchURLTool) Definition() mcp.Tool
Definition returns the tool's definition for MCP registration
func (*FetchURLTool) Execute ¶
func (t *FetchURLTool) Execute(ctx context.Context, logger *logrus.Logger, cache *sync.Map, args map[string]any) (*mcp.CallToolResult, error)
Execute executes the fetch-url tool
func (*FetchURLTool) ProvideExtendedInfo ¶ added in v0.22.0
func (t *FetchURLTool) ProvideExtendedInfo() *tools.ExtendedHelp
ProvideExtendedInfo provides detailed usage information for the fetch_url tool
type MarkdownConverter ¶
type MarkdownConverter struct {
// contains filtered or unexported fields
}
MarkdownConverter handles HTML to markdown conversion with custom rules
func NewMarkdownConverter ¶
func NewMarkdownConverter() *MarkdownConverter
NewMarkdownConverter creates a new converter with AI-friendly settings
func (*MarkdownConverter) ConvertToMarkdown ¶
func (c *MarkdownConverter) ConvertToMarkdown(logger *logrus.Logger, htmlContent string) (string, error)
ConvertToMarkdown converts HTML content to clean markdown
type WebClient ¶
type WebClient struct {
// contains filtered or unexported fields
}
WebClient handles HTTP requests for fetching web content
func NewWebClient ¶
func NewWebClient() *WebClient
NewWebClient creates a new web client with proper timeouts, context support and proxy configuration
func (*WebClient) FetchContent ¶
func (c *WebClient) FetchContent(ctx context.Context, logger *logrus.Logger, targetURL string) (*FetchURLResponse, error)
FetchContent fetches content from a URL with context support