docx

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

Documentation

Index

Constants

View Source
const (
	ToolName    = "docx"
	SearchHint  = "create or modify Word documents"
	DisplayName = "Docx"
)
View Source
const Description = `` /* 2563-byte string literal not displayed */

Variables

View Source
var ValidAlignments = []string{"left", "center", "right", "justify"}
View Source
var ValidColors = []string{
	"black", "white", "red", "blue", "green", "yellow",
	"purple", "orange", "pink", "gray", "cyan", "magenta",
}

Functions

func IsValidAlignment

func IsValidAlignment(alignment string) bool

func IsValidColor

func IsValidColor(color string) bool

Types

type Input

type Input struct {
	DocumentPath string `json:"document_path,omitempty"`
	Action       string `json:"action,omitempty"`
	Content      string `json:"content,omitempty"`
	Bold         bool   `json:"bold,omitempty"`
	Italic       bool   `json:"italic,omitempty"`
	Underline    bool   `json:"underline,omitempty"`
	Color        string `json:"color,omitempty"`
	FontSize     int    `json:"font_size,omitempty"`
	FontFamily   string `json:"font_family,omitempty"`
	Alignment    string `json:"alignment,omitempty"`
	TableData    string `json:"table_data,omitempty"`
	ImagePath    string `json:"image_path,omitempty"`
	ImageWidth   int    `json:"image_width,omitempty"`
	ImageHeight  int    `json:"image_height,omitempty"`
	Title        string `json:"title,omitempty"`
	Author       string `json:"author,omitempty"`
}

func (*Input) Validate

func (i *Input) Validate() error

type Output

type Output struct {
	DocumentPath string `json:"document_path,omitempty"`
	Success      bool   `json:"success"`
	Message      string `json:"message,omitempty"`
	Content      string `json:"content,omitempty"`
}

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

func NewDocxTool

func NewDocxTool(workingDir string) *Tool

func (*Tool) BackfillInput

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

func (*Tool) Call

func (t *Tool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)

func (*Tool) CheckPermissions

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

func (*Tool) Definition

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

func (*Tool) Description

func (t *Tool) Description(ctx context.Context) (string, error)

func (*Tool) FormatResult

func (t *Tool) FormatResult(result any) string

func (*Tool) IsConcurrencySafe

func (t *Tool) IsConcurrencySafe(input map[string]any) bool

func (*Tool) IsEnabled

func (t *Tool) IsEnabled() bool

func (*Tool) IsReadOnly

func (t *Tool) IsReadOnly(input map[string]any) bool

func (*Tool) ValidateInput

func (t *Tool) ValidateInput(ctx 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