BOE Insights

v0.2.1
io.github.davidbejar/boe-insights-mcp Checked 2 days ago Published 17 hours ago

Analytics over Spain's BOE open data: law version history, amendments and legislative trends.

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

search_legislation Search Spanish legislation

Find laws by title, text, rank, department, scope or publication date. Answers 'which laws are about X?' or 'what was published recently?'. Use resolve_reference instead when you already know a law's name or number. Returns compact records. The API gives no total count: while has_more is true, request the next page with next_offset. Only consolidated legislation is covered, not every item published in the BOE. With no filters it lists the most recently published laws.

ParameterTypeDescription
department_codeBOE department code, e.g. '7723' (Jefatura del Estado). Look codes up with find_codes.
descendingbooleanNewest first when true.
limitintegerResults per page.
offsetintegerStart position; pass next_offset from the previous page.
published_fromEarliest publication date, ISO format, e.g. 2020-01-01.
published_toLatest publication date, ISO format, e.g. 2020-12-31.
rankOnly laws of this rank, e.g. 'ley_organica'.
scopestring'state' (national), 'regional' (autonomous communities) or 'any'.
sort_bystringSort by publication, last-update or enactment date.
subject_codeBOE subject (materia) code. Look codes up with find_codes.
textWords that must all appear in the law's body text.
titleWords that must all appear in the title, e.g. 'protección de datos'.

resolve_reference Resolve a law reference

Turn a law's name or number into its BOE identifier. Answers 'what is the identifier of Ley 40/2015?'. Call this before get_law_overview, which needs an identifier. Accepts a rank and number ('Ley Orgánica 3/2018', 'RDL 6/2019'), a bare number, an identifier or a title fragment. Returns status 'resolved' (one match), 'ambiguous' (candidates; follow the hint) or 'not_found'. To explore laws by topic rather than look up a known one, use search_legislation.

ParameterTypeDescription
reference *stringA law as people name it: 'Ley 40/2015', 'Real Decreto-ley 6/2019', 'LO 3/2018', 'BOE-A-2015-10566' or a title fragment. Years need four digits.

get_law_overview Get a law overview

Summarise one law: identity, legal status and how much it has been amended. Answers 'is this law still in force, and how much has it changed?'. Returns title, rank, dates, a status with a plain-English note, the BOE's initial note when it has one, and counts and samples of the norms that amend it or that it amends. The status is derived from the BOE flags (repealed, annulled, validity exhausted), from the amendment references (later norms that repeal it, giving 'partially_repealed') and from a repeal note opening the text, so it is an indication, not a legal determination: 'in_force' does not…

ParameterTypeDescription
law_id *stringBOE identifier of the law, e.g. BOE-A-2015-10566.

find_codes Find BOE codes

Look up BOE department, subject or rank codes by name. Answers 'what is the department_code of the Agencia Española de Protección de Datos?'. Use it to get the values for the department_code and subject_code filters of search_legislation. Matching ignores case and accents and needs every word; the shortest names come first. Subjects are a large flat list, so use specific words.

ParameterTypeDescription
kind *stringWhich BOE code table to search.
text *stringWords that must all appear in the name, e.g. 'protección de datos'.
limitintegerMaximum matches to return.

get_amendment_history List the amendments of a law

List the later norms that amended, repealed or otherwise affected a whole law. Answers 'which laws changed Ley 40/2015, and when?'. Get law_id from resolve_reference. Newest first. Filter with group (repeals, modifies, adds, corrections, other; default all). Returns counts per group and per year, then one page of items with law_id, year, relation and text; while has_more is true, pass next_offset as offset. It names the norms, not the articles they touched: for one article use get_article_history. Derived from BOE references, so informational.

ParameterTypeDescription
law_id *stringBOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
groupstringKind of amending norm: 'repeals' (also annulments), 'modifies', 'adds', 'corrections', 'other' or 'all'.
limitintegerItems per page.
offsetintegerStart position; pass next_offset from the previous page.

read_article Read an article

Read the text of one article of a law as in force on a date. Answers 'what does article 46 bis of Ley 40/2015 say, today or on 2017-01-01?'. Get law_id from resolve_reference. If several blocks match, or none, outcome is 'ambiguous' or 'not_found' and candidates lists blocks to retry with as block_id. When the whole law is repealed, state is 'repealed' although the article shows no marker. Long texts come in parts: while truncated is true, pass next_offset as offset. For changes over time use compare_article_versions or get_article_history. Consolidated text is informational, not official.

ParameterTypeDescription
law_id *stringBOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
articleThe article or provision designation, e.g. '46 bis', 'art. 1.902', 'disposición adicional tercera'. Give this or block_id.
as_ofShow the text valid on this date, ISO format, e.g. 2017-01-01. Default: today.
block_idExact block_id taken from candidates. Give this or article, not both.
max_charsintegerLargest part of the text to return.
offsetintegerStart character; pass next_offset from the previous part, with the same other arguments.

compare_article_versions Compare article versions

Show how one article's text differs between two dates. Answers 'what changed in article 48 between 2017-01-01 and today?'. Returns the added, removed and reworded paragraphs (rewordings marked [-old-] {+new+}; tables give both texts), a unified diff and the norms that amended the article in between. If the article did not exist on from_date, everything shows as added. If the whole law was repealed, note says so. Output is capped: see changes_truncated and unified_truncated, and raise max_changes or max_chars for more. To list every amendment use get_article_history. Consolidated text is infor…

ParameterTypeDescription
from_date *stringEarlier date, ISO format, e.g. 2017-01-01.
law_id *stringBOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
articleThe article or provision designation, e.g. '46 bis', 'art. 1.902', 'disposición adicional tercera'. Give this or block_id.
block_idExact block_id taken from candidates. Give this or article, not both.
max_changesintegerMost changed paragraphs to list.
max_charsintegerLargest total text of the listed changes.
to_dateLater date, ISO format. Default: today.

get_article_history Get an article's history

List the versions of one article: when each took effect, who amended it, what changed. Answers 'when and by which laws was article 48 amended?'. Each event is original, amended or repealed, with the paragraphs added, removed and changed against the previous version. To see what changed between two dates use compare_article_versions; for the amendments of the whole law, not one article, use get_amendment_history. At most the 60 most recent versions are returned; truncated says when older ones are left out. current_state is 'repealed' also when the whole law is repealed. Informational, not offi…

ParameterTypeDescription
law_id *stringBOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
articleThe article or provision designation, e.g. '46 bis', 'art. 1.902', 'disposición adicional tercera'. Give this or block_id.
block_idExact block_id taken from candidates. Give this or article, not both.

get_law_structure Get a law's table of contents

Table of contents of a law: books, titles, chapters, sections and article headings, each with the block_id to pass to the article tools. Use it to find which article deals with a matter before reading it. Large codes need paging or detail='headings'.

ParameterTypeDescription
law_id *stringBOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
as_ofShow the structure valid on this date, ISO format, e.g. 2017-01-01. Default: today.
detailstring'headings' leaves out the articles and provisions.
limitintegerEntries per page.
offsetintegerStart position; pass next_offset from the previous page.

legislation_over_time Count laws over time

Count laws per year, quarter or month, optionally split by rank, department or scope. Answers 'how much legislation on X over time?'. Counts consolidated legislation only.

ParameterTypeDescription
date_basisstringDate to count by: 'published' (BOE publication) or 'enacted'.
department_codeBOE department code. Look codes up with find_codes.
from_dateStart of the range, ISO format. Default: 1 January of the year 19 years before to_date.
group_bystringSplit by 'rank', 'department' or 'scope'; 'none' gives one series.
periodstringPeriod size: 'year', 'quarter' or 'month'.
rankOnly laws of this rank, e.g. 'real_decreto_ley'.
scopestring'state' (national), 'regional' (autonomous communities) or 'any'.
subject_codeBOE subject (materia) code. Look codes up with find_codes.
textWords that must all appear in the law's body text (exact words).
titleWords that must all appear in the title (whole words; singular and plural forms both match), e.g. 'teletrabajo'.
to_dateEnd of the range, ISO format. Default: today.
top_groupsintegerGroups to list; the rest is 'other'.

top_departments Rank departments by laws

Rank the departments (ministries, Jefatura del Estado, autonomous communities) by laws. Counts laws in a period. Answers 'who legislates most on X?'.

ParameterTypeDescription
date_basisstringDate to count by: 'published' (BOE publication) or 'enacted'.
from_dateStart of the range, ISO format. Default: 1 January of the year 19 years before to_date.
limitintegerDepartments to list.
rankOnly laws of this rank, e.g. 'real_decreto_ley'.
scopestring'state' (national), 'regional' (autonomous communities) or 'any'.
subject_codeBOE subject (materia) code. Look codes up with find_codes.
textWords that must all appear in the law's body text (exact words).
titleWords that must all appear in the title (whole words; singular and plural forms both match), e.g. 'teletrabajo'.
to_dateEnd of the range, ISO format. Default: today.

compare_topics Compare topics over time

Compare how often several topics appear in legislation over time. Each topic is title words, body words or a subject code.

ParameterTypeDescription
topics *array2 to 5 topics, each with a name and at least one of title, text or subject_code.
date_basisstringDate to count by: 'published' (BOE publication) or 'enacted'.
department_codeBOE department code. Look codes up with find_codes.
from_dateStart of the range, ISO format. Default: 1 January of the year 19 years before to_date.
periodstringPeriod size: 'year', 'quarter' or 'month'.
rankOnly laws of this rank, e.g. 'real_decreto_ley'.
scopestring'state' (national), 'regional' (autonomous communities) or 'any'.
to_dateEnd of the range, ISO format. Default: today.

explain_spike Explain a spike in legislation

Explain why a period has unusually many laws. Shows which ranks, departments and scopes grew against the preceding periods, with the laws themselves. Without period_key it picks the strongest spike in the range.

ParameterTypeDescription
baseline_periodsintegerPreceding periods to compare with.
date_basisstringDate to count by: 'published' (BOE publication) or 'enacted'.
department_codeBOE department code. Look codes up with find_codes.
from_dateStart of the range, ISO format. Default: 1 January of the year 19 years before to_date.
max_lawsintegerLaws to list.
period'year', 'quarter' or 'month'. Default: what period_key shows, else 'year'.
period_keyPeriod to explain: '2020', '2020-Q2' or '2020-03'. Default: the strongest spike in the range.
rankOnly laws of this rank, e.g. 'real_decreto_ley'.
scopestring'state' (national), 'regional' (autonomous communities) or 'any'.
subject_codeBOE subject (materia) code. Look codes up with find_codes.
textWords that must all appear in the law's body text (exact words).
titleWords that must all appear in the title (whole words; singular and plural forms both match), e.g. 'teletrabajo'.
to_dateEnd of the range, ISO format. Default: today.

most_amended_laws Find the most amended laws

Rank laws by how many later laws amended them, within a filtered set. Examines a limited number of laws per call; when complete is false, call again to continue.

ParameterTypeDescription
date_basisstringDate to count by: 'published' (BOE publication) or 'enacted'.
department_codeBOE department code. Look codes up with find_codes.
from_dateOnly laws published on or after this date, ISO format.
limitintegerLaws to return.
max_lawsintegerMost laws to examine in this call (one request each).
rankOnly laws of this rank, e.g. 'real_decreto_ley'.
scopestring'state' (national), 'regional' (autonomous communities) or 'any'.
subject_codeBOE subject (materia) code. Look codes up with find_codes.
textWords that must all appear in the law's body text (exact words).
titleWords that must all appear in the title (whole words; singular and plural forms both match), e.g. 'teletrabajo'.
to_dateOnly laws published on or before this date, ISO format.

get_daily_summary Get a day's BOE summary

Everything the BOE published on one day: dispositions, appointments, grants and announcements, by section and department. Covers the whole gazette since 1960-09-01, not just consolidated laws. Without a date it gives the latest issue.

ParameterTypeDescription
dateDay to show, ISO format, e.g. 2020-03-14. Default: the latest issue.
department_codeOnly this department code. Look codes up with find_codes.
limitintegerItems per page.
offsetintegerStart position; pass next_offset from the previous page.
sectionOnly this section code, e.g. '1', '2A', '3', '5B'.
wordsWords that must all appear in the title (whole words; singular and plural forms both match).

scan_gazette Scan the BOE over several days

Find items published in the BOE over a range of up to 31 days whose title has given words, or that belong to a section or department. Matches titles only, whole words; singular and plural forms both match. When complete is false, call again to continue.

ParameterTypeDescription
department_codeOnly this department code. Look codes up with find_codes.
from_dateFirst day, ISO format. Default: 6 days before to_date.
limitintegerItems per page.
offsetintegerStart position; pass next_offset from the previous page.
sectionOnly this section code, e.g. '1', '2A', '3', '5B'.
to_dateLast day, ISO format. Default: today.
wordsWords that must all appear in the title (whole words; singular and plural forms both match).

verify_citation Verify citations of laws

Check citations of Spanish laws against the consolidated text: whether the law and article exist, their state on a date, and whether quoted words match the text, the current version or an older one. Reports facts, not legal correctness. Compares words, not meaning: a paraphrase does not match.

ParameterTypeDescription
citations *array1 to 10 citations to check.

explore_amendment_chain Explore an amendment chain

Follow amendments between laws for up to three levels: the laws that amended a law and the laws that amended those (amended_by), or what a law amended (amends). A law two levels away amended the intermediate law, not necessarily the parts that touch the starting law. Examines a limited number of laws per call; when complete is false, call again to continue.

ParameterTypeDescription
law_id *stringBOE identifier of the law, e.g. BOE-A-2015-10566. Get it from resolve_reference.
depthintegerLevels to follow: 1 is only the direct amendments.
detailsstringWhich edges carry the BOE's reference text: 'root' (those touching the starting law), 'all' or 'none'.
directionstring'amended_by': the laws that amended it; 'amends': the laws it amended.
includestring'amendments' (modifications, repeals, additions, suspensions) or 'all', which adds corrections, citations and judicial references.
max_lawsintegerMost laws to read in this call (one request each).

list_saved_searches List saved searches

The saved searches, with their filters and when each was last checked.

check_saved_searches Check saved searches for news

What is new for the saved searches since each was last checked; what is shown is marked as seen. Covers at most the last 31 days; shows up to 60 items per call, so call again while complete is false. since re-reads gazette searches up to 90 days back without marking anything.

ParameterTypeDescription
limitintegerNew items or changes shown per search per call; the rest stay new.
nameCheck only this saved search; default: all.
sinceRe-read gazette searches from this date (at most 90 days back) without marking anything as seen.