twitter

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: 6 Imported by: 0

Documentation

Overview

Package twitter provides tools for Twitter/X via the v2 API.

Authentication: Bearer token (read-only) or OAuth 1.0a (read+write). Required env vars:

TWITTER_BEARER_TOKEN   — for search and read (required)
TWITTER_API_KEY        — for posting (OAuth 1.0a)
TWITTER_API_SECRET     — for posting
TWITTER_ACCESS_TOKEN   — for posting
TWITTER_ACCESS_SECRET  — for posting

NOTE: Twitter API v2 free tier (2025) is severely limited:

  • Read: 500k tweets/month, only recent search (last 7 days)
  • Write: 500 posts/month
  • Basic tier ($100/month) unlocks more

Tools planned (see GitHub issue):

twitter_search   — search recent tweets (last 7 days)
twitter_timeline — fetch a user's recent timeline
twitter_tweet    — post a tweet (requires OAuth 1.0a)
twitter_thread   — post a thread of connected tweets

Index

Constants

View Source
const (
	SearchToolName    = "twitter_search"
	SearchDisplayName = "Search Twitter/X"
	SearchDescription = `` /* 352-byte string literal not displayed */

)
View Source
const (
	TweetToolName    = "twitter_tweet"
	TweetDisplayName = "Post Tweet"
	TweetDescription = `` /* 311-byte string literal not displayed */

)

Variables

View Source
var ErrNotImplemented = errors.New("twitter tools: not implemented — see GitHub issue")

ErrNotImplemented is returned by all Twitter tools until the API client is complete (see GitHub issue). The API cost model should be considered before implementing — basic tier required for serious usage.

Functions

This section is empty.

Types

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 TweetTool

type TweetTool struct{}

func NewTweetTool

func NewTweetTool() *TweetTool

func (*TweetTool) BackfillInput

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

func (*TweetTool) Call

func (*TweetTool) CheckPermissions

func (t *TweetTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult

func (*TweetTool) Definition

func (t *TweetTool) Definition() tool.Definition

func (*TweetTool) Description

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

func (*TweetTool) FormatResult

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

func (*TweetTool) IsConcurrencySafe

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

func (*TweetTool) IsEnabled

func (t *TweetTool) IsEnabled() bool

func (*TweetTool) IsReadOnly

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

func (*TweetTool) ValidateInput

func (t *TweetTool) 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