slab-mcp 0.2.1 → 0.3.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.
Files changed (56) hide show
  1. package/README.md +140 -107
  2. package/dist/client.d.ts +34 -13
  3. package/dist/client.js +99 -59
  4. package/dist/config.d.ts +4 -2
  5. package/dist/config.js +27 -2
  6. package/dist/context.d.ts +8 -12
  7. package/dist/context.js +7 -29
  8. package/dist/errors.js +6 -2
  9. package/dist/format.d.ts +2 -0
  10. package/dist/format.js +7 -1
  11. package/dist/prompts/index.js +31 -6
  12. package/dist/resources/index.d.ts +2 -1
  13. package/dist/resources/index.js +4 -3
  14. package/dist/tools/args.d.ts +18 -0
  15. package/dist/tools/args.js +26 -0
  16. package/dist/tools/catalog.d.ts +21 -6
  17. package/dist/tools/catalog.js +88 -47
  18. package/dist/tools/chases.d.ts +28 -0
  19. package/dist/tools/chases.js +72 -0
  20. package/dist/tools/collection.d.ts +26 -18
  21. package/dist/tools/collection.js +113 -82
  22. package/dist/tools/community.d.ts +16 -3
  23. package/dist/tools/community.js +110 -50
  24. package/dist/tools/filters.d.ts +6 -0
  25. package/dist/tools/filters.js +6 -0
  26. package/dist/tools/index.js +2 -0
  27. package/dist/tools/lines.d.ts +20 -0
  28. package/dist/tools/lines.js +31 -0
  29. package/dist/tools/meta.js +5 -4
  30. package/dist/tools/pricing.d.ts +21 -16
  31. package/dist/tools/pricing.js +167 -63
  32. package/dist/tools/writes.d.ts +43 -47
  33. package/dist/tools/writes.js +65 -29
  34. package/dist/types.d.ts +48 -77
  35. package/dist/types.js +6 -6
  36. package/package.json +14 -5
  37. package/dist/client.js.map +0 -1
  38. package/dist/config.js.map +0 -1
  39. package/dist/context.js.map +0 -1
  40. package/dist/credentials.js.map +0 -1
  41. package/dist/errors.js.map +0 -1
  42. package/dist/format.js.map +0 -1
  43. package/dist/index.js.map +0 -1
  44. package/dist/prompts/index.js.map +0 -1
  45. package/dist/resources/index.js.map +0 -1
  46. package/dist/tools/catalog.js.map +0 -1
  47. package/dist/tools/collection.js.map +0 -1
  48. package/dist/tools/community.js.map +0 -1
  49. package/dist/tools/filters.js.map +0 -1
  50. package/dist/tools/index.js.map +0 -1
  51. package/dist/tools/meta.js.map +0 -1
  52. package/dist/tools/pricing.js.map +0 -1
  53. package/dist/tools/types.js.map +0 -1
  54. package/dist/tools/writes.js.map +0 -1
  55. package/dist/types.js.map +0 -1
  56. package/dist/version.js.map +0 -1
@@ -16,14 +16,15 @@
16
16
  * clients that can pull context without a tool call.
17
17
  */
18
18
  import { z } from 'zod';
19
+ import { api } from '../client.js';
19
20
  import { text } from '../format.js';
20
21
  import { READ_ONLY, defineTool } from './types.js';
21
22
  export const getVocab = defineTool({
22
23
  name: 'get_vocab',
23
24
  title: 'Values the API accepts',
24
25
  description: 'Every value slab will accept: copy statuses, acquisition types, cost categories, grades, ' +
25
- 'sealed formats, sort grammars, and the LIVE catalog dimensions — every attribute and grading ' +
26
- 'company that exists right now.\n\n' +
26
+ 'sealed formats, sort grammars, facet dimensions, honors, reactions, and the LIVE catalog ' +
27
+ 'dimensions: every attribute and grading company that exists right now.\n\n' +
27
28
  'Call this before guessing a filter value, and call it again rather than trusting a value you ' +
28
29
  'saw earlier in a long session. Attributes and grading companies grow whenever new products are ' +
29
30
  'ingested, which is exactly why no tool description in this server lists them. A filter value ' +
@@ -39,7 +40,7 @@ export const getVocab = defineTool({
39
40
  annotations: READ_ONLY,
40
41
  mutates: false,
41
42
  async handler(input, ctx) {
42
- const vocab = await ctx.client.request('GET', '/vocab');
43
+ const vocab = await ctx.client.request('GET', api `/vocab`);
43
44
  const wanted = input.fields?.length
44
45
  ? Object.fromEntries(Object.entries(vocab).filter(([k]) => input.fields.includes(k)))
45
46
  : vocab;
@@ -70,7 +71,7 @@ export const explainMetrics = defineTool({
70
71
  annotations: READ_ONLY,
71
72
  mutates: false,
72
73
  async handler(input, ctx) {
73
- const glossary = await ctx.client.request('GET', '/glossary');
74
+ const glossary = await ctx.client.request('GET', api `/glossary`);
74
75
  const detail = input.detail ?? true;
75
76
  let entries = Object.entries(glossary);
76
77
  if (input.ids?.length)
@@ -1,30 +1,35 @@
1
1
  /**
2
- * Pricing tools.
2
+ * Pricing tools: what one printing is worth, its whole rainbow, and what grading it pays.
3
3
  *
4
- * These carry the load-bearing caveat of the whole slab data model, so it is
5
- * written into the tool description rather than left to the caller to infer:
6
- * a price snapshot is a trailing-90-day trimmed-median appraisal, so
7
- * differencing two snapshots measures how the appraisal drifted, not what the
8
- * market did. An agent that says "this card is up 12% this month" from
9
- * `price_change_30d` has stated something false, confidently, about someone's
10
- * money — the description exists to stop exactly that.
4
+ * These carry the load-bearing caveat of the slab data model in their descriptions rather than
5
+ * leaving the caller to infer it: a value is a trailing-90-day median APPRAISAL, so the difference
6
+ * between two of them is how the appraisal drifted, not what the market did. An agent that says
7
+ * "this card is up 12% this month" from a snapshot difference has stated something false about
8
+ * someone's money; the descriptions exist to stop exactly that.
11
9
  */
12
10
  import { z } from 'zod';
13
11
  export declare const getCardPricing: import("./types.js").ToolModule<z.ZodObject<{
14
- card_uuid: z.ZodString;
12
+ card_uuid: z.ZodGUID;
15
13
  grade_key: z.ZodOptional<z.ZodString>;
16
14
  include_comps: z.ZodOptional<z.ZodBoolean>;
17
15
  comps_limit: z.ZodOptional<z.ZodNumber>;
18
16
  include_history: z.ZodOptional<z.ZodBoolean>;
17
+ history_interval: z.ZodOptional<z.ZodEnum<{
18
+ daily: "daily";
19
+ weekly: "weekly";
20
+ monthly: "monthly";
21
+ }>>;
19
22
  history_start: z.ZodOptional<z.ZodString>;
20
23
  history_end: z.ZodOptional<z.ZodString>;
24
+ include_serials: z.ZodOptional<z.ZodBoolean>;
25
+ }, z.core.$strip>>;
26
+ export declare const getRainbow: import("./types.js").ToolModule<z.ZodObject<{
27
+ card_uuid: z.ZodGUID;
28
+ }, z.core.$strip>>;
29
+ export declare const getGradingDesk: import("./types.js").ToolModule<z.ZodObject<{
30
+ card_uuid: z.ZodGUID;
31
+ company: z.ZodOptional<z.ZodString>;
21
32
  }, z.core.$strip>>;
22
33
  export declare const pricingTools: import("./types.js").ToolModule<z.ZodObject<{
23
- card_uuid: z.ZodString;
24
- grade_key: z.ZodOptional<z.ZodString>;
25
- include_comps: z.ZodOptional<z.ZodBoolean>;
26
- comps_limit: z.ZodOptional<z.ZodNumber>;
27
- include_history: z.ZodOptional<z.ZodBoolean>;
28
- history_start: z.ZodOptional<z.ZodString>;
29
- history_end: z.ZodOptional<z.ZodString>;
34
+ card_uuid: z.ZodGUID;
30
35
  }, z.core.$strip>>[];
@@ -1,90 +1,194 @@
1
1
  /**
2
- * Pricing tools.
2
+ * Pricing tools: what one printing is worth, its whole rainbow, and what grading it pays.
3
3
  *
4
- * These carry the load-bearing caveat of the whole slab data model, so it is
5
- * written into the tool description rather than left to the caller to infer:
6
- * a price snapshot is a trailing-90-day trimmed-median appraisal, so
7
- * differencing two snapshots measures how the appraisal drifted, not what the
8
- * market did. An agent that says "this card is up 12% this month" from
9
- * `price_change_30d` has stated something false, confidently, about someone's
10
- * money — the description exists to stop exactly that.
4
+ * These carry the load-bearing caveat of the slab data model in their descriptions rather than
5
+ * leaving the caller to infer it: a value is a trailing-90-day median APPRAISAL, so the difference
6
+ * between two of them is how the appraisal drifted, not what the market did. An agent that says
7
+ * "this card is up 12% this month" from a snapshot difference has stated something false about
8
+ * someone's money; the descriptions exist to stop exactly that.
11
9
  */
12
10
  import { z } from 'zod';
13
- import { join, money, text } from '../format.js';
11
+ import { api } from '../client.js';
12
+ import { glossaryLines, join, money, plural, text } from '../format.js';
13
+ import { gradeKeyArg, optionalIsoDate, uuid } from './args.js';
14
+ import { fmv, players, run } from './lines.js';
14
15
  import { READ_ONLY, defineTool } from './types.js';
16
+ /** Signed dollars: "+$12.00", "-$3.10". The API's drift fields are dollar differences. */
17
+ function signedMoney(value) {
18
+ if (value === null || value === undefined || value === '')
19
+ return undefined;
20
+ const n = Number(value);
21
+ if (!Number.isFinite(n) || n === 0)
22
+ return undefined;
23
+ return `${n < 0 ? '-' : '+'}${money(Math.abs(n))}`;
24
+ }
25
+ /** "1:144 hobby box": a published pull rate, without the API's trailing zeros. */
26
+ function odds(oneIn, format) {
27
+ return `1:${Number(oneIn).toLocaleString('en-US', { maximumFractionDigits: 2 })} ${format.replace(/_/g, ' ')}`;
28
+ }
29
+ /** The series starts half a year back unless asked: a whole history is mostly old, thin weeks. */
30
+ function sixMonthsAgo() {
31
+ const d = new Date();
32
+ d.setUTCMonth(d.getUTCMonth() - 6);
33
+ return d.toISOString().slice(0, 10);
34
+ }
35
+ /** "sells weekly", from the API's liquidity label. */
36
+ function liquidity(label) {
37
+ return label ? label.replace(/_/g, ' ') : undefined;
38
+ }
39
+ /** The printing a response describes: "Ivan Demidov · 2025-26 Upper Deck Series 1 · Young Guns #205 · Outburst". */
40
+ function identity(r) {
41
+ return join(' · ', players(r.subjects), r.set_name, join(' ', r.subset, r.card_number ? `#${r.card_number}` : undefined), r.finish ?? 'base');
42
+ }
15
43
  export const getCardPricing = defineTool({
16
44
  name: 'get_card_pricing',
17
45
  title: 'Pricing for one card',
18
- description: 'What one card is worth, and the individual sales behind that number. `card_uuid` comes from ' +
19
- 'search_cards.\n\n' +
20
- 'Returns a fair market value per price key — a (finish, grade) pair, so a RAW copy and a PSA 10 ' +
21
- 'of the same card are priced separately — plus, optionally, the recent comparable sales and a ' +
22
- 'daily value series.\n\n' +
23
- 'READ THIS BEFORE QUOTING A PERCENTAGE. A fair market value is a trimmed median of the trailing ' +
24
- '90 days of sales, recomputed daily. Two of those snapshots a month apart share most of their ' +
25
- 'underlying sales, so `price_change_30d` is how the APPRAISAL drifted — smooth, lagged, roughly ' +
26
- 'a 90-day memory. It is not the market\'s move over 30 days, and reporting it as one is wrong. ' +
27
- 'If the user asks what actually happened in a window, set `include_comps` and count the real ' +
28
- 'sales in that window instead.\n\n' +
29
- '`sample_size` is how many sales a value rests on. A value drawn from two sales is a guess; say ' +
30
- 'so rather than quoting it flat.\n\n' +
31
- 'Call explain_metrics for the exact meaning of fair market value, appraisal drift, and sample ' +
32
- "size before explaining any of them to the user — use slab's wording, not your own.",
46
+ description: 'What one printing is worth, and the individual sales behind that number. `card_uuid` comes from ' +
47
+ 'search_cards (a `card:` uuid).\n\n' +
48
+ 'Returns a fair market value per grade (RAW and each graded key, priced separately), each with how ' +
49
+ 'many sales it rests on, its low-high range, and how often that grade sells; then the recent sales ' +
50
+ 'themselves; optionally the value series and, for a numbered card, which serial numbers have surfaced.\n\n' +
51
+ 'READ THIS BEFORE QUOTING A CHANGE. A fair market value is a median of the trailing 90 days of sales, ' +
52
+ 'recomputed daily, so "appraisal drift 30d" is how the APPRAISAL moved: smooth, lagged, a 90-day ' +
53
+ "memory. It is not the market's move over 30 days. If the user asks what happened in a window, count " +
54
+ 'the recent sales in that window instead.\n\n' +
55
+ 'A value marked "thin" rests on too few sales to call; say so rather than quoting it flat. The ' +
56
+ "response embeds slab's glossary entries; for anything else call explain_metrics, and use slab's " +
57
+ 'wording rather than your own.',
33
58
  inputSchema: z.object({
34
- card_uuid: z.string().describe('Card UUID, from search_cards.'),
35
- grade_key: z
36
- .string()
37
- .optional()
38
- .describe('Restrict to one price key, e.g. "RAW" or "PSA10". Omit for every key with data. Call get_vocab for valid keys.'),
39
- include_comps: z.boolean().optional().describe('Include the individual recent sales. Default true — this is the evidence behind the value.'),
59
+ card_uuid: uuid('Card UUID, from search_cards.'),
60
+ grade_key: gradeKeyArg,
61
+ include_comps: z.boolean().optional().describe('Include the individual recent sales. Default true: they are the evidence behind the value.'),
40
62
  comps_limit: z.number().int().min(1).max(100).optional().describe('How many recent sales to return. Default 15.'),
41
- include_history: z.boolean().optional().describe('Include the daily value series. Default false; it is the largest part of the response.'),
42
- history_start: z.string().optional().describe('ISO date (YYYY-MM-DD) to start the series.'),
43
- history_end: z.string().optional().describe('ISO date (YYYY-MM-DD) to end the series.'),
63
+ include_history: z.boolean().optional().describe('Include the value series for one grade (grade_key, default RAW). Default false; it is the largest part of the response.'),
64
+ history_interval: z.enum(['daily', 'weekly', 'monthly']).optional().describe('Spacing of the series. Default weekly.'),
65
+ history_start: optionalIsoDate('Start of the series (YYYY-MM-DD). Default: six months back.'),
66
+ history_end: optionalIsoDate('End of the series (YYYY-MM-DD).'),
67
+ include_serials: z.boolean().optional().describe('For a numbered card: which serial numbers have surfaced in sales and collections. Default false.'),
44
68
  }),
45
69
  annotations: READ_ONLY,
46
70
  mutates: false,
47
71
  async handler(input, ctx) {
48
72
  const { card_uuid } = input;
49
73
  const includeComps = input.include_comps ?? true;
50
- const compsLimit = input.comps_limit ?? 15;
51
- const market = await ctx.client.request('GET', `/cards/${card_uuid}/market`);
52
- const lines = ['Fair market value by price key (trailing-90-day trimmed median appraisal):'];
53
- const prices = (market.prices ?? []).filter((p) => !input.grade_key || p.grade_key === input.grade_key);
54
- if (!prices.length) {
55
- lines.push(' (no priced sales matched — this card has no comps yet, or none for that grade key)');
56
- }
57
- for (const price of prices) {
74
+ const [market, comps, history, serials] = await Promise.all([
75
+ ctx.client.request('GET', api `/cards/${card_uuid}/market`),
76
+ includeComps
77
+ ? ctx.client.request('GET', api `/cards/${card_uuid}/comps`, {
78
+ query: { limit: input.comps_limit ?? 15, grade_key: input.grade_key },
79
+ })
80
+ : undefined,
81
+ input.include_history
82
+ ? ctx.client.request('GET', api `/cards/${card_uuid}/price-history`, {
83
+ query: {
84
+ grade_key: input.grade_key ?? 'RAW',
85
+ start: input.history_start ?? sixMonthsAgo(),
86
+ end: input.history_end,
87
+ interval: input.history_interval ?? 'weekly',
88
+ },
89
+ })
90
+ : undefined,
91
+ input.include_serials ? ctx.client.request('GET', api `/cards/${card_uuid}/serials`) : undefined,
92
+ ]);
93
+ const lines = [identity(market), ''];
94
+ // RAW first, then the grades that sell most: the order a collector reads them in.
95
+ const points = (market.price_points ?? [])
96
+ .filter((p) => !input.grade_key || p.grade_key === input.grade_key)
97
+ .sort((a, b) => Number(b.grade_key === 'RAW') - Number(a.grade_key === 'RAW') || b.sample_size - a.sample_size);
98
+ lines.push(`Fair market value by grade (trailing-90-day median of sales${market.as_of_date ? `, as of ${market.as_of_date}` : ''}):`);
99
+ if (!points.length)
100
+ lines.push(` (no priced sales${input.grade_key ? ` at ${input.grade_key}` : ''} yet)`);
101
+ for (const p of points) {
58
102
  lines.push(' ' +
59
- join(' | ', join(' ', price.finish ?? 'base', price.grade_key), money(price.fair_market_value), price.sample_size != null ? `n=${price.sample_size}` : undefined, price.price_change_30d != null ? `appraisal drift 30d ${(price.price_change_30d * 100).toFixed(1)}%` : undefined, price.last_sold_date ? `last sale ${price.last_sold_date}` : undefined));
103
+ join(' | ', p.grade_key, money(p.price_median), p.price_low && p.price_high ? `range ${money(p.price_low)}-${money(p.price_high)}` : undefined, `${plural(p.sample_size, 'sale')}${p.low_confidence ? ' (thin)' : ''}`, p.stale ? `stale, last appraised ${p.as_of_date}` : undefined, liquidity(p.liquidity?.label), signedMoney(p.price_change_30d) ? `appraisal drift 30d ${signedMoney(p.price_change_30d)}` : undefined));
60
104
  }
61
- if (includeComps) {
62
- const comps = await ctx.client.request('GET', `/cards/${card_uuid}/comps`, {
63
- query: { limit: compsLimit, grade_key: input.grade_key },
64
- });
105
+ lines.push(...glossaryLines(market.glossary));
106
+ if (comps) {
65
107
  const rows = comps.comps ?? [];
66
- lines.push('', `Recent sales (${rows.length}) — these are the actual transactions; count these for "what happened in a window":`);
67
- for (const comp of rows) {
68
- lines.push(' ' + join(' | ', comp.sold_date, money(comp.price), comp.grade_key ?? 'RAW', comp.title));
69
- }
108
+ lines.push('', `Recent sales (${rows.length} of ${comps.total}) — the actual transactions; count these for "what happened in a window":`);
109
+ lines.push(...rows.map((c) => ' ' +
110
+ join(' | ', c.sold_date ?? 'date unknown', money(c.sale_price), c.grade_key ?? 'RAW', c.grade_unconfirmed ? 'grade unconfirmed' : undefined, c.sale_type, c.serial_number ? `#${c.serial_number}` : undefined)));
70
111
  if (!rows.length)
71
112
  lines.push(' (none)');
113
+ if (comps.plan_limit != null)
114
+ lines.push(` (this API key's plan shows ${comps.plan_limit} individual sales)`);
72
115
  }
73
- if (input.include_history) {
74
- const history = await ctx.client.request('GET', `/cards/${card_uuid}/price-history`, {
75
- query: {
76
- grade_key: input.grade_key ?? 'RAW',
77
- start: input.history_start,
78
- end: input.history_end,
79
- interval: 'daily',
80
- },
81
- });
82
- const points = history.points ?? [];
83
- lines.push('', `Daily appraisal series (${points.length} points, grade key ${input.grade_key ?? 'RAW'}):`);
84
- lines.push(...points.map((p) => ` ${p.date} ${money(p.value)}${p.sample_size != null ? ` n=${p.sample_size}` : ''}`));
116
+ if (history) {
117
+ const series = history.points ?? [];
118
+ lines.push('', `Value series, ${history.grade_key} (${series.length} points, ${history.interval ?? 'weekly'}; an appraisal, not a ticker):`);
119
+ lines.push(...series.map((p) => ` ${p.date} ${money(p.price_median)}${p.sample_size != null ? ` (${plural(p.sample_size, 'sale')})` : ''}`));
120
+ if (history.plan_history_start)
121
+ lines.push(` (this API key's plan sees history from ${history.plan_history_start})`);
122
+ }
123
+ if (serials && !serials.print_run) {
124
+ lines.push('', 'Serials: this printing is not serial-numbered.');
125
+ }
126
+ else if (serials) {
127
+ const seen = serials.serials ?? [];
128
+ lines.push('', `Serials surfaced: ${serials.serials_seen} of ${serials.print_run}${serials.coverage_pct != null ? ` (${serials.coverage_pct}%)` : ''}:`, ...seen.map((s) => ' ' + join(' | ', `#${s.serial_number}`, s.sales?.length ? `${plural(s.sales.length, 'sale')} (last ${money(s.sales[0]?.sale_price)})` : undefined, s.held ? `held in ${s.held} collection${s.held > 1 ? 's' : ''}` : undefined, s.last_seen ? `last seen ${s.last_seen}` : undefined)));
129
+ lines.push(...glossaryLines(serials.glossary));
85
130
  }
86
131
  return text(...lines);
87
132
  },
88
133
  });
89
- export const pricingTools = [getCardPricing];
134
+ export const getRainbow = defineTool({
135
+ name: 'get_rainbow',
136
+ title: "Every printing of a card (its rainbow)",
137
+ description: "A card's whole rainbow: the base printing and every parallel of the same slot, each with its finish, " +
138
+ "print run, pack odds where known, headline value, and how many the user owns. slab catalogs cards " +
139
+ 'down to the exact parallel, so this is how to answer "which parallels exist", "how rare is the gold", ' +
140
+ 'or "what is the cheapest numbered version".\n\n' +
141
+ 'Pass any `card:` uuid in the slot (base or parallel) from search_cards. Each row\'s uuid is that ' +
142
+ 'printing, for get_card_pricing or add_copy. Values are appraisals; call explain_metrics before ' +
143
+ 'explaining one.',
144
+ inputSchema: z.object({
145
+ card_uuid: uuid('Any printing in the slot, from search_cards.'),
146
+ }),
147
+ annotations: READ_ONLY,
148
+ mutates: false,
149
+ async handler(input, ctx) {
150
+ const printings = await ctx.client.request('GET', api `/cards/${input.card_uuid}/parallels`);
151
+ const first = printings[0];
152
+ // The rainbow route carries odds and runs but no values; one catalog search over the same slot
153
+ // (set, subset, number) prices every printing at once, as the site's card page does.
154
+ const values = new Map();
155
+ if (first?.set_slug) {
156
+ const priced = await ctx.client.request('POST', api `/cards/search`, {
157
+ body: { set_slug: [first.set_slug], subset: first.subset ? [first.subset] : undefined, card_number: first.card_number, include_market: true, limit: 200 },
158
+ read: true,
159
+ });
160
+ for (const card of priced.items ?? [])
161
+ values.set(card.uuid, card.market);
162
+ }
163
+ return text(first ? join(' · ', players(first.subjects), first.set_name, join(' ', first.subset, `#${first.card_number}`)) : 'No printings found.', `${printings.length} printings:`, ...printings.map((card) => ' ' +
164
+ join(' | ', `card:${card.uuid}`, card.finish ?? 'base', run(card.print_run), (card.pack_odds ?? []).length
165
+ ? (card.pack_odds ?? []).map((o) => odds(o.one_in, o.format)).join(', ')
166
+ : card.odds ? `odds ${card.odds}` : undefined, (card.attributes ?? []).map((a) => a.name).join(', ') || undefined, fmv(values.get(card.uuid) ?? card.market) ?? 'no value yet', card.owned_quantity ? `you own ${card.owned_quantity}` : undefined)));
167
+ },
168
+ });
169
+ export const getGradingDesk = defineTool({
170
+ name: 'get_grading_desk',
171
+ title: 'What a card sells for at each grade',
172
+ description: 'Whether grading a raw card pays: its raw value beside what it sells for at each grade, for every ' +
173
+ 'grading company with sales, and where the chosen company\'s prices sit against raw ("break even").\n\n' +
174
+ 'A lane marked "estimate" has no sales at that grade: its value is estimated from similar cards, not ' +
175
+ 'sold, and must be presented that way. Grading costs money and nobody knows the grade a card will get, ' +
176
+ 'so give the user the numbers by grade rather than a verdict. The response embeds slab\'s glossary ' +
177
+ 'entries (break even, estimates); use that wording, or call explain_metrics.\n\n' +
178
+ '`card_uuid` comes from search_cards.',
179
+ inputSchema: z.object({
180
+ card_uuid: uuid('Card UUID, from search_cards.'),
181
+ company: z.string().optional().describe('Grading company the break-even reads, e.g. "PSA" (default). `grading_companies` in get_vocab lists them.'),
182
+ }),
183
+ annotations: READ_ONLY,
184
+ mutates: false,
185
+ async handler(input, ctx) {
186
+ const desk = await ctx.client.request('GET', api `/cards/${input.card_uuid}/grading-desk`, {
187
+ query: { company: input.company },
188
+ });
189
+ return text(identity(desk), '', `Raw: ${fmv(desk.raw) ?? 'no raw value yet'}`, `Break even (${desk.grading_company}): ${desk.break_even.replace(/_/g, ' ')}`, '', 'By grade:', ...(desk.lanes ?? []).map((lane) => ' ' +
190
+ join(' | ', lane.grade_key, money(lane.fair_market_value), lane.estimate ? 'ESTIMATE from similar cards, no sales at this grade' : `${plural(lane.sample_size, 'sale')}${lane.low_confidence ? ' (thin)' : ''}`, liquidity(lane.liquidity?.label))), ...glossaryLines(desk.glossary));
191
+ },
192
+ });
193
+ export const pricingTools = [getCardPricing, getRainbow, getGradingDesk];
90
194
  //# sourceMappingURL=pricing.js.map
@@ -12,117 +12,113 @@
12
12
  */
13
13
  import { z } from 'zod';
14
14
  export declare const addCopy: import("./types.js").ToolModule<z.ZodObject<{
15
- collector_uuid: z.ZodOptional<z.ZodString>;
16
- card_uuid: z.ZodString;
15
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
16
+ card_uuid: z.ZodGUID;
17
17
  quantity: z.ZodOptional<z.ZodNumber>;
18
18
  serial_number: z.ZodOptional<z.ZodNumber>;
19
19
  grading_company: z.ZodOptional<z.ZodString>;
20
20
  grade: z.ZodOptional<z.ZodString>;
21
21
  cert_number: z.ZodOptional<z.ZodString>;
22
22
  self_grade: z.ZodOptional<z.ZodNumber>;
23
- acquisition_type: z.ZodOptional<z.ZodEnum<{
24
- purchase: "purchase";
25
- pack_pull: "pack_pull";
26
- trade: "trade";
27
- gift: "gift";
28
- other: "other";
29
- }>>;
23
+ acquisition_type: z.ZodOptional<z.ZodString>;
30
24
  acquisition_cost: z.ZodOptional<z.ZodNumber>;
31
25
  acquired_date: z.ZodOptional<z.ZodString>;
32
26
  acquired_source: z.ZodOptional<z.ZodString>;
33
- break_uuid: z.ZodOptional<z.ZodString>;
34
- lot_uuid: z.ZodOptional<z.ZodString>;
27
+ break_uuid: z.ZodOptional<z.ZodGUID>;
28
+ lot_uuid: z.ZodOptional<z.ZodGUID>;
35
29
  storage_location: z.ZodOptional<z.ZodString>;
36
30
  notes: z.ZodOptional<z.ZodString>;
37
31
  }, z.core.$strip>>;
38
32
  export declare const updateCopy: import("./types.js").ToolModule<z.ZodObject<{
39
- collector_uuid: z.ZodOptional<z.ZodString>;
40
- copy_uuid: z.ZodString;
33
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
34
+ copy_uuid: z.ZodGUID;
41
35
  quantity: z.ZodOptional<z.ZodNumber>;
42
36
  serial_number: z.ZodOptional<z.ZodNumber>;
43
37
  grading_company: z.ZodOptional<z.ZodString>;
44
38
  grade: z.ZodOptional<z.ZodString>;
45
39
  cert_number: z.ZodOptional<z.ZodString>;
46
40
  self_grade: z.ZodOptional<z.ZodNumber>;
47
- acquisition_type: z.ZodOptional<z.ZodEnum<{
48
- purchase: "purchase";
49
- pack_pull: "pack_pull";
50
- trade: "trade";
51
- gift: "gift";
52
- other: "other";
53
- }>>;
41
+ acquisition_type: z.ZodOptional<z.ZodString>;
54
42
  acquisition_cost: z.ZodOptional<z.ZodNumber>;
55
43
  acquired_date: z.ZodOptional<z.ZodString>;
56
44
  acquired_source: z.ZodOptional<z.ZodString>;
57
- status: z.ZodOptional<z.ZodEnum<{
58
- in_collection: "in_collection";
59
- for_trade: "for_trade";
60
- for_sale: "for_sale";
61
- sold: "sold";
62
- }>>;
45
+ status: z.ZodOptional<z.ZodString>;
63
46
  sale_price: z.ZodOptional<z.ZodNumber>;
64
47
  sold_date: z.ZodOptional<z.ZodString>;
48
+ is_favorite: z.ZodOptional<z.ZodBoolean>;
65
49
  storage_location: z.ZodOptional<z.ZodString>;
66
50
  notes: z.ZodOptional<z.ZodString>;
67
51
  }, z.core.$strip>>;
68
52
  export declare const removeCopy: import("./types.js").ToolModule<z.ZodObject<{
69
- collector_uuid: z.ZodOptional<z.ZodString>;
70
- copy_uuid: z.ZodString;
53
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
54
+ copy_uuid: z.ZodGUID;
71
55
  }, z.core.$strip>>;
72
56
  export declare const logBreak: import("./types.js").ToolModule<z.ZodObject<{
73
- collector_uuid: z.ZodOptional<z.ZodString>;
74
- set_uuid: z.ZodString;
57
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
58
+ set_uuid: z.ZodGUID;
75
59
  break_type: z.ZodString;
60
+ quantity: z.ZodOptional<z.ZodNumber>;
76
61
  total_cost: z.ZodNumber;
77
62
  break_date: z.ZodString;
78
63
  source: z.ZodOptional<z.ZodString>;
79
64
  notes: z.ZodOptional<z.ZodString>;
80
65
  }, z.core.$strip>>;
81
66
  export declare const logLot: import("./types.js").ToolModule<z.ZodObject<{
82
- collector_uuid: z.ZodOptional<z.ZodString>;
67
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
83
68
  total_cost: z.ZodNumber;
84
69
  lot_date: z.ZodString;
85
70
  source: z.ZodOptional<z.ZodString>;
86
71
  notes: z.ZodOptional<z.ZodString>;
87
72
  }, z.core.$strip>>;
73
+ export declare const addTarget: import("./types.js").ToolModule<z.ZodObject<{
74
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
75
+ card_uuid: z.ZodGUID;
76
+ grade_key: z.ZodOptional<z.ZodString>;
77
+ }, z.core.$strip>>;
78
+ export declare const removeTarget: import("./types.js").ToolModule<z.ZodObject<{
79
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
80
+ target_uuid: z.ZodGUID;
81
+ }, z.core.$strip>>;
88
82
  export declare const writeTools: (import("./types.js").ToolModule<z.ZodObject<{
89
- collector_uuid: z.ZodOptional<z.ZodString>;
90
- card_uuid: z.ZodString;
83
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
84
+ card_uuid: z.ZodGUID;
91
85
  quantity: z.ZodOptional<z.ZodNumber>;
92
86
  serial_number: z.ZodOptional<z.ZodNumber>;
93
87
  grading_company: z.ZodOptional<z.ZodString>;
94
88
  grade: z.ZodOptional<z.ZodString>;
95
89
  cert_number: z.ZodOptional<z.ZodString>;
96
90
  self_grade: z.ZodOptional<z.ZodNumber>;
97
- acquisition_type: z.ZodOptional<z.ZodEnum<{
98
- purchase: "purchase";
99
- pack_pull: "pack_pull";
100
- trade: "trade";
101
- gift: "gift";
102
- other: "other";
103
- }>>;
91
+ acquisition_type: z.ZodOptional<z.ZodString>;
104
92
  acquisition_cost: z.ZodOptional<z.ZodNumber>;
105
93
  acquired_date: z.ZodOptional<z.ZodString>;
106
94
  acquired_source: z.ZodOptional<z.ZodString>;
107
- break_uuid: z.ZodOptional<z.ZodString>;
108
- lot_uuid: z.ZodOptional<z.ZodString>;
95
+ break_uuid: z.ZodOptional<z.ZodGUID>;
96
+ lot_uuid: z.ZodOptional<z.ZodGUID>;
109
97
  storage_location: z.ZodOptional<z.ZodString>;
110
98
  notes: z.ZodOptional<z.ZodString>;
111
99
  }, z.core.$strip>> | import("./types.js").ToolModule<z.ZodObject<{
112
- collector_uuid: z.ZodOptional<z.ZodString>;
113
- copy_uuid: z.ZodString;
100
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
101
+ copy_uuid: z.ZodGUID;
114
102
  }, z.core.$strip>> | import("./types.js").ToolModule<z.ZodObject<{
115
- collector_uuid: z.ZodOptional<z.ZodString>;
116
- set_uuid: z.ZodString;
103
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
104
+ set_uuid: z.ZodGUID;
117
105
  break_type: z.ZodString;
106
+ quantity: z.ZodOptional<z.ZodNumber>;
118
107
  total_cost: z.ZodNumber;
119
108
  break_date: z.ZodString;
120
109
  source: z.ZodOptional<z.ZodString>;
121
110
  notes: z.ZodOptional<z.ZodString>;
122
111
  }, z.core.$strip>> | import("./types.js").ToolModule<z.ZodObject<{
123
- collector_uuid: z.ZodOptional<z.ZodString>;
112
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
124
113
  total_cost: z.ZodNumber;
125
114
  lot_date: z.ZodString;
126
115
  source: z.ZodOptional<z.ZodString>;
127
116
  notes: z.ZodOptional<z.ZodString>;
117
+ }, z.core.$strip>> | import("./types.js").ToolModule<z.ZodObject<{
118
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
119
+ card_uuid: z.ZodGUID;
120
+ grade_key: z.ZodOptional<z.ZodString>;
121
+ }, z.core.$strip>> | import("./types.js").ToolModule<z.ZodObject<{
122
+ collector_uuid: z.ZodOptional<z.ZodGUID>;
123
+ target_uuid: z.ZodGUID;
128
124
  }, z.core.$strip>>)[];