Documentation
¶
Overview ¶
Package docling groups the explicit, agent-invocable tools built on docling-serve: read_document_url (fetch+convert a remote document) and docling_convert (convert a local file that native extraction can't handle well - scanned PDFs, complex slide decks, audio). Both are opt-in: the agent reaches for them deliberately, as opposed to internal/tools/files/read's own docling fallback, which stays in place so a scanned PDF or audio file still "just works" through plain FileRead without the agent needing to know docling exists.
Index ¶
- Constants
- type Config
- type ConvertTool
- func (t *ConvertTool) BackfillInput(_ context.Context, input map[string]any) map[string]any
- func (t *ConvertTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *ConvertTool) CheckPermissions(_ context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
- func (t *ConvertTool) Definition() tool.Definition
- func (t *ConvertTool) Description(_ context.Context) (string, error)
- func (t *ConvertTool) FormatResult(data any) string
- func (t *ConvertTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *ConvertTool) IsEnabled() bool
- func (t *ConvertTool) IsReadOnly(_ map[string]any) bool
- func (t *ConvertTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)
- type ReadURLTool
- func (t *ReadURLTool) BackfillInput(_ context.Context, input map[string]any) map[string]any
- func (t *ReadURLTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error)
- func (t *ReadURLTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *ReadURLTool) Definition() tool.Definition
- func (t *ReadURLTool) Description(_ context.Context) (string, error)
- func (t *ReadURLTool) FormatResult(data any) string
- func (t *ReadURLTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *ReadURLTool) IsEnabled() bool
- func (t *ReadURLTool) IsReadOnly(_ map[string]any) bool
- func (t *ReadURLTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error)
Constants ¶
const ( // ConvertToolName is the name of the docling_convert tool. ConvertToolName = "docling_convert" // ConvertDisplayName is the display name of the docling_convert tool. ConvertDisplayName = "Docling Convert" // ConvertSearchHint is a hint for tool search functionality. ConvertSearchHint = "OCR a scanned PDF, extract a complex slide deck, or transcribe audio via docling" // ConvertDescription is the description of the docling_convert tool. ConvertDescription = "Convert a local file to markdown using docling-serve: OCR, layout analysis, table structure, and audio transcription.\n\n" + "## When to use\n\n" + "- A scanned/image-only PDF that FileRead reports as having little or no extractable text\n" + "- A complex slide deck (PPTX) with diagrams, charts, or embedded images that need OCR\n" + "- Audio files (WAV, MP3) that need transcription\n" + "- A DOCX/PPTX/XLSX that FileRead's native extraction failed on\n\n" + "## When NOT to use\n\n" + "- Plain text-native PDFs, or simple DOCX/PPTX/XLSX — use FileRead instead, it extracts them natively without the network round-trip to docling-serve\n" + "- FileRead already tries docling automatically as a last resort for unreadable files, so you usually don't need this tool for a first read. Reach for it when you want deliberate control: forcing a reconversion, or converting a file FileRead didn't route to docling.\n\n" + "## Rules\n\n" + "- Requires docling-serve to be configured (DOCLING_URL).\n" )
const ( // ReadURLToolName is the name of the read_document_url tool. ReadURLToolName = "read_document_url" // ReadURLDisplayName is the display name of the read_document_url tool. ReadURLDisplayName = "Read Document URL" // ReadURLSearchHint is a hint for tool search functionality. ReadURLSearchHint = "fetch and convert a remote document or web page to markdown" // ReadURLDescription is the description of the read_document_url tool. ReadURLDescription = "Fetch a document at a URL and convert it to readable markdown. " + "Supports PDF, DOCX, PPTX, XLSX, HTML pages, and arXiv papers. " + "Requires docling-serve to be configured. " + "Optionally saves the extracted markdown to a workspace path." )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DoclingURL is the base URL of a running docling-serve instance.
// When empty, tools register but always report "not configured".
DoclingURL string
}
Config holds the shared configuration for every tool in this package.
type ConvertTool ¶
type ConvertTool struct {
// contains filtered or unexported fields
}
ConvertTool converts a local file to markdown via docling-serve.
func NewConvertTool ¶
func NewConvertTool(cfg Config, workingDir string) *ConvertTool
NewConvertTool creates a new docling_convert tool.
func (*ConvertTool) BackfillInput ¶
func (*ConvertTool) Call ¶
func (t *ConvertTool) Call( ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn, ) (tool.CallResult, error)
func (*ConvertTool) CheckPermissions ¶
func (t *ConvertTool) CheckPermissions(_ context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult
func (*ConvertTool) Definition ¶
func (t *ConvertTool) Definition() tool.Definition
func (*ConvertTool) Description ¶
func (t *ConvertTool) Description(_ context.Context) (string, error)
func (*ConvertTool) FormatResult ¶
func (t *ConvertTool) FormatResult(data any) string
func (*ConvertTool) IsConcurrencySafe ¶
func (t *ConvertTool) IsConcurrencySafe(_ map[string]any) bool
func (*ConvertTool) IsEnabled ¶
func (t *ConvertTool) IsEnabled() bool
func (*ConvertTool) IsReadOnly ¶
func (t *ConvertTool) IsReadOnly(_ map[string]any) bool
func (*ConvertTool) ValidateInput ¶
type ReadURLTool ¶
type ReadURLTool struct {
// contains filtered or unexported fields
}
ReadURLTool fetches a remote document and converts it to markdown via docling-serve.
func NewReadURLTool ¶
func NewReadURLTool(cfg Config) *ReadURLTool
NewReadURLTool creates a new read_document_url tool.
func (*ReadURLTool) BackfillInput ¶
func (*ReadURLTool) Call ¶
func (t *ReadURLTool) Call( ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn, ) (tool.CallResult, error)
func (*ReadURLTool) CheckPermissions ¶
func (t *ReadURLTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*ReadURLTool) Definition ¶
func (t *ReadURLTool) Definition() tool.Definition
func (*ReadURLTool) Description ¶
func (t *ReadURLTool) Description(_ context.Context) (string, error)
func (*ReadURLTool) FormatResult ¶
func (t *ReadURLTool) FormatResult(data any) string
func (*ReadURLTool) IsConcurrencySafe ¶
func (t *ReadURLTool) IsConcurrencySafe(_ map[string]any) bool
func (*ReadURLTool) IsEnabled ¶
func (t *ReadURLTool) IsEnabled() bool
func (*ReadURLTool) IsReadOnly ¶
func (t *ReadURLTool) IsReadOnly(_ map[string]any) bool