dwelldelta-mcp 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,9 +18,9 @@ Six read-only tools, and one that adds the user's own rent when they ask:
18
18
 
19
19
  It runs on your own machine over stdio. It records nothing and sends nothing about you unless you choose to add
20
20
  your rent. At start it fetches DwellDelta's published files from tools.dwelldelta.com.au - the week's indicators,
21
- the rents and sale prices it answers from, eight public files in all, the same for everyone; nothing about you or
22
- your questions is sent - and otherwise uses the copies it ships with. Set `DWELLDELTA_OFFLINE=1` and none of those
23
- eight files is fetched; adding a rent with `contribute_rent` still sends it, as you asked. Nothing it says is a
21
+ the rents and sale prices it answers from, and (from 0.9.0) the ABS rents index behind `rent_check`, nine public
22
+ files in all, the same for everyone; nothing about you or your questions is sent - and otherwise uses the copies it
23
+ ships with. Set `DWELLDELTA_OFFLINE=1` and none of those nine files is fetched; adding a rent with `contribute_rent` still sends it, as you asked. Nothing it says is a
24
24
  forecast, a valuation or advice.
25
25
 
26
26
  ## Adding a rent (from 0.5.0)
@@ -115,6 +115,63 @@ ships with, and the bundled copy when offline. Once a snapshot is more than 10 d
115
115
  words and in the structured result, rather than passing an old figure off as current. Set `DWELLDELTA_INDICATORS`
116
116
  to read another snapshot file.
117
117
 
118
+ The ABS rents index behind `rent_check` is DwellDelta's copy at
119
+ https://tools.dwelldelta.com.au/rent/data/rents-index.json, updated with each monthly ABS release. Up to 0.8.0 the
120
+ server read only the copy bundled when the package was made, so `rent_check` answered only to that copy's latest
121
+ month and nothing in the answer said the index had moved on. From 0.9.0 it fetches the published copy once at
122
+ start, like every other file, and uses it when it is well formed (source, attribution, licence and release named;
123
+ every city the bundled copy has, each a run of contiguous months with positive index values), covers the bundled
124
+ copy city by city (each city's series starts no later and ends no earlier than in the bundled copy) and has no month
125
+ later than the current one; otherwise, or with `DWELLDELTA_OFFLINE=1`, the bundled copy answers.
126
+ `data_as_of` and the `Cite:` line's period say which month the answer runs to.
127
+
128
+ ### Checkable provenance (from 0.9.0)
129
+
130
+ Every answer that gives a figure ends with a `Cite:` line to quote with it: the source, the period, the licence id
131
+ (SPDX, e.g. `CC-BY-4.0`), n (the number of bonds, leases or sales the figure rests on, or why there is none), the
132
+ source's URL (or, where the file names only one, the publisher's copyright notice, labelled so), and DwellDelta's
133
+ published data file. The structured result says the same, in new fields; every field above keeps its meaning:
134
+
135
+ - each entry of `sources` adds `licence_id`, `licence_url`, `source_url`, `source_notice_url`, `feed_url` and
136
+ `period`. `source_url` is only ever an address of the data's own page that the data file itself holds: for WA
137
+ the National Housing Data Exchange dataset page, for Victoria the DataVic page in its source line. It is null
138
+ where the file holds none - DCJ's files (NSW rents, rents by type, sale prices), the RTA's (Queensland), the ABS
139
+ rents index and the indicators snapshot. DCJ's and the RTA's files name only a copyright notice
140
+ (https://dcj.nsw.gov.au/statements/copyright-and-disclaimer.html, which DCJ's attribution also names, and
141
+ https://www.rta.qld.gov.au/copyright; the RTA's attribution names no URL): that is `source_notice_url`, and the
142
+ `Cite:` line labels it `copyright notice`, never `source URL`. `feed_url` is the file at tools.dwelldelta.com.au
143
+ the figure came from, to fetch and check.
144
+ - `stale` and `stale_reason` keep the meaning they have had since 0.2.0: the weekly indicators snapshot is more
145
+ than 10 days old. They are `false` / `null` on every answer without a snapshot (rents, sale prices,
146
+ `rent_check`). `stale_after` is the day the snapshot turns stale (null without one); `cadence` is `weekly`,
147
+ `quarterly` or `monthly`.
148
+ - `period_due_by`, `period_overdue` and `period_overdue_reason` (new) come from the data's own release cadence:
149
+ `period_due_by` is the day by which the release after this period was due, and `period_overdue` is true once it
150
+ has passed with no newer file. A quarterly rents file is overdue once its quarter ended more than seven months
151
+ ago (the next quarter, plus the publisher's lag), NSW sale prices after ten (DCJ's sales run a quarter behind its
152
+ rents), and the ABS monthly rents index two months after its latest month. An overdue answer opens with a
153
+ `STALE:` line giving the reason, and its `Cite:` line ends `; STALE.` - as an old snapshot's does.
154
+ - `figures` (`area_rents`, with or without `dwelling_type` and `bedrooms`, `vic_rents`, `nsw_sale_prices`): one
155
+ entry per figure of the answer, with `n`, `n_band` (where the publisher withholds the exact count), `unit`,
156
+ `small_sample` and `refusal`. `refusals` lists the refused ones, `all_refused` says whether anything may be
157
+ quoted, and `sample_rule` is the publisher's rule.
158
+ - A figure that rests on too few records is a refusal, never a weak number: `{ refused: true, type:
159
+ "too_few_records", reason, n, n_band, unit, min_n, rule }` (`type` is `not_published` for a combination the
160
+ publisher does not list). The rules are each file's own: DCJ reports nothing for 10 or fewer bonds or sales
161
+ (`min_n` 11), a WA locality needs 10 bonds, and the RTA and Homes Victoria withhold small medians without
162
+ stating a number. A median the file gives below its rule is refused in the text as well; the file's own figure
163
+ is left as it is in the structured rows.
164
+ - Each structured row says on itself whether the text refused its figure (from 0.9.0; additions only - no field a
165
+ row had is changed or removed): `refused: true` and `refusal_type` (`too_few_records` or `not_published`, the same
166
+ as the refusal's `type`) on a refused row, `refused: false` and `refusal_type: null` on a row whose figure is
167
+ given. The rows are `area_rents`' `state_total`, `regions`, `councils` and `areas` (every state), its by-type
168
+ `rows` (NSW and Queensland), `vic_rents`' `regions` and `suburb_groups`, and in `nsw_sale_prices` each place's
169
+ `total`, `non_strata` and `strata` row. So a refused row's weak `median_weekly_rent_aud` (or `median_price_k_aud`)
170
+ is never read as a figure by an agent that reads only the rows. A sale-prices dwelling type with no row in DCJ's
171
+ table stays `null`, as the file has it - there is no figure on it to misread - and its `not_published` refusal is
172
+ in `refusals`.
173
+ - `rent_check` and `market_indicators` say `sample_size: null` and why: an index and these indicators have no count.
174
+
118
175
  ## Licence
119
176
 
120
177
  The code is MIT (see LICENSE). The data is not: each figure keeps its source's licence and attribution, which every
@@ -123,5 +180,6 @@ answer states - for example ABS data is CC BY 4.0, "Based on Australian Bureau o
123
180
  ## Development
124
181
 
125
182
  `npm test` here starts the server and calls the six read-only tools, and the first (consent) call of
126
- `contribute_rent`, over MCP; the repository's root `npm test` holds the
183
+ `contribute_rent`, over MCP, and `test/provenance.test.mjs` holds the provenance above on the vendored files and
184
+ fixtures; the repository's root `npm test` holds the
127
185
  tool answers themselves and checks that `vendor/` matches its sources. `npm pack` runs `scripts/vendor.mjs` first.
@@ -18,7 +18,8 @@
18
18
  import { existsSync } from "node:fs";
19
19
  import { fileURLToPath } from "node:url";
20
20
  import { dirname, join } from "node:path";
21
- import { loadJson, envelope, ToolError, FOOTER, FETCH_TIMEOUT_MS } from "./tools.mjs";
21
+ import { loadJson, envelope, ToolError, FOOTER, FETCH_TIMEOUT_MS, feedSource, CADENCE, SAMPLE_RULES, judgeFigure,
22
+ figureFields, nWords, citeLine, staleNote, flagged, refusalMark } from "./tools.mjs";
22
23
  import { quarterKey } from "./vic-rents-tool.mjs";
23
24
 
24
25
  const HERE = dirname(fileURLToPath(import.meta.url));
@@ -31,10 +32,14 @@ export const STATES = {
31
32
  QLD: { file: "qld-rents.json", name: "Queensland",
32
33
  hint: "Queensland rents are by suburb, as the RTA names it (area: \"Acacia Ridge\"; part of a name works), " +
33
34
  "or by council (council: \"Brisbane\")." },
34
- WA: { file: "wa-rents.json", name: "Western Australia",
35
+ // WA's source_notice is the Housing Data Exchange page of the bond records themselves, so it is the source's URL.
36
+ // NSW's and Queensland's are DCJ's and the RTA's copyright notices: a notice, never called the source URL.
37
+ WA: { file: "wa-rents.json", name: "Western Australia", notice_is_data: true,
35
38
  hint: "WA rents are by locality (area: \"Fremantle\"; part of a name works). There are no councils in the " +
36
39
  "bond records." },
37
40
  };
41
+ /** Each state's small-sample rule (tools.mjs SAMPLE_RULES): below it a figure is refused, never given. */
42
+ export const RULES = { NSW: SAMPLE_RULES.NSW_RENTS, QLD: SAMPLE_RULES.QLD_RENTS, WA: SAMPLE_RULES.WA_RENTS };
38
43
  /** Rows shown in one answer; a wider match says how many more there are instead of dropping them silently. */
39
44
  export const MAX_ROWS = 25;
40
45
 
@@ -79,12 +84,19 @@ export const norm = (s) => String(s).trim().toLowerCase();
79
84
  export const dollars = (v) => { const n = Number(v); return `$${n.toLocaleString("en-AU", Number.isInteger(n) ? {} : { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`; };
80
85
  export const signed = (v) => `${v >= 0 ? "+" : ""}${v}%`;
81
86
 
82
- function line(r, name) {
83
- if (r.median_weekly_rent_aud == null) {
84
- const why = r.withheld ?? (r.new_bonds == null ? "too few bonds"
85
- : `${r.new_bonds} new bond${r.new_bonds === 1 ? "" : "s"} - too few for a median`);
86
- return `${name}: no median (${why}).`;
87
- }
87
+ /** Why a row has no median, in the words the answer has always used. */
88
+ const whyNone = (r) => r.withheld ?? (r.new_bonds == null ? "too few bonds"
89
+ : `${r.new_bonds} new bond${r.new_bonds === 1 ? "" : "s"} - too few for a median`);
90
+
91
+ /** One figure's sample and, if it rests on too few bonds, its refusal (see judgeFigure in tools.mjs). */
92
+ export const rentFigure = (r, name, rule) => judgeFigure(r, { name, median: "median_weekly_rent_aud", count: "new_bonds",
93
+ band: "new_bonds_band", rule, why: r && r.median_weekly_rent_aud == null ? whyNone(r) : null });
94
+
95
+ function line(r, name, rule = null) {
96
+ if (r.median_weekly_rent_aud == null) return `${name}: no median (${whyNone(r)}).`;
97
+ // A median below the publisher's own rule is refused, not printed: never a weak number.
98
+ const refusal = rule ? rentFigure(r, name, rule).refusal : null;
99
+ if (refusal) return `${name}: no median (${refusal.reason}).`;
88
100
  const bonds = r.new_bonds_band ? ` from ${r.new_bonds_band} new bonds (the publisher withholds the count)`
89
101
  : r.new_bonds == null ? "" : ` from ${r.new_bonds.toLocaleString("en-AU")} new bonds`;
90
102
  const change = r.change_pct == null ? ""
@@ -163,15 +175,24 @@ export function areaRentsResult({ state, area, council, dwelling_type, bedrooms
163
175
  }
164
176
  areas = areas.slice(0, MAX_ROWS);
165
177
  councils = councils.slice(0, MAX_ROWS);
166
- const env = envelope({ sources: [{ source: feed.source, licence: feed.licence, attribution: feed.attribution }],
167
- dataAsOf: feed.quarter, origin: feed.origin ?? null }, now);
178
+ const rule = RULES[state];
179
+ const feedUrl = PUBLISHED_BASE + info.file;
180
+ const env = envelope({ sources: [feedSource(feed, feedUrl, feed.quarter, { noticeIsData: info.notice_is_data === true })],
181
+ dataAsOf: feed.quarter,
182
+ origin: feed.origin ?? null, cadence: CADENCE.rents_quarterly }, now);
183
+ // Every line, in the order the answer gives them: its name, its row.
184
+ const shown = [...(whole ? [[`${info.name} (whole state)`, feed.state_total]] : []),
185
+ ...regions.map((r) => [`${r.region} (region)`, r]), ...councils.map((r) => [`${r.council} (council)`, r]),
186
+ ...areas.map((r) => [`${r.area} (${kind})`, r])];
187
+ const figures = shown.map(([name, r]) => rentFigure(r, name, rule));
188
+ // Each row as the file gives it, plus its own refusal marker (a copy: the loaded feed is never written to).
189
+ const judged = new Map(shown.map(([, r], i) => [r, figures[i]]));
190
+ const marked = (r) => ({ ...r, ...refusalMark(judged.get(r)) });
168
191
  const text = [
192
+ ...staleNote(env),
169
193
  `${feed.what}. Quarter: ${feed.quarter}, against ${feed.compared_with}.`,
170
194
  "",
171
- ...(whole ? [line(feed.state_total, `${info.name} (whole state)`)] : []),
172
- ...regions.map((r) => line(r, `${r.region} (region)`)),
173
- ...councils.map((r) => line(r, `${r.council} (council)`)),
174
- ...areas.map((r) => line(r, `${r.area} (${kind})`)),
195
+ ...shown.map(([name, r]) => line(r, name, rule)),
175
196
  ...dropped,
176
197
  ...(whole ? ["", `${feed.areas.length.toLocaleString("en-AU")} ${kind} rows` +
177
198
  `${feed.councils.length ? ` and ${feed.councils.length} councils` : ""} are available: call again with area` +
@@ -182,16 +203,21 @@ export function areaRentsResult({ state, area, council, dwelling_type, bedrooms
182
203
  "",
183
204
  `Source: ${feed.attribution}`,
184
205
  `What DwellDelta changed: ${feed.changes_made}`,
206
+ citeLine({ source: feed.source, period: `${feed.quarter} (against ${feed.compared_with})`, licence: feed.licence,
207
+ n: nWords(figures, rule.unit), url: env.sources[0].source_url, notice: env.sources[0].source_notice_url,
208
+ feedUrl, stale: flagged(env) }),
185
209
  FOOTER,
186
210
  ].join("\n");
187
211
  return { text, structured: { ...env, state, state_name: info.name, area_kind: kind, quarter: feed.quarter,
188
212
  compared_with: feed.compared_with, derived: feed.derived === true,
189
- state_total: whole ? feed.state_total : null, regions, councils, areas,
190
- truncated: dropped.length > 0, limits: feed.limits, changes_made: feed.changes_made } };
213
+ state_total: whole ? marked(feed.state_total) : null, regions: regions.map(marked),
214
+ councils: councils.map(marked), areas: areas.map(marked),
215
+ truncated: dropped.length > 0, limits: feed.limits, changes_made: feed.changes_made,
216
+ ...figureFields(figures), sample_rule: rule } };
191
217
  }
192
218
 
193
219
  // --- by dwelling type and bedrooms --------------------------------------------------------------------------------
194
- // Prepared 2026-10-10; NOT in 0.7.0, the version on npm. "What does a two-bedroom unit rent for there?" is the
220
+ // From 0.8.0 (prepared 2026-10-10; not in 0.7.0). "What does a two-bedroom unit rent for there?" is the
195
221
  // question people ask, and the feeds above answer only for all dwellings together. NSW and Queensland publish a
196
222
  // companion file each (market/{nsw,qld}-rents-by-type.json); WA's bond records carry neither dwelling type nor
197
223
  // bedrooms, so WA has none.
@@ -393,23 +419,31 @@ function byTypeResult({ state, info, feed, dwelling_type, bedrooms, whole, areas
393
419
  ...areas.map((r) => ({ name: `${r.area} (${kind})`, place: r.area, place_kind: kind,
394
420
  group: file.areas.find((g) => g.area === r.area) }))];
395
421
  const shown = places.slice(0, MAX_TYPE_PLACES);
396
- const lines = [], rows = [];
422
+ const rule = RULES[state];
423
+ const lines = [], rows = [], figures = [];
397
424
  for (const p of shown) {
398
425
  const absent = [];
399
426
  for (const w of wanted) {
400
427
  const cell = w.cell(p.group);
428
+ const name = `${p.name}, ${w.words}`;
429
+ const fig = cell ? rentFigure(cell, name, rule)
430
+ : judgeFigure(null, { name, median: "median_weekly_rent_aud", count: "new_bonds", rule, why: file.absent_means });
431
+ figures.push(fig);
401
432
  rows.push({ place: p.place, place_kind: p.place_kind,
402
- ...(state === "NSW" ? { dwelling_type: w.dwelling_type, bedrooms: w.bedrooms } : { label: w.label }), figure: cell });
403
- if (cell) lines.push(line(cell, `${p.name}, ${w.words}`));
433
+ ...(state === "NSW" ? { dwelling_type: w.dwelling_type, bedrooms: w.bedrooms } : { label: w.label }), figure: cell,
434
+ ...refusalMark(fig) });
435
+ if (cell) lines.push(line(cell, name, rule));
404
436
  else absent.push(w.words);
405
437
  }
406
438
  if (absent.length) lines.push(`${p.name}: no published median for ${absent.join("; ")}.`);
407
439
  }
408
440
  const truncated = places.length > shown.length;
409
441
  if (truncated) lines.push(`${places.length - shown.length} more places match: narrow the name.`);
410
- const env = envelope({ sources: [{ source: file.source, licence: file.licence, attribution: file.attribution }],
411
- dataAsOf: file.quarter, origin: file.origin ?? null }, now);
442
+ const feedUrl = PUBLISHED_BASE + BY_TYPE[state];
443
+ const env = envelope({ sources: [feedSource(file, feedUrl, file.quarter)], dataAsOf: file.quarter,
444
+ origin: file.origin ?? null, cadence: CADENCE.rents_quarterly }, now);
412
445
  const text = [
446
+ ...staleNote(env),
413
447
  `${file.what}. Quarter: ${file.quarter}, against ${file.compared_with}.`,
414
448
  "",
415
449
  ...notes.flatMap((n) => [n, ""]),
@@ -425,10 +459,13 @@ function byTypeResult({ state, info, feed, dwelling_type, bedrooms, whole, areas
425
459
  "",
426
460
  `Source: ${file.attribution}`,
427
461
  `What DwellDelta changed: ${file.changes_made}`,
462
+ citeLine({ source: file.source, period: `${file.quarter} (against ${file.compared_with})`, licence: file.licence,
463
+ n: nWords(figures, rule.unit), url: env.sources[0].source_url, notice: env.sources[0].source_notice_url,
464
+ feedUrl, stale: flagged(env) }),
428
465
  FOOTER,
429
466
  ].join("\n");
430
467
  return { text, structured: { ...env, state, state_name: info.name, area_kind: kind, quarter: file.quarter,
431
468
  compared_with: file.compared_with, detail: file.detail, asked, notes, rows, truncated,
432
469
  absent_means: file.absent_means, labels: file.labels, limits: file.limits,
433
- changes_made: file.changes_made } };
470
+ changes_made: file.changes_made, ...figureFields(figures), sample_rule: rule } };
434
471
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dwelldelta-mcp",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Is an Australian rent fair? A rent check on the ABS rents index, rents by area for four states, NSW median sale prices, and sourced property and lending indicators, for AI agents.",
5
5
  "mcpName": "au.com.dwelldelta/dwelldelta",
6
6
  "license": "MIT",
@@ -25,7 +25,8 @@
25
25
  import { existsSync } from "node:fs";
26
26
  import { fileURLToPath } from "node:url";
27
27
  import { dirname, join } from "node:path";
28
- import { loadJson, envelope, ToolError, FOOTER, FETCH_TIMEOUT_MS } from "./tools.mjs";
28
+ import { loadJson, envelope, ToolError, FOOTER, FETCH_TIMEOUT_MS, feedSource, CADENCE, SAMPLE_RULES, judgeFigure,
29
+ figureFields, nWords, citeLine, staleNote, flagged, refusalMark } from "./tools.mjs";
29
30
  import { quarterKey } from "./vic-rents-tool.mjs";
30
31
  import { signed, match, nswPostcodes, MAX_ROWS, BUNDLED_DIR, PUBLISHED_BASE } from "./area-rents-tool.mjs";
31
32
 
@@ -84,10 +85,23 @@ export async function loadNswSales({ env = process.env, fetchImpl = globalThis.f
84
85
  /** 1033 (thousands, as DCJ reports) -> "$1,033,000". */
85
86
  const price = (k) => `$${(k * 1000).toLocaleString("en-AU")}`;
86
87
 
88
+ /** DCJ's small-sample rule for its sales tables (tools.mjs SAMPLE_RULES): below it a figure is refused, never given. */
89
+ export const RULE = SAMPLE_RULES.NSW_SALES;
90
+
91
+ /** One figure's sample and, if it rests on too few sales or is not in DCJ's table, its refusal. */
92
+ export function saleFigure(r, label) {
93
+ const why = r == null ? "no row in DCJ's table" : r.median_price_k_aud == null ? (r.withheld ?? "not reported") : null;
94
+ return judgeFigure(r, { name: label, median: "median_price_k_aud", count: "sales", band: "sales_band", rule: RULE, why,
95
+ missing: r && r.withheld ? "too_few_records" : "not_published" });
96
+ }
97
+
87
98
  function line(r, name, type) {
88
99
  const label = `${name}, ${LABEL[type]}`;
89
100
  if (r == null) return `${label}: no row in DCJ's table.`;
90
101
  if (r.median_price_k_aud == null) return `${label}: no median (${r.withheld ?? "not reported"}).`;
102
+ // A median below DCJ's own rule is refused, not printed: never a weak number.
103
+ const refusal = saleFigure(r, label).refusal;
104
+ if (refusal) return `${label}: no median (${refusal.reason}).`;
91
105
  const sales = r.sales_band ? ` from ${r.sales_band} sales (DCJ withholds the count)`
92
106
  : r.sales == null ? "" : ` from ${r.sales.toLocaleString("en-AU")} sales`;
93
107
  const change = r.change_pct == null ? "" : `, ${signed(r.change_pct)} on a year before`;
@@ -150,9 +164,14 @@ export function salePricesResult({ area, council, dwelling_type } = {}, feed, no
150
164
  const marked = seen.some((s) => s.mark !== null), noted = seen.some((s) => s.part !== null);
151
165
  const setByAFew = seen.some((s) => s.mark === "known"), mostlyARow = seen.some((s) => s.part === "known");
152
166
  const unknown = seen.some((s) => s.mark === "unknown" || s.part === "unknown");
153
- const env = envelope({ sources: [{ source: feed.source, licence: feed.licence, attribution: feed.attribution }],
154
- dataAsOf: feed.quarter, origin: feed.origin ?? null }, now);
167
+ const feedUrl = PUBLISHED_BASE + SALES_FILE;
168
+ const env = envelope({ sources: [feedSource(feed, feedUrl, feed.quarter)], dataAsOf: feed.quarter,
169
+ origin: feed.origin ?? null, cadence: CADENCE.sales_quarterly }, now);
170
+ // Each place's figures by dwelling type, in the order the answer gives them.
171
+ const judged = new Map(shown.map(([name, g]) => [g, Object.fromEntries(types.map((t) => [t, saleFigure(g[t], `${name}, ${LABEL[t]}`)]))]));
172
+ const figures = shown.flatMap(([, g]) => types.map((t) => judged.get(g)[t]));
155
173
  const text = [
174
+ ...staleNote(env),
156
175
  `${feed.what}. Quarter: ${feed.quarter}, against ${feed.compared_with}. Medians of homes sold - not asking ` +
157
176
  "prices, not valuations, and not the price or value of any one home.",
158
177
  "",
@@ -174,14 +193,22 @@ export function salePricesResult({ area, council, dwelling_type } = {}, feed, no
174
193
  "",
175
194
  `Source: ${feed.attribution}`,
176
195
  `What DwellDelta changed: ${feed.changes_made}`,
196
+ citeLine({ source: feed.source, period: `${feed.quarter} (against ${feed.compared_with})`, licence: feed.licence,
197
+ n: nWords(figures, RULE.unit), url: env.sources[0].source_url, notice: env.sources[0].source_notice_url,
198
+ feedUrl, stale: flagged(env) }),
177
199
  FOOTER,
178
200
  ].join("\n");
179
- const pick = (g) => Object.fromEntries(Object.entries(g).filter(([k]) => !DWELLING_TYPES.includes(k) || types.includes(k)));
201
+ // Each place as the file gives it, for the dwelling types asked for, and each dwelling type's row with its own refusal
202
+ // marker. A type with no row in DCJ's table stays null, as the file has it - there is no figure on it to misread -
203
+ // and its not_published refusal is in refusals[]. Copies: the loaded feed is never written to.
204
+ const pick = (g) => Object.fromEntries(Object.entries(g).filter(([k]) => !DWELLING_TYPES.includes(k) || types.includes(k))
205
+ .map(([k, v]) => [k, DWELLING_TYPES.includes(k) && v && typeof v === "object" ? { ...v, ...refusalMark(judged.get(g)[k]) } : v]));
180
206
  return { text, structured: { ...env, state: "NSW", measure: "sale_price", unit: feed.unit, area_kind: "postcode",
181
207
  quarter: feed.quarter, compared_with: feed.compared_with,
182
208
  dwelling_types: feed.dwelling_types ?? null,
183
209
  state_total: whole ? pick(feed.state_total) : null,
184
210
  councils: councils.map(pick), areas: areas.map(pick), any_unusual: marked,
185
211
  any_unusual_part: noted,
186
- truncated: dropped.length > 0, limits: feed.limits, changes_made: feed.changes_made } };
212
+ truncated: dropped.length > 0, limits: feed.limits, changes_made: feed.changes_made,
213
+ ...figureFields(figures), sample_rule: RULE } };
187
214
  }
package/server.mjs CHANGED
@@ -2,7 +2,8 @@
2
2
  // DwellDelta MCP server: Australian property market data for AI agents. Runs on the user's machine over stdio and
3
3
  // records nothing unless the user chooses to add their rent. From 0.4.0 it fetches the week's indicators once at start from tools.dwelldelta.com.au - one
4
4
  // public file; nothing about the user or their questions is sent - and falls back to its bundled copy
5
- // (DWELLDELTA_OFFLINE=1 never fetches). Six read-only tools; the logic lives in tools.mjs, vic_rents
5
+ // (DWELLDELTA_OFFLINE=1 never fetches); from 0.9.0 so is the ABS rents index behind rent_check. Six read-only
6
+ // tools; the logic lives in tools.mjs, vic_rents
6
7
  // (Victorian rents by suburb group, 0.5.0) in vic-rents-tool.mjs, area_rents (NSW postcodes, Queensland suburbs
7
8
  // and WA localities, 0.6.0) in area-rents-tool.mjs, and nsw_sale_prices (NSW median sale prices by postcode, 0.7.0)
8
9
  // in sale-prices-tool.mjs, each feed loaded the same way. area_rents also answers by dwelling type and bedrooms for
@@ -17,7 +18,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
17
18
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
18
19
  import { z } from "zod";
19
20
  import {
20
- rentCheckResult, marketIndicatorsResult, dataSourcesResult, loadJson, loadSnapshot, ToolError,
21
+ rentCheckResult, marketIndicatorsResult, dataSourcesResult, loadJson, loadSnapshot, loadRentsIndex, ToolError,
21
22
  RENTS_PATH, INDICATORS_PATH, SERVER_VERSION,
22
23
  } from "./tools.mjs";
23
24
  import { makeContributeTool, INSTRUCTION } from "./contribute-tool.mjs";
@@ -26,7 +27,9 @@ import { loadAllAreaRents, loadAllRentsByType, wantsByType, areaRentsResult, STA
26
27
  import { loadNswSales, salePricesResult, DWELLING_TYPES } from "./sale-prices-tool.mjs";
27
28
  import { HOME_TYPES, BEDROOMS, LEASE_KINDS, WHOSE } from "./vendor/contribute.mjs";
28
29
 
29
- const rents = await loadJson(RENTS_PATH);
30
+ // The ABS rents index: the published copy if it is well formed, covers each bundled city's months and runs to no
31
+ // month after this one, else the bundled copy (DWELLDELTA_OFFLINE=1 never fetches). With neither readable, reading the bundled file fails as it always has.
32
+ const rents = (await loadRentsIndex()).rents ?? await loadJson(RENTS_PATH);
30
33
  const { suburbs } = await loadJson(new URL("./vendor/nsw-suburbs.json", import.meta.url));
31
34
  const contributeRent = makeContributeTool({ suburbs });
32
35
  const loaded = await loadSnapshot();