DocLens

v0.1.0
io.github.fendoushaonian/doclens Checked 23 hours ago Published 9 days ago

Reads PDF, Excel, Word and CSV for AI agents with table structure and exact numeric precision.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

list_documents

列出目录里 DocLens 能读的文件,附带大小和是否受支持。用于在批量处理前先摸清有哪些文档。

ParameterTypeDescription
directory *string要列出的目录路径
recursiveboolean是否递归子目录

read_document

读取一份文档,返回结构化的 Markdown:表格按行列对齐、金额保留原始精度、公式单独标注、正文按页标注。这是主工具,处理财务/合同/报表时优先用它。

ParameterTypeDescription
path *string文档的绝对路径或相对路径
max_charsinteger返回内容的最大字符数,超出会截断并提示如何继续

search_document

在文档里搜索文本,返回命中的页码和上下文。长文档不必整份读进来,先用它定位。

ParameterTypeDescription
path *string文档路径
query *string要查找的文本,不区分大小写
context_charsinteger命中处前后各保留多少字符
limitinteger最多返回多少条命中

extract_table

只读取指定序号的那一张表,输出完整 Markdown 表格。文档里表格很多时用它,避免整份读进来。序号从 1 开始。

ParameterTypeDescription
path *string文档路径
indexinteger表序号,从 1 开始

inspect_document

诊断一份文档的解析质量:表格是否完整、有没有数字被降级成文本、有没有扫描页缺文字层、有没有公式缺缓存值。在把解析结果用于重要决策之前跑一次,能提前发现读错的风险。

ParameterTypeDescription
path *string文档路径

compare_extraction

把 DocLens 的表格还原结果与「朴素文本流」抽取的结果并排给出,用于判断这份文档如果不做结构还原会错在哪里。适合在向别人解释这份工具的必要性时用。

ParameterTypeDescription
path *string文档路径
indexinteger第几张表,从 1 开始