Skip to main content
Glama

search_law

Read-onlyIdempotent

ค้นกฎหมายไทยแบบ hybrid (ความหมาย + คำตรงตัว) จาก 4 แหล่ง — จุดเริ่มต้นของคำถามที่ยังไม่รู้เลขเอกสาร. นับโควตา 1 ครั้งต่อการเรียก · อ่านอย่างเดียว

แหล่ง (ไม่ระบุ corpus = ค้นทั้ง 4 แหล่งปนกัน):

  • corpus='law' ตัวบทรายมาตรา (ฉบับชำระของกฤษฎีกา — อาจยังไม่รวมการแก้ไขที่เพิ่งประกาศ เคสสำคัญต้องตรวจตัวบททางการ)

  • corpus='gazette' ราชกิจจานุเบกษา + ประกาศ/แจ้งความ

  • corpus='opinion' ความเห็นกฤษฎีกา — มีแค่ชื่อเรื่อง/หมวด/ปี + ลิงก์ PDF ไม่มีเนื้อหาเต็ม

  • corpus="deka" คำพิพากษาศาลฎีกา — full_text อาจมีชื่อจริงคู่ความ (ดู deka_privacy_note)

  • corpus='court_ruling' คำวินิจฉัยชี้ขาดอำนาจหน้าที่ระหว่างศาล (เช่น ปกครอง/ยุติธรรม/ทหาร) — เฉพาะแพ็กเกจ Pro ต้องระบุ corpus เอง (ไม่อยู่ในการค้นแบบไม่ระบุ) · ไม่ใช่ Pro ถูกปฏิเสธโดยไม่นับโควตา

ใช้ tool อื่นแทนเมื่อ: รู้เลขฎีกาแล้ว → get_deka · หาฎีกาที่อ้างมาตราเจาะจง → deka_by_section · ต้องการตัวบท+ฎีกา+ความเห็นของประเด็นเดียวในคำเรียกเดียว → research_dossier · ตรวจว่าที่อ้างมีจริง → verify_citation

อ่านผล:

  • citation.law_code/unit_label ส่งต่อ get_law_document/get_law_versions ได้ตรงๆ · citation.law_abbrev+section_no (เฉพาะ ป.อ./ป.พ.พ./ป.วิ.อ./ป.วิ.พ.) ส่งต่อ deka_by_section ได้โดยไม่ต้อง parse doctitle

  • citation.unit_scope ไม่ None = เนื้อหามาจากฉบับแก้ไข/คำสั่งที่แนบท้ายเอกสารชำระ ไม่ใช่ตัวบทหลัก (section_no/law_abbrev เป็น None)

  • version_count >1 = มาตราเคยถูกแก้ (แสดงฉบับล่าสุด; 1 ไม่ได้แปลว่าไม่เคยแก้ — ดู get_law_versions) · citation.is_repealed=True = ฉบับถูกยกเลิก ระวังก่อนอ้างอิง

  • degraded_note: ข้อความที่มีวลี "ขั้นค้นทำงานครบ" = ผลไม่ขาด แต่ version_count อาจต่ำกว่าจริง · ข้อความอื่น = ข้ามบางขั้น การค้น ผลอาจไม่ครบ — บอกผู้ใช้ตามข้อความ ห้ามสรุปว่า "ไม่มี" · ค้นซ้ำนับโควตาเพิ่ม ให้ผู้ใช้ตัดสินใจ

  • quota.notice มีค่า (โควตาใกล้เต็ม หรือ Pro ใกล้หมดอายุ) → บอกผู้ใช้หนึ่งครั้ง · feedback_hint มีค่า → บอกว่ารายงานผ่าน submit_feedback ได้

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "search_law"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesคำค้นภาษาไทย เช่น "ลูกจ้างมีสิทธิลาคลอดกี่วัน" (≤2,000 ตัวอักษร — ข้อเท็จจริงยาว ให้สรุปเป็นประเด็นกฎหมายสั้นๆ แล้วค้นทีละประเด็น)
top_kNoจำนวนผลลัพธ์สูงสุด 1–20 (ไม่ระบุ: corpus=deka ฎีกา 8 · อื่นๆ 5; เกินช่วงถูกปรับเข้าช่วงเอง)
corpusNo"law"=ตัวบทกฎหมาย | "gazette"=ราชกิจจาฯ | "opinion"=ความเห็นกฤษฎีกา | "deka"=คำพิพากษาศาลฎีกา | "court_ruling"=คำวินิจฉัยชี้ขาดอำนาจหน้าที่ระหว่างศาล (เฉพาะแพ็กเกจ Pro; ต้องระบุเอง) | ไม่ระบุ=ค้น 4 แหล่งแรก (ไม่รวม court_ruling) · ต้องสะกดตรงทุกตัวอักษร ค่าอื่นถูกปฏิเสธโดยไม่นับโควตา
subjectNoกรองสาขากฎหมาย (corpus=law) เช่น "แรงงาน" "ภาษี" "ที่ดิน" "อาญา" — ดูรายการจาก browse(kind="subjects")
year_toNoปีสิ้นสุดเป็น **ค.ศ.** (รวมปีนั้น)
categoryNoกรองประเภทราชกิจจาฯ — "ก"=กฎหมาย, "ข"=ฐานันดร, "ค"=ทะเบียนการค้า, "ง"=ประกาศ · ใช้คู่กับ corpus="gazette" เสมอ (ไม่งั้นผลจากคลังอื่นถูกตัดหมด) · กรองหลังคัดผู้สมัคร หมวดแคบอาจได้ผลว่าง
law_typeNoกรองประเภท เช่น "พระราชบัญญัติ" "ประมวลกฎหมาย" "พระราชกฤษฎีกา" "กฎกระทรวง"
year_fromNoปีเริ่มต้นเป็น **ค.ศ.** (เช่น 2020 = พ.ศ. 2563; พ.ศ. ลบ 543)
include_all_versionsNoFalse (ดีฟอลต์)=เฉพาะฉบับล่าสุด; True=ทุกฉบับแก้ไข (วิจัย/คดีเก่า)

Output Schema

NameRequiredDescriptionDefault
countYes
queryYes
quotaYes
resultsYes
disclaimerYes
attributionYes
degraded_noteYes
feedback_hintYes
expanded_termsYes
deka_privacy_noteYes
law_freshness_noteYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / top_k / anyOf
      Added value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / top_k / default
      Previous value: -5New value: +null
    • changedInput schema / properties / top_k / description
      Previous value: -"จำนวนผลลัพธ์สูงสุด 1–20 (ค่าเริ่มต้น 5; เกินช่วงถูกปรับเข้าช่วงเอง)"New value: +"จำนวนผลลัพธ์สูงสุด 1–20 (ไม่ระบุ: corpus=deka ฎีกา 8 · อื่นๆ 5; เกินช่วงถูกปรับเข้าช่วงเอง)"
    • removedInput schema / properties / top_k / type
      Removed value: -"integer"
  2. Changed5 schema fields changed
    • changedInput schema / properties / category / description
      Previous value: -"กรองประเภทราชกิจจาฯ — \"ก\"=กฎหมาย, \"ข\"=ฐานันดร, \"ค\"=ทะเบียนการค้า, \"ง\"=ประกาศ"New value: +"กรองประเภทราชกิจจาฯ — \"ก\"=กฎหมาย, \"ข\"=ฐานันดร, \"ค\"=ทะเบียนการค้า, \"ง\"=ประกาศ · ใช้คู่กับ corpus=\"gazette\" เสมอ (ไม่งั้นผลจากคลังอื่นถูกตัดหมด) · กรองหลังคัดผู้สมัคร หมวดแคบอาจได้ผลว่าง"
    • changedInput schema / properties / corpus / description
      Previous value: -"\"law\"=ตัวบทกฎหมาย | \"gazette\"=ราชกิจจาฯ | \"opinion\"=ความเห็นกฤษฎีกา | \"deka\"=คำพิพากษาศาลฎีกา | ไม่ระบุ=ทั้งหมด · ค่าอื่นถูกปฏิเสธโดยไม่นับโควตา"New value: +"\"law\"=ตัวบทกฎหมาย | \"gazette\"=ราชกิจจาฯ | \"opinion\"=ความเห็นกฤษฎีกา | \"deka\"=คำพิพากษาศาลฎีกา | \"court_ruling\"=คำวินิจฉัยชี้ขาดอำนาจหน้าที่ระหว่างศาล (เฉพาะแพ็กเกจ Pro; ต้องระบุเอง) | ไม่ระบุ=ค้น 4 แหล่งแรก (ไม่รวม court_ruling) · ต้องสะกดตรงทุกตัวอักษร ค่าอื่นถูกปฏิเสธโดยไม่นับโควตา"
    • changedInput schema / properties / top_k / description
      Previous value: -"จำนวนผลลัพธ์สูงสุด (ค่าเริ่มต้น 5)"New value: +"จำนวนผลลัพธ์สูงสุด 1–20 (ค่าเริ่มต้น 5; เกินช่วงถูกปรับเข้าช่วงเอง)"
    • changedInput schema / properties / year_from / description
      Previous value: -"ปี ค.ศ. เริ่มต้น (เช่น 2020)"New value: +"ปีเริ่มต้นเป็น **ค.ศ.** (เช่น 2020 = พ.ศ. 2563; พ.ศ. ลบ 543)"
    • changedInput schema / properties / year_to / description
      Previous value: -"ปี ค.ศ. สิ้นสุด"New value: +"ปีสิ้นสุดเป็น **ค.ศ.** (รวมปีนั้น)"
  3. Changed1 schema field changed
    • changedInput schema / properties / corpus / description
      Previous value: -"\"law\"=ตัวบทกฎหมาย | \"gazette\"=ราชกิจจาฯ | \"opinion\"=ความเห็นกฤษฎีกา | \"deka\"=คำพิพากษาศาลฎีกา | ไม่ระบุ=ทั้งหมด"New value: +"\"law\"=ตัวบทกฎหมาย | \"gazette\"=ราชกิจจาฯ | \"opinion\"=ความเห็นกฤษฎีกา | \"deka\"=คำพิพากษาศาลฎีกา | ไม่ระบุ=ทั้งหมด · ค่าอื่นถูกปฏิเสธโดยไม่นับโควตา"
  4. Changed2 schema fields changed
    • addedOutput schema / properties / degraded_note
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "title": "Degraded Note"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "query",
      -  "count",
      -  "results",
      -  "expanded_terms",
      -  "quota",
      -  "feedback_hint",
      -  "disclaimer",
      -  "law_freshness_note",
      -  "deka_privacy_note",
      -  "attribution"
      -]New value: +[
      +  "query",
      +  "count",
      +  "results",
      +  "expanded_terms",
      +  "quota",
      +  "feedback_hint",
      +  "degraded_note",
      +  "disclaimer",
      +  "law_freshness_note",
      +  "deka_privacy_note",
      +  "attribution"
      +]
  5. Changed6 schema fields changed
    • changedInput schema / properties / category / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 200,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / corpus / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 200,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / law_type / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 200,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / query / description
      Previous value: -"คำค้นภาษาไทย เช่น \"ลูกจ้างมีสิทธิลาคลอดกี่วัน\""New value: +"คำค้นภาษาไทย เช่น \"ลูกจ้างมีสิทธิลาคลอดกี่วัน\" (≤2,000 ตัวอักษร — ข้อเท็จจริงยาว ให้สรุปเป็นประเด็นกฎหมายสั้นๆ แล้วค้นทีละประเด็น)"
    • addedInput schema / properties / query / maxLength
      Added value: +50000
    • changedInput schema / properties / subject / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 200,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  6. First observed

TDQS

A4.4/5.0
Behavior3/5

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

The annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint=false, so safety is covered. The description then adds substantial behavior beyond them: quota charged once per call and again on retry, court_ruling being Pro-only with non-quota-counted rejection, corpus='law' potentially missing recent amendments, opinion lacking full text, and how to interpret degraded_note and version_count. That is valuable but the score stays at 3 because much of the added text is framed as output-interpretation guidance rather than invocation-time behavior.

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 the one-line purpose before any of the enumeration, then organized into clearly labeled sections for sources, alternatives, and result interpretation. It is long, and the corpus enumeration overlaps with the schema's own corpus description, but each bullet carries actionable information and nothing is padded.

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?

An output schema exists, yet the description still explains the non-obvious return signals (version_count >1 meaning an amended section, is_repealed, unit_scope, degraded_note wording, quota.notice) that an agent must interpret to avoid overstating results. For a 9-parameter multi-corpus search tool this covers everything needed to invoke and report results responsibly.

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?

Schema coverage is 100%, so the baseline would be 3, but the description adds meaning the schema does not: unspecified corpus mixes the first four sources, category must always accompany corpus='gazette' or other collections get filtered out, and corpus='law' content may lag behind newly published amendments. It does partly duplicate the corpus list already present in the schema, which caps it below 5.

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 ('ค้นกฎหมายไทยแบบ hybrid'), names the retrieval method (semantic + exact match), the scope (4 sources), and its role as the entry point for questions without a document number. It also explicitly distinguishes itself from siblings get_deka, deka_by_section, research_dossier, and verify_citation, so an agent can route correctly without opening any 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?

Contains an explicit 'use another tool instead when' block mapping each alternative (get_deka, deka_by_section, research_dossier, verify_citation) to the condition that selects it. It also states the default corpus behavior (unspecified = all four mixed) and that court_ruling is excluded from that default, which is exactly the when/when-not guidance an agent needs.

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