Skip to main content
Glama

batch_citation_audit

Read-onlyIdempotent

ตรวจการอ้างอิงมาตรา/ฎีกาทุกจุดในเอกสารเดียวรวดเดียว (คำฟ้อง/สัญญา/บันทึกความเห็น) — เฉพาะแพ็กเกจ Pro. ผลคือ "มีอยู่จริง + เป็นฉบับปัจจุบันไหม" ทีละจุด ไม่ใช่การตรวจเหตุผลทางกฎหมาย และไม่ตัดสินทิศทางคำวินิจฉัย การอ้างอิงเดียว → verify_citation (ใช้ได้ทุกแพ็กเกจ และรับกฎหมายฉบับใดก็ได้ในคลัง)

ต้นทุน: นับโควตา 1 ครั้งต่อการอ้างอิงที่ไม่ซ้ำ (สูงสุด 50 ต่อการเรียก, ขั้นต่ำ 1) หักครั้งเดียวก่อนตรวจ — โควตาไม่พอทั้งก้อน = ปฏิเสธทั้งครั้งโดยไม่หัก · ไม่คืนโควตาเมื่อหยุดก่อนกำหนด (stopped_early) หรือเมื่อบริการฎีกา ปิดชั่วคราว (ฎีกาได้ cannot_verify แต่มาตรายังตรวจได้) · ผู้ใช้ที่ไม่ใช่ Pro ถูกปฏิเสธก่อนหักโควตา

การจับชื่อกฎหมาย: สแกน "มาตรา N" (รวม "มาตรา 288, 289 และ 297 ประกอบมาตรา 83") + "ฎีกาที่ N/ปี" และผูกมาตรา เปล่ากับชื่อกฎหมายที่ระบุล่าสุดได้ 21 ฉบับ — ประมวลกฎหมายทั้ง 8 ฉบับ (ป.พ.พ./ป.วิ.พ./ป.อ./ป.วิ.อ./รัษฎากร/ที่ดิน/ ยาเสพติด/อาญาทหาร) + พ.ร.บ. ที่ฎีกาอ้างบ่อยและไม่กำกวม 13 ฉบับ (เช่น คุ้มครองแรงงาน ล้มละลาย ป่าไม้ ควบคุมอาคาร) · ไม่เดาเมื่อ: ไม่มีชื่อกฎหมายนำหน้า, กฎหมายนอก 21 ฉบับ, พ.ร.บ. ที่มีหลายฉบับต่างปี (ศุลกากร เช็ค ลิขสิทธิ์ ฯลฯ), ชื่อฉบับแก้ไข "(ฉบับที่ N)" หรือกฎหมายลำดับรอง → status="cannot_verify", reason="unresolved_law_name" — ถ้ารู้ law_code ให้เรียก verify_citation เอง

อ่านผล (citations[] ละรายการ):

  • status "verified" | "verified_title_marked_repealed" (พบจริง แต่ชื่อฉบับมี "(ยกเลิก)" — แนะนำให้ตรวจ source_url) | "not_found" | "cannot_verify" · retryable=true = อาจเป็นเหตุชั่วคราว ให้ลองใหม่เฉพาะรายการนั้นด้วย verify_citation (1 หน่วย) ห้ามส่งทั้งเอกสารซ้ำ (หักทุกรายการอีกรอบ) และไม่ควรวนซ้ำ not_found · false = ต้องตรวจเอง

  • status="not_found" ไม่ใช่ข้อสรุปว่าอ้างอิงนั้นปลอม = "ไม่พบในคลังที่ตรวจได้" เท่านั้น (คลังฎีกาไม่ครบทุกฉบับ / มาตราไม่มีในฉบับล่าสุดแต่อาจมีในฉบับเก่า) — ห้ามบอกผู้ใช้ว่า "ไม่มีอยู่จริง" ให้ตรวจต้นฉบับก่อนตัดทิ้ง

  • reason="section_not_found_in_this_version" → เรียก get_law_versions(law_code, unit_label="มาตรา " + section) ต้องเติม "มาตรา " นำหน้าเสมอ (section ที่คืนเป็นเลขเปล่า)

  • law ส่งต่อ deka_by_section(law=...) ได้ตรงๆ · timeline_code = ฉบับล่าสุดเสมอ ไม่ใช่ฉบับ ณ วันที่ของเอกสาร

  • unique_citation_limit_exceeded=true = เกิน 50 จุด ตรวจตามลำดับที่ปรากฏ ส่วนที่เหลือเรียกซ้ำกับเนื้อหาที่เหลือ · stopped_early=true = หมดเวลา คืนผลบางส่วนที่ตรวจเสร็จแล้ว · extractor_capped=true = citation ดิบเกิน 200 จุด ส่วนท้ายเอกสารไม่ถูกสกัด/ตรวจเลย — บอกผู้ใช้ว่าตรวจไม่ครบ และให้แบ่งเอกสารส่งใหม่

  • error หมดเวลา (ไม่ใช่ stopped_early) เกิดหลังหักโควตาแล้วและไม่คืน — ลองใหม่ = หักอีกรอบ ควรแบ่งเอกสารให้สั้นลงก่อน · error "มีคำขอ…จำนวนมาก" (รอคิว) เกิดก่อนหักโควตา ลองใหม่ได้โดยไม่เสียโควตา

  • evidence_snippet ของฎีกาตัดมาจาก full_text อาจมีชื่อจริงคู่ความ — ทำตาม deka_privacy_note ก่อนคัดลงเอกสาร

Input Schema

NameRequiredDescriptionDefault
document_textYesเนื้อหาเอกสารเต็มแบบข้อความล้วน (คำฟ้อง/คำให้การ/สัญญา/บันทึกความเห็น) 1–50,000 ตัวอักษร — เอกสารยาวกว่านั้นให้แบ่งส่ง · ว่าง/ยาวเกินถูกปฏิเสธก่อนตรวจสิทธิ์ Pro และก่อนหักโควตา

Output Schema

NameRequiredDescriptionDefault
quotaNo
citationsNo
disclaimerNo
attributionNo
stopped_earlyNo
not_found_noteNo
extractor_cappedNo
citations_checkedNo
deka_privacy_noteNo
stopped_early_messageNo
total_citations_foundNo
unique_citation_limit_exceededNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / document_text / description
      Previous value: -"เนื้อหาเอกสารเต็ม (คำฟ้อง/คำให้การ/สัญญา/บันทึกความเห็นฯลฯ) ที่ต้องการตรวจการอ้างอิงกฎหมาย/คำพิพากษาฎีกาทุกจุดรวดเดียว — สูงสุด 50,000 ตัวอักษร (ว่างเปล่า/ยาวเกิน → ValueError ก่อนเช็ค tier/quota ใดๆ)"New value: +"เนื้อหาเอกสารเต็มแบบข้อความล้วน (คำฟ้อง/คำให้การ/สัญญา/บันทึกความเห็น) 1–50,000 ตัวอักษร — เอกสารยาวกว่านั้นให้แบ่งส่ง · ว่าง/ยาวเกินถูกปฏิเสธก่อนตรวจสิทธิ์ Pro และก่อนหักโควตา"
  2. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes far beyond the annotations: quota accounting (1 per unique citation, max 50, min 1, deducted before the run), no refund on stopped_early, database outage yields cannot_verify while sections still get checked, non-Pro rejected before deduction, and the distinction between timeout errors (already charged) and queue errors (not charged). It even warns that not_found is not proof of a fake citation. Minor tension: idempotentHint=true while each re-run consumes quota again, but that is metering rather than resource mutation, so it is not a hard contradiction.

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

Conciseness4/5

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

Front-loaded with purpose, then the Pro gate, then the verify_citation alternative, then cost and result semantics in short line-per-idea blocks. It is long, and the enumeration of the 21 resolved law codes reads more like reference material than selection guidance, but nearly every line carries operational value for a high-stakes tool.

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?

Given the complexity, an output schema, and quota consequences, the description covers everything an agent needs: which statuses exist and what each means, retry policy (retry only the individual item, never resend the whole document), truncation/nesting flags (unique_citation_limit_exceeded, stopped_early, extractor_capped), and a privacy warning on evidence_snippet.

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

Parameters3/5

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

There is a single required parameter and schema coverage is 100%; the schema already documents the 1–50,000 character bound and that empty/oversized input is rejected before the Pro check and before quota deduction. The description reinforces

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?

States a specific verb and resource (batch-audit every section/ruling citation in a single document) and lists the document types it applies to. It also draws a crisp line against the sibling verify_citation, so an agent can pick between them without opening either schema.

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?

Explicit routing rules: single citation → verify_citation (any package, any law in the corpus); unresolved law name → call verify_citation yourself with a known law_code. It also states the Pro-only gate up front, so the agent knows when this tool will be rejected.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources