Documentation
¶
Overview ¶
Package pdfwrite provides the write_pdf tool: creating a new PDF from plain/markdown-ish text, appending text as new page(s) to an existing PDF, and deleting pages from an existing PDF. Text layout (word-wrap, automatic pagination) is handled by go-pdf/fpdf, a pure-Go library that ships PDF's standard 14 fonts (Helvetica, Times, Courier) built in - no font file needs to be embedded in this binary, unlike TTF-based PDF libraries. Page-level operations (append, delete) reuse pdfcpu, already a seshat dependency (internal/tools/files/read/pdf.go uses it for page count/extraction).
Index ¶
- Constants
- type Tool
- func (t *Tool) BackfillInput(_ context.Context, input map[string]any) map[string]any
- func (t *Tool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *Tool) CheckPermissions(_ context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (t *Tool) Definition() tool.Definition
- func (t *Tool) Description(_ context.Context) (string, error)
- func (t *Tool) FormatResult(data any) string
- func (t *Tool) IsConcurrencySafe(_ map[string]any) bool
- func (t *Tool) IsEnabled() bool
- func (t *Tool) IsReadOnly(_ map[string]any) bool
- func (t *Tool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)
Constants ¶
View Source
const ( // ToolName is the name of the PDF write tool. ToolName = "write_pdf" // SearchHint is a hint for tool search functionality. SearchHint = "create a PDF from text, append pages, or delete pages" // ToolDescription is the description of the write_pdf tool. ToolDescription = "Create a new PDF from plain/markdown-ish text, append text as new page(s) to an existing PDF, or delete pages from an existing PDF.\n\n" + "## When to use\n\n" + "- Creating a new PDF — provide content; text wraps and paginates automatically, lines starting with \"#\".. \"######\" become headings\n" + "- Appending content to an existing PDF — provide content for an existing file; it's rendered and added as new page(s) at the end\n" + "- Deleting pages from an existing PDF — provide delete_pages (e.g. \"2\", \"2-4\", \"2,4-6\")\n\n" + "## When NOT to use\n\n" + "- Reading PDF content — use FileRead instead\n" + "- Editing existing text in place, images, or complex layout — this only appends/deletes whole pages, it cannot find/replace text inside a PDF (unlike docx_edit) because PDF text isn't addressable the same way\n\n" + "## Rules\n\n" + "- content and delete_pages are mutually exclusive in a single call.\n" + "- Modifying an existing file (content-append or delete_pages) requires it to have been read with FileRead first, same as other write tools.\n" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool implements the write_pdf tool.
func (*Tool) BackfillInput ¶
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(_ context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
func (*Tool) Definition ¶
func (t *Tool) Definition() tool.Definition
func (*Tool) FormatResult ¶
Click to show internal directories.
Click to hide internal directories.