Documentation
¶
Overview ¶
Package hackernews provides tools for the Hacker News public API.
No authentication required. Two APIs are used:
- Firebase REST: https://hacker-news.firebaseio.com/v0/ → top/new/best/ask/show/job story IDs, individual items
- Algolia Search: https://hn.algolia.com/api/v1/ → full-text search with filters
Tools exposed:
hn_search — search HN posts and comments (Algolia) hn_stories — fetch top/new/best/ask/show/job feed (Firebase) hn_item — fetch a single story or comment thread (Firebase)
Index ¶
- Constants
- type ItemTool
- func (t *ItemTool) BackfillInput(_ context.Context, input map[string]any) map[string]any
- func (t *ItemTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *ItemTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *ItemTool) Definition() tool.Definition
- func (t *ItemTool) Description(_ context.Context) (string, error)
- func (t *ItemTool) FormatResult(data any) string
- func (t *ItemTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *ItemTool) IsEnabled() bool
- func (t *ItemTool) IsReadOnly(_ map[string]any) bool
- func (t *ItemTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)
- type SearchTool
- func (t *SearchTool) BackfillInput(_ context.Context, input map[string]any) map[string]any
- func (t *SearchTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *SearchTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *SearchTool) Definition() tool.Definition
- func (t *SearchTool) Description(_ context.Context) (string, error)
- func (t *SearchTool) FormatResult(data any) string
- func (t *SearchTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *SearchTool) IsEnabled() bool
- func (t *SearchTool) IsReadOnly(_ map[string]any) bool
- func (t *SearchTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)
- type StoriesTool
- func (t *StoriesTool) BackfillInput(_ context.Context, input map[string]any) map[string]any
- func (t *StoriesTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *StoriesTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *StoriesTool) Definition() tool.Definition
- func (t *StoriesTool) Description(_ context.Context) (string, error)
- func (t *StoriesTool) FormatResult(data any) string
- func (t *StoriesTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *StoriesTool) IsEnabled() bool
- func (t *StoriesTool) IsReadOnly(_ map[string]any) bool
- func (t *StoriesTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)
Constants ¶
View Source
const ( StoriesToolName = "hn_stories" StoriesDisplayName = "Hacker News Stories" StoriesDescription = `` /* 179-byte string literal not displayed */ )
View Source
const ( ItemToolName = "hn_item" ItemDisplayName = "Hacker News Item" ItemDescription = `` /* 247-byte string literal not displayed */ )
View Source
const ( SearchToolName = "hn_search" SearchDisplayName = "Search Hacker News" SearchDescription = `` /* 254-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ItemTool ¶
type ItemTool struct{}
func NewItemTool ¶
func NewItemTool() *ItemTool
func (*ItemTool) BackfillInput ¶
func (*ItemTool) Call ¶
func (t *ItemTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*ItemTool) CheckPermissions ¶
func (t *ItemTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*ItemTool) Definition ¶
func (t *ItemTool) Definition() tool.Definition
func (*ItemTool) FormatResult ¶
type SearchTool ¶
type SearchTool struct{}
func NewSearchTool ¶
func NewSearchTool() *SearchTool
func (*SearchTool) BackfillInput ¶
func (*SearchTool) Call ¶
func (t *SearchTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*SearchTool) CheckPermissions ¶
func (t *SearchTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*SearchTool) Definition ¶
func (t *SearchTool) Definition() tool.Definition
func (*SearchTool) Description ¶
func (t *SearchTool) Description(_ context.Context) (string, error)
func (*SearchTool) FormatResult ¶
func (t *SearchTool) FormatResult(data any) string
func (*SearchTool) IsConcurrencySafe ¶
func (t *SearchTool) IsConcurrencySafe(_ map[string]any) bool
func (*SearchTool) IsEnabled ¶
func (t *SearchTool) IsEnabled() bool
func (*SearchTool) IsReadOnly ¶
func (t *SearchTool) IsReadOnly(_ map[string]any) bool
func (*SearchTool) ValidateInput ¶
type StoriesTool ¶
type StoriesTool struct{}
func NewStoriesTool ¶
func NewStoriesTool() *StoriesTool
func (*StoriesTool) BackfillInput ¶
func (*StoriesTool) Call ¶
func (t *StoriesTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*StoriesTool) CheckPermissions ¶
func (t *StoriesTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*StoriesTool) Definition ¶
func (t *StoriesTool) Definition() tool.Definition
func (*StoriesTool) Description ¶
func (t *StoriesTool) Description(_ context.Context) (string, error)
func (*StoriesTool) FormatResult ¶
func (t *StoriesTool) FormatResult(data any) string
func (*StoriesTool) IsConcurrencySafe ¶
func (t *StoriesTool) IsConcurrencySafe(_ map[string]any) bool
func (*StoriesTool) IsEnabled ¶
func (t *StoriesTool) IsEnabled() bool
func (*StoriesTool) IsReadOnly ¶
func (t *StoriesTool) IsReadOnly(_ map[string]any) bool
func (*StoriesTool) ValidateInput ¶
Click to show internal directories.
Click to hide internal directories.