Skip to content
Back to search

ontario-law-check

Quote current Ontario and federal Canadian law straight from the official sites (e-Laws, Justice Laws), with not-in-force and pending-change warnings. CLI and MCP server. Not legal advice.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/foreversynn--ontario-law-check/badge.svg)](/listings/foreversynn--ontario-law-check)

HTML

<a href="/listings/foreversynn--ontario-law-check"><img src="/api/listings/foreversynn--ontario-law-check/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

python law.py on 02c30 43 "43(2)"            Ontario statute sections (code = the e-Laws URL slug)
python law.py on "O. Reg. 17/05" 34          Ontario regulation (same as r:050017)
python law.py on r:200522 sch1:2             Ontario schedule item (sch1 = the whole schedule)
python law.py on 02c30 --find "direct agreement"
python law.py on 02c30 --define "consumer"
python law.py on 23c23 --status              status, currency and commencement orders
python law.py ca E-1.6 6 "6(6)"              federal Act
python law.py ca SOR/2012-36 2               federal regulation
python law.py ca P-8.6 sch1:4.3              federal schedule clause (also schII.1, and schV:II:2 = Part II, item 2)
python law.py ca SI/97-5 order               an order with no numbered sections (preamble works the same way)

Options: `--history`, `--fresh` (skip the cache), `--json`, `--no-orders`, `--source` (as-enacted source law, off by default).

Exit codes: 0 ok, 2 bad usage, 3 fetch or parse failure, 4 not found, 5 the text you asked for isn't in force (not yet in force, repealed or revoked). With several sections, 4 wins if any are missing, then 5.

No Python? `uv run --script law.py ...` works too. On Windows, `py` works in place of `python` if that's what you have.

To find a code, search `site:ontario.ca/laws <name>` or `site:laws-lois.justice.gc.ca <name>`. The code is the last bit of the URL. `skill/SKILL.md` has a list of common ones.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 104 lines
  1. # ontario-law-check
  2. A small tool that pulls the current text of Ontario and federal Canadian laws straight from the government sites and tells you when something in it isn't in force yet, has been repealed, or is about to change.
  3. I run a one-person IT business in Ontario. I kept needing to check what the Consumer Protection Act or CASL actually says, and AI assistants kept quoting law from memory, sometimes old versions, sometimes text that was never in force. So I wrote this to make the assistant (and me) read the real thing every time.
  4. It comes in three pieces:
  5. - `law.py` is a command line tool. Python 3.8 or newer, standard library only, nothing to install.
  6. - `mcp_server.py` is an MCP server so Claude, OpenCode or any other MCP client can use it as a tool.
  7. - `skill/SKILL.md` is an optional skill file that tells an AI assistant how to use the tool properly (cite things right, flag anything not in force, say when you need a lawyer).
  8. **This is not legal advice.** It's a research aid. See [DISCLAIMER.md](DISCLAIMER.md).
  9. ## What it reads
  10. - Ontario: [e-Laws](https://www.ontario.ca/laws), the consolidated statutes and regulations.
  11. - Federal: [Justice Laws](https://laws-lois.justice.gc.ca), the consolidated Acts and regulations.
  12. Nothing is bundled. Every lookup goes to the official site. Downloads are cached for 3 hours so you're not hammering them. The cache lives in `~/.cache/law-lookup-cache` (on Windows, `%TEMP%\law-lookup-cache`), and you can point `LAW_CACHE_DIR` somewhere else if you want.
  13. ## Quick start
  14. ```
  15. python law.py on 02c30 43 "43(2)" Ontario statute sections (code = the e-Laws URL slug)
  16. python law.py on "O. Reg. 17/05" 34 Ontario regulation (same as r:050017)
  17. python law.py on r:200522 sch1:2 Ontario schedule item (sch1 = the whole schedule)
  18. python law.py on 02c30 --find "direct agreement"
  19. python law.py on 02c30 --define "consumer"
  20. python law.py on 23c23 --status status, currency and commencement orders
  21. python law.py ca E-1.6 6 "6(6)" federal Act
  22. python law.py ca SOR/2012-36 2 federal regulation
  23. python law.py ca P-8.6 sch1:4.3 federal schedule clause (also schII.1, and schV:II:2 = Part II, item 2)
  24. python law.py ca SI/97-5 order an order with no numbered sections (preamble works the same way)
  25. ```
  26. Options: `--history`, `--fresh` (skip the cache), `--json`, `--no-orders`, `--source` (as-enacted source law, off by default).
  27. Exit codes: 0 ok, 2 bad usage, 3 fetch or parse failure, 4 not found, 5 the text you asked for isn't in force (not yet in force, repealed or revoked). With several sections, 4 wins if any are missing, then 5.
  28. No Python? `uv run --script law.py ...` works too. On Windows, `py` works in place of `python` if that's what you have.
  29. To find a code, search `site:ontario.ca/laws <name>` or `site:laws-lois.justice.gc.ca <name>`. The code is the last bit of the URL. `skill/SKILL.md` has a list of common ones.
  30. ## Using it as an MCP server
  31. The server speaks MCP over stdio and gives you four tools: `law_lookup`, `law_find`, `law_define` and `law_status`. Keep `mcp_server.py` in the same folder as `law.py`.
  32. Claude Code:
  33. ```
  34. claude mcp add ontario-law -- python /path/to/ontario-law-check/mcp_server.py
  35. ```
  36. Claude Desktop (Settings > Developer > Edit Config), under `"mcpServers"`:
  37. ```json
  38. "ontario-law": {
  39. "command": "python",
  40. "args": ["/path/to/ontario-law-check/mcp_server.py"]
  41. }
  42. ```
  43. OpenCode: copy the entry from [examples/opencode.example.json](examples/opencode.example.json) into your `opencode.json`.
  44. On Windows use the full path with doubled backslashes in JSON, like `"C:\\Tools\\ontario-law-check\\mcp_server.py"`. If you use uv instead of Python, the command is `uv` and the args start with `"run", "--script"`.
  45. ## The skill
  46. `skill/SKILL.md` is written for Claude's skill format but it's just markdown, so you can paste it into any assistant's instructions. It makes the assistant sort every answer into CONFIRMED (the law's own words settle it), INTERPRETATION, or LAWYER REVIEW, and it never lets it quote law it didn't fetch in that session.
  47. If you want it to check your own documents (contracts, invoices, terms), copy [examples/CHECKLIST.example.md](examples/CHECKLIST.example.md) to `CHECKLIST.md` next to `law.py` and fill in your own business facts. Your real checklist stays on your machine. Don't commit it.
  48. ## What it checks, and what it can't
  49. - Ontario: the consolidation period, the currency date e-Laws shows, header notes, grey-shaded not-yet-in-force text (shown as `[NOT YET IN FORCE]`), pending-change notes (including ones elsewhere in a section when you only asked for one subsection), repealed or revoked laws, and the commencement orders on the amending Act's Orders in Council tab. It warns when an order was made on or after the currency date or names a day that's already passed. Older orders may not be listed there.
  50. - Federal: the "current to" line, "AMENDMENTS NOT IN FORCE" (sections, schedules and defined terms), related provisions, and in-force footnotes.
  51. - Changes that wait on another provision coming into force get a CHECK line naming that provision.
  52. - It can't see case law, court rulings that strike something down, or how a regulator actually enforces things. It flags federal transitional provisions but can't apply them for you.
  53. ## Tests
  54. ```
  55. python test_law.py --offline fixed sample pages, no network (this is what CI runs)
  56. python test_law.py everything, including live tests against the real sites (about a minute)
  57. python test_mcp.py starts the MCP server and talks to it, including junk input
  58. ```
  59. The live tests hit real laws, so a failure can mean a bug or that the law or the site changed. Read the message before you "fix" anything.
  60. ## Helping out
  61. Bug reports, fixes and new law codes are all welcome. See [CONTRIBUTING.md](CONTRIBUTING.md). The quickest win is usually a page layout the parser doesn't handle yet: open an issue with the command you ran and what came out.
  62. ## Copyright of the law text
  63. The tool fetches and prints law text, it doesn't ship any. Both governments allow reproduction of their laws without asking, as long as it's accurate and not passed off as the official version:
  64. - Ontario: © King's Printer for Ontario. See the [Ontario copyright page](https://www.ontario.ca/page/copyright-information).
  65. - Federal: the [Reproduction of Federal Law Order (SI/97-5)](https://laws-lois.justice.gc.ca/eng/regulations/SI-97-5/FullText.html).
  66. So every result ends with "This copy is not an official version.", and Ontario results also print the "© King's Printer for Ontario" line with the year. If you quote Ontario text somewhere public, keep that line with it.
  67. ## License
  68. MIT. See [LICENSE](LICENSE).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.