hackernews

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package hackernews provides tools for the Hacker News public API.

No authentication required. Two APIs are used:

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

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 (t *ItemTool) BackfillInput(_ context.Context, input map[string]any) map[string]any

func (*ItemTool) Call

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) Description

func (t *ItemTool) Description(_ context.Context) (string, error)

func (*ItemTool) FormatResult

func (t *ItemTool) FormatResult(data any) string

func (*ItemTool) IsConcurrencySafe

func (t *ItemTool) IsConcurrencySafe(_ map[string]any) bool

func (*ItemTool) IsEnabled

func (t *ItemTool) IsEnabled() bool

func (*ItemTool) IsReadOnly

func (t *ItemTool) IsReadOnly(_ map[string]any) bool

func (*ItemTool) ValidateInput

func (t *ItemTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)

type SearchTool

type SearchTool struct{}

func NewSearchTool

func NewSearchTool() *SearchTool

func (*SearchTool) BackfillInput

func (t *SearchTool) BackfillInput(_ context.Context, input map[string]any) map[string]any

func (*SearchTool) Call

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

func (t *SearchTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)

type StoriesTool

type StoriesTool struct{}

func NewStoriesTool

func NewStoriesTool() *StoriesTool

func (*StoriesTool) BackfillInput

func (t *StoriesTool) BackfillInput(_ context.Context, input map[string]any) map[string]any

func (*StoriesTool) Call

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

func (t *StoriesTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)

Jump to

Keyboard shortcuts

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