Skip to main content
Glama

glm-ocr-mcp — GLM-OCR 文档识别工具(PDF/图片 → Markdown)

无纸化学习大部头教材的首选工具:可把上百 MB、几百页的扫描版经典教材 整体 OCR 成 Markdown,按章节拆分归档, 再配合 Obsidian + DSH 等 AI 助手随时检索、提问、做笔记。

基于智谱 GLM-OCR(官方 glmocr SDK,MaaS 云端模式)的本地工具包,提供 CLI / HTTP / MCP 三个入口,把图片与 PDF(含扫描版大书)识别为 Markdown,供 AI Agent 或其他程序随时调用。

核心特性

  • 📄 PDF → Markdown:自动按 8 页/片切分、逐片识别后合并,支持页码范围(3-10),临时文件用后即删

  • 📚 大部头教材专用:上百 MB / 几百页扫描书整本识别;配合 add_bookmarks.py + chapter2md.py 按书签逐章拆分输出,Obsidian 笔记库 + DSH 等 AI 助手无缝接入

  • 🖼️ 图片 OCR:本地路径 / http(s) URL / data URI,多格式(png / jpg / jpeg / webp / bmp / tiff / gif)

  • 📏 长条图片切片:超长截图(聊天记录、网页长图、试卷长图)自动切片识别,按单元格/行粒度去重重叠区

  • ⏱️ 进度反馈:超大 PDF 切片后即告知片数与预计用时,识别期间持续汇报百分比 / 已用时间 / 预计剩余;支持中途取消

  • 🔌 MCP 服务器(stdio):供 ZCode / Claude Desktop / Claude Code / Cursor / Obsidian DSH 等 MCP 客户端直接调用

  • 即用即走:CLI 无常驻进程,进程做完即退;API Key 支持 ZHIPU_API_KEY 环境变量或 config.json

典型场景:大部头教材的无纸化学习

软件工程经典教材(计算机网络、计算机组成原理、操作系统等)动辄几百页、上百 MB: 纸质书又厚又重,扫描版 PDF 无法检索、没法做笔记,"把代码印在纸上"的大部头更是 翻到崩溃。本工具专为此设计,一条龙完成数字化:

  1. 整书 OCRocr pdf "计网.pdf" 一把梭——上百 MB / 几百页自动分片识别, 跑的过程中持续报告进度(片数 / 百分比 / 预计剩余时间),跑完得到整本书的 Markdown

  2. 按章节拆分:扫描书先 add_bookmarks.py 注入目录书签,再 chapter2md.py 按章节输出独立 .md(每章一个文件 + 图片目录),已完成的章节自动跳过、可断点续跑

  3. 归档进 Obsidian:把各章 .md 放进笔记库,图片引用自动重命名、跨章不冲突

  4. 随时 AI 检索:通过 MCP 服务器接入 DSH 等 AI 助手——问"第三章讲了什么"、 复述某个算法的伪代码、生成课后习题解答,AI 直接基于 OCR 好的章节内容作答

从此告别抱着几百页纸翻找,一份 Markdown 笔记库随身带。

Related MCP server: document-parser

安装

要求 Python ≥ 3.10。

pip install glmocr mcp fastapi uvicorn pymupdf pillow requests
# 或安装本仓库(推荐,会获得 ocr / ocr-server / ocr-mcp 三个命令):
pip install -e .

配置

API Key 在 open.bigmodel.cn 控制台「API Keys」创建,二选一填入:

方式 1(推荐):环境变量

# Linux / macOS
export ZHIPU_API_KEY=你的密钥
# Windows CMD
set ZHIPU_API_KEY=你的密钥
# Windows PowerShell
$env:ZHIPU_API_KEY = "你的密钥"

方式 2:config.json(一次配置永久生效;MCP 场景最稳)

cp ocr_agent/config.example.json ocr_agent/config.json
# 编辑 ocr_agent/config.json,把 "api_key": "" 填成自己的密钥

CLI / HTTP / MCP 三个入口都从 ocr_agent/config.json 读取同一个 key(文件不存在时首次运行会自动生成,含自动生成的 http_token,直接编辑 api_key 即可)。

优先级:ZHIPU_API_KEY / GLMOCR_API_KEY 环境变量 覆盖 config.json。验证方式:ocr doctor,看到 api_key: OK (已配置,52e25a...vrix) 即生效。

MCP 场景:key 填在 config.json 则开箱即用(按模块位置解析,与启动目录无关);若用环境变量,需保证启动 MCP 客户端的进程环境里有该变量。config.json 已加入 .gitignore,切勿提交。

CLI 用法(主路径,无常驻)

ocr doctor                          # 环境自检
ocr image "截图.png"                # 图片 OCR → stdout Markdown
ocr image "截图.png" --json         # 输出完整 JSON(含区域级 json_result)
ocr pdf "扫描书.pdf"                # PDF OCR(自动分片)
ocr pdf "扫描书.pdf" --pages 3-10   # 指定页码(1-indexed 闭区间)
ocr pdf "扫描书.pdf" -o 笔记.md     # 另存 Markdown
ocr serve --port 8765               # 可选:启动本地 HTTP 服务(常驻)

输出约定(AI 解析用):stdout 为 Markdown 正文(--json 时为完整 JSON);stderr 为 JSON 状态行;退出码 0 成功 / 1 失败。

进度输出(CLI)

ocr pdf 处理大文件时,stderr 会输出进度 JSON 行:

{"status":"processing","kind":"pdf","event":"chunked","chunk_count":25,"pages":[1,446],"total_pages":446,"estimated_seconds":1500}
{"status":"processing","kind":"pdf","event":"chunk_start","chunk":3,"chunk_count":25,"percent":8.0,"elapsed_seconds":220,"eta_seconds":1320}
{"status":"processing","kind":"pdf","event":"heartbeat","chunk":3,"chunk_count":25,"percent":8.0,"elapsed_seconds":300,"eta_seconds":1240}
{"status":"processing","kind":"pdf","event":"chunk_done","chunk":3,"chunk_count":25,"percent":12.0,"elapsed_seconds":330,"eta_seconds":1180,"chunk_seconds":110.2}
  • chunked:切片完成,告知片数与预计用时(首片按 pdf_eta_seconds_per_chunk 估算,之后按实测自动修正)

  • chunk_start / chunk_done:每片开始/完成,带 percent / elapsed_seconds / eta_seconds

  • heartbeat:单片耗时超过 60 秒时每 60s 补一行,避免长时间无输出

HTTP 服务(可选,常驻)

ocr-server            # 或 python ocr_agent/server.py

启动后提供(全部业务端点需 Authorization: Bearer <http_token>,token 在 config.json,首次运行自动生成):

端点

说明

GET /health

健康检查(公开)

POST /v1/chat/completions

OpenAI 兼容(image_url → OCR Markdown)

POST /api/v1/ocr/image

{path|url|base64}{status, markdown, json_result}

POST /api/v1/ocr/pdf

同步 PDF OCR(40 页上限,超大文件请用异步端点或 CLI)

POST /api/v1/ocr/pdf/async

异步任务{path, pages}{task_id}(无页数上限)

GET /api/v1/ocr/tasks/{id}

查询任务进度(percent / eta / elapsed / chunk / status)

DELETE /api/v1/ocr/tasks/{id}

取消任务(分片边界生效)

异步示例:

TOKEN=$(python -c "import json;print(json.load(open('ocr_agent/config.json'))['http_token'])")
curl -s -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"path":"D:/书.pdf","pages":"all"}' http://127.0.0.1:8765/api/v1/ocr/pdf/async
# -> {"task_id":"ab12cd34ef56", ...}
curl -s -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8765/api/v1/ocr/tasks/ab12cd34ef56
# -> {"status":"running","percent":36.0,"chunk":9,"chunk_count":25,"eta_seconds":960, ...}

MCP 服务器(推荐,供各类 Agent 调用)

ocr-mcp               # 或 python ocr_agent/mcp_server.py(stdio,由 MCP 客户端拉起)

工具列表:

工具

说明

ocr_image(source)

单张图片 OCR → Markdown

ocr_pdf(path, pages)

PDF OCR(小文件直接调用;客户端传 progressToken 时推送标准进度通知)

ocr_long_image(source, slice_height?, overlap?)

长条图片切片识别

start_pdf_ocr(path, pages)

异步启动 PDF OCR,立即返回 task_id(超大 PDF 用,不阻塞)

get_ocr_status(task_id)

查询任务进度(percent / eta / elapsed / chunk / message,done 时含 markdown)

cancel_ocr_task(task_id)

取消任务(分片边界生效)

doctor()

环境自检

超大 PDF 的推荐调用方式start_pdf_ocr 拿到 task_id → 每隔 1–5 分钟调 get_ocr_status 并向用户汇报百分比与预计剩余时间 → 完成取结果(或中途 cancel_ocr_task)。

注册示例(把 <项目路径> 换成实际路径):

{
  "mcpServers": {
    "glm-ocr": {
      "command": "python",
      "args": ["<项目路径>/ocr_agent/mcp_server.py"]
    }
  }
}
  • ZCode:写入 <项目路径>/.zcode/config.jsonmcp.servers.glm-ocr(工作区级,打开自动连接)

  • Claude Code / Cursor.mcp.json(仓库根,已被 .gitignore 排除,请按各自客户端文档配置)

长条图片切片(ocr_long_image)

超长截图直接提交会超过 GLM-OCR 接口的图片尺寸限制。ocr_long_image 自动处理:读取多格式图片 → 任一维度超过 slice_height(默认 3000px)时沿超限轴切片(相邻重叠 200px)→ 逐片识别 → 按单元格/行粒度去重重叠区(GLM-OCR 会把连续文本渲染成 HTML 表格,已按表格单元格处理)。

返回 {"status":"ok","markdown","size","chunk_count","chunks":[{index,x,y,markdown}]}chunks[].x/y 为切片在原图中的像素坐标。参数可在调用时传,也可在 config.json 配置 slicing_slice_height / slicing_overlap

扫描书工作流工具

针对扫描版教材的辅助脚本(位于仓库根,与本包相对独立):

脚本

说明

chapter2md.py

按 PDF 书签逐章转换:每章独立目录输出 .md + 图片,已存在章节自动跳过(--force 重做)

add_bookmarks.py

为无书签的扫描 PDF 注入目录书签(供 chapter2md 按章切分)

fix_md_formulas.py

对生成的 Markdown 做公式/格式后处理

配置项(ocr_agent/config.json)

字段

默认

说明

api_key

智谱 API Key,可被 ZHIPU_API_KEY 环境变量覆盖

http_port / http_token

8765 / 自动生成

HTTP 服务端口与 Bearer token

timeout

600

单次 API 调用超时(秒)

pages_per_chunk

8

PDF 每分片页数

pdf_max_pages_http

40

HTTP 同步端点的页数上限

retries

2

失败重试次数(指数退避)

pdf_eta_seconds_per_chunk

60

大 PDF 预计用时初值(每片秒数,实测后自动修正)

slicing_slice_height / slicing_overlap

3000 / 200

长条图片切片参数(像素)

测试

python ocr_agent/test_ocr.py          # 图片/PDF OCR 冒烟(真实 API)
python ocr_agent/test_slicing.py      # 长条图片切片 + 多格式(真实 API)
python ocr_agent/test_mcp.py --api    # MCP 服务器 + 异步任务端到端(真实 API)
python ocr_agent/test_progress.py     # 进度事件 / 取消 / 任务生命周期 / CLI / HTTP(真实 API)

未配置 API Key 时测试自动跳过(ZHIPU_API_KEY 或 config.json)。真实 API 用例会消耗少量额度。

开源说明

  • 本仓库基于 zai-org/GLM-OCR 官方 SDK(glmocr,MIT),云端模式调用,无需 GPU

  • 模型:GLM-OCR(open.bigmodel.cn 获取 API Key)

  • 本仓库 License:MIT

常见问题

  • 提示缺少 API Key:设置 ZHIPU_API_KEY 环境变量,或填写 ocr_agent/config.jsonapi_key

  • 大 PDF 超时:HTTP 同步端点限 40 页;整本请用 CLI(ocr pdf)或异步端点/start_pdf_ocr

  • 图片过小被拒(错误 1214):GLM-OCR 接口对最小尺寸有要求,截图类图片不受影响

  • 长截图识别:用 ocr_long_image(自动切片)或 slicing.slice_and_ocr()

  • 识别太慢没输出:看 stderr 的进度行;用异步任务(MCP start_pdf_ocr / HTTP /api/v1/ocr/pdf/async)可随时查询

Available Tools

7 tools
cancel_ocr_taskA

取消异步 OCR 任务(在当前分片结束后生效,已识别内容不返回)。

ParametersJSON Schema
NameRequiredDescriptionDefault
task_idYes

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the disclosure burden. It is transparent about the non-obvious delay ('在当前分片结束后生效') and the data-loss consequence ('已识别内容不返回'). It does not cover idempotency or invalid-task behavior, but for a simple cancellation tool this is still strong disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single compact sentence front-loads the core action and packs the crucial timing and content-return caveats into a parenthetical. Every element earns its place with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the single required parameter, no output schema, and no annotations, the description covers the essential behavior: what is canceled, when cancellation takes effect, and what is not returned. It could additionally suggest confirming via get_ocr_status or describing already-completed task behavior, but those are minor gaps for this tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does not explain the task_id parameter format, provenance, or validation. The property name is self-descriptive, and the tool name ties it to the OCR task, but the description itself adds no parameter-level meaning to compensate for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific verb ('取消' / cancel) and resource ('异步 OCR 任务'), and adds precise behavioral detail about when it takes effect and what happens to recognized content. This differentiates it from siblings like start_pdf_ocr and get_ocr_status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for stopping an in-progress asynchronous OCR task, and the parenthetical distinguishes it from immediate-cancel semantics. However, it does not explicitly name alternatives or state when not to use this tool, leaving routing to inference from sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

doctorA

环境自检:依赖、API Key 配置是否就绪(不调用 OCR API)。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of behavioral disclosure. It clearly reveals that the tool performs environment checking and does not call the OCR API, which signals read-only, non-destructive behavior. It does not describe response semantics or failure behavior, but for a no-parameter self-check this is reasonably transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence that conveys the core purpose, the specific check targets, and a key exclusion. No wasted words, every element adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter self-check tool, the description is essentially complete: the agent knows what it does and what it does not do. The main gap is that no output or return behavior is described, but given the tool's simplicity and the absence of an output schema, this is a minor omission.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters with 100% description coverage, so there is nothing to explain. Per the baseline for zero-parameter tools, a score of 4 is appropriate; the description correctly focuses on behavior rather than parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: performing an environment self-check on dependencies and API key configuration. It explicitly says '不调用 OCR API' (does not call OCR API), which distinguishes it from the sibling OCR tools with no ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this is a preflight check for OCR-related tasks by stating it verifies dependencies and API keys without invoking the OCR API. However, it does not explicitly say when to use this tool versus starting an OCR job or checking status, so the usage context is only implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_ocr_statusA

查询异步 OCR 任务进度。

返回 {task_id, status(queued/running/done/error/cancelled), percent, chunk, chunk_count, elapsed_seconds, eta_seconds, message, error, result(仅 done 时,含 markdown)};任务不存在返回 {"status":"error"}。 建议在任务运行期间每隔 1-5 分钟查询一次并向用户汇报进度。

ParametersJSON Schema
NameRequiredDescriptionDefault
task_idYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral disclosure burden. It thoroughly documents the return payload, enumerates possible statuses, clarifies that result appears only when status is done, and defines the error response for nonexistent tasks. It does not explicitly state that the call has no side effects, but a status query is inherently read-only and the description covers key edge cases.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and well-organized: a one-line purpose, a concise return contract, and a usage recommendation. It is front-loaded and every sentence adds value without filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a status-polling tool with no output schema and no annotations, the description is quite complete: it covers return shape, statuses, error behavior, and polling cadence. Minor omissions include not explicitly linking task_id to start_pdf_ocr and not stating what to do after completion, but these are inferable from sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has one parameter, task_id, with 0% description coverage. The description mentions task_id in the return object but does not explain its origin (e.g., from start_pdf_ocr) or any format constraints. Since the parameter is self-explanatory by name, the gap is modest, but the description does not compensate for the low schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb and resource: '查询异步 OCR 任务进度' (query async OCR task progress). This distinguishes it from sibling tools like start_pdf_ocr and cancel_ocr_task, which are action-oriented, while this one is a status polling tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit usage context: it recommends polling every 1-5 minutes while a task is running and reporting progress to the user. It does not explicitly mention alternatives or when not to use it, but the polling guidance makes the intended usage clear enough.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ocr_imageA

OCR 单张图片并返回 Markdown。

source 支持:本地文件路径(如 D:/a.png)、file:// URL、 http(s) URL、data URI(data:image/png;base64,...)。 返回 {"status":"ok", "markdown":..., "json_result":[...], "usage":...}; 失败时 status="error" 并附 error 信息。

ParametersJSON Schema
NameRequiredDescriptionDefault
sourceYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral burden and it does so substantially: it lists supported source formats (local path, file://, http(s), data URI) and specifies the success/error response shape. It doesn't mention side effects or permissions, but the operation is naturally read-only and the return/error contract is disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences front-load the core purpose, then cover input formats and response contract without repetition or filler. Every sentence adds necessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter OCR tool with no output schema, the description provides the essential invocation and response information, including error behavior. It does not mention limits such as file size or sync/async behavior, but these are not critical for basic correct use and are reasonable gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description is the only source of parameter meaning. It fully explains what 'source' can be with concrete examples for all four accepted formats, going far beyond the bare string type.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'OCR single image' and return Markdown. '单张' (single) distinguishes it from siblings like ocr_pdf and ocr_long_image, so an agent can tell them apart.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The intended use case (single image OCR) is clear from the purpose statement, but there is no explicit guidance on when to prefer this tool over siblings such as ocr_pdf or ocr_long_image, or when not to use it. This is implied rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ocr_long_imageA

长条图片切片识别并返回 Markdown。

适用于超长截图(聊天记录、网页长图、试卷长图等):图片任一维度超过 slice_height(默认 3000 像素,可调)时,自动沿超限轴切成多条带重叠的 切片,逐条 OCR 后按行级重叠去重合并,避免切分处文字截断或重复。 slice_height 与 overlap 均可不传(取 config.json 配置,默认 3000/200)。 source 支持:本地路径 / http(s) URL / data URI,格式 png/jpg/jpeg/ webp/bmp/tiff/gif 等。返回 {"status":"ok", "markdown":..., "size":{...}, "chunk_count":..., "chunks":[{index,x,y,markdown,...}]}。

ParametersJSON Schema
NameRequiredDescriptionDefault
sourceYes
overlapNo
slice_heightNo

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full responsibility and does so thoroughly. It discloses the slicing algorithm, overlap and deduplication behavior, config fallback defaults, supported URI schemes and file formats, and the JSON response structure. These are meaningful behavioral details beyond what the tool name alone conveys.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with a one-sentence summary, then logically moves through use cases, algorithm, parameters, accepted inputs, and return format. Every sentence adds necessary information and there is no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description is remarkably complete. It covers input types, slicing threshold and defaults, merging behavior, supported formats, and the full return contract sketch. Nothing essential for selecting or invoking this tool is left unstated.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does: source is explained with URI schemes and image formats, slice_height is explained as the pixel threshold with a default, and overlap is explained through the overlap/deduplication context with a config default. An agent can correctly understand all three parameters from the description alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb-plus-resource statement: slice a long image, recognize text, and return Markdown. It further distinguishes itself from sibling OCR tools by explicitly targeting ultra-long screenshots and chunked OCR processing, so an agent can tell it apart from ocr_image or ocr_pdf.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It clearly states when to use the tool: for very long images such as chat screenshots, web page long images, and exam paper images, and explains the automatic slicing trigger when any dimension exceeds slice_height. It does not explicitly name alternatives or say when not to use sibling tools, so it lacks the final exclusions step.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ocr_pdfA

OCR PDF 文件并返回 Markdown(小文件直接调用;超大 PDF 建议用 start_pdf_ocr 异步执行)。

path 为本地 PDF 文件路径;pages 为页码范围(1-indexed 闭区间): "all" 全部、"5" 第 5 页、"3-10" 第 3~10 页。 大文件自动按每片 8 页切分、逐片识别后合并,临时文件用后即删。 识别期间通过 MCP 进度通知推送百分比与预计剩余时间(客户端需在调用时 附带 progressToken 才能收到)。 返回 {"status":"ok", "markdown":..., "pages":[...], "chunk_count":..., "usage":...}。

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
pagesNoall

TDQS

A5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavior itself, and it does thoroughly: automatic 8-page chunking, merge behavior, temp-file cleanup, progress notifications, and the progressToken requirement are all stated. It even previews the response shape, going well beyond what the schema provides.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The text is compact and front-loaded: purpose first, then routing advice, then parameter syntax, then runtime behavior and return format. Every clause contributes useful information with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Since there is no output schema, the description provides the full JSON return structure. For a two-parameter tool with chunking, progress, and cleanup behaviors, all the context needed to invoke it correctly is present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description needed to carry parameter meaning, and it did. It defines path as a local PDF file path and pages with concrete 1-indexed closed-interval examples: all, 5, and 3-10. This fully compensates for the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a concrete action and resource: OCR a PDF file and return Markdown. It also explicitly addresses the main sibling by directing very large PDFs to start_pdf_ocr, so the tool's scope is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit when-to-use guidance: small files should call this tool directly, while very large PDFs should use the async sibling start_pdf_ocr. It also defines valid page-range syntax, giving an agent concrete invocation conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

start_pdf_ocrA

异步启动 PDF OCR,立即返回 task_id(适用于超大 PDF,避免长时间阻塞调用)。

任务在后台执行,用 get_ocr_status(task_id) 随时查询进度(percent / eta_seconds / elapsed_seconds / chunk / chunk_count / message),完成后 record 的 result 字段包含 markdown;不需要时可用 cancel_ocr_task 取消。

ParametersJSON Schema
NameRequiredDescriptionDefault
pathYes
pagesNoall

TDQS

A4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

没有任何 annotations,描述承担了全部行为披露义务。它清楚说明了异步后台执行、立即返回、可查询的进度字段、完成后的 result 字段内容,以及可取消。这些信息远超基本操作定义,能帮助 agent 正确预期副作用和后续流程。

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

描述紧凑但信息密度高,第一句就给出核心行为和返回值,第二段补充了进度查询、结果形态和取消方式。没有冗余内容,结构也便于 agent 快速解析。

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

异步任务的生命周期(启动、查询、取消、结果获取)描述得比较完整,且与兄弟工具衔接明确。但 pages 参数格式完全未说明,且没有输出 schema,导致 agent 在参数构造和返回值细节上仍存在明显缺口。

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage 为 0%,描述完全没有补偿参数语义。path 和 pages 两个参数均未说明格式、取值范围或示例,尤其是 pages 的可选值(如页码范围写法)完全缺失,agent 无法仅凭描述正确构造参数。

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

描述明确指出“异步启动 PDF OCR 并立即返回 task_id”,动词和资源清晰,且与同步 OCR 或图片 OCR 等兄弟工具在用途上有了明确区分。开头的“异步”和“超大 PDF”进一步强化了工具定位。

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

描述说明了适用场景(超大 PDF,避免长时间阻塞),并明确指引使用 get_ocr_status 查询进度、用 cancel_ocr_task 取消任务。虽然没有显式说明何时不应使用本工具,但已提供了清晰的上下文和操作路径。

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.2/5.0
Disambiguation4/5

Each tool has a clear function: image OCR, long-image OCR, PDF OCR, async task management, and health check. The only potential overlap is ocr_pdf vs start_pdf_ocr, but their descriptions differentiate by synchronous vs asynchronous execution.

Naming Consistency4/5

Most tools follow a recognizable verb_noun pattern: ocr_image, ocr_pdf, get_ocr_status, cancel_ocr_task, start_pdf_ocr. The outlier is 'doctor', which breaks the pattern but is still an understandable command-style name.

Tool Count5/5

Seven tools is well-scoped for an OCR server: it covers the main input types (image, long image, PDF), both sync and async PDF paths, task status, cancellation, and environment self-check. No tool feels redundant or missing.

Completeness5/5

The tool surface covers the core OCR domain well: images, long images, PDFs with page ranges, async task lifecycle, and configuration readiness. There are no obvious dead ends for common OCR workflows.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/stellarum-J/glm-ocr-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server