hearthstone-oracle 0.1.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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/data/db.d.ts +49 -0
- package/dist/data/db.d.ts.map +1 -0
- package/dist/data/db.js +109 -0
- package/dist/data/db.js.map +1 -0
- package/dist/data/hearthstone.d.ts +40 -0
- package/dist/data/hearthstone.d.ts.map +1 -0
- package/dist/data/hearthstone.js +58 -0
- package/dist/data/hearthstone.js.map +1 -0
- package/dist/data/pipeline.d.ts +36 -0
- package/dist/data/pipeline.d.ts.map +1 -0
- package/dist/data/pipeline.js +90 -0
- package/dist/data/pipeline.js.map +1 -0
- package/dist/data/schema.sql +111 -0
- package/dist/data/strategy-seed.d.ts +3 -0
- package/dist/data/strategy-seed.d.ts.map +1 -0
- package/dist/data/strategy-seed.js +512 -0
- package/dist/data/strategy-seed.js.map +1 -0
- package/dist/format.d.ts +63 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +331 -0
- package/dist/format.js.map +1 -0
- package/dist/knowledge/archetype-classifier.d.ts +19 -0
- package/dist/knowledge/archetype-classifier.d.ts.map +1 -0
- package/dist/knowledge/archetype-classifier.js +232 -0
- package/dist/knowledge/archetype-classifier.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +269 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/analyze-deck.d.ts +45 -0
- package/dist/tools/analyze-deck.d.ts.map +1 -0
- package/dist/tools/analyze-deck.js +159 -0
- package/dist/tools/analyze-deck.js.map +1 -0
- package/dist/tools/decode-deck.d.ts +30 -0
- package/dist/tools/decode-deck.d.ts.map +1 -0
- package/dist/tools/decode-deck.js +127 -0
- package/dist/tools/decode-deck.js.map +1 -0
- package/dist/tools/explain-concept.d.ts +26 -0
- package/dist/tools/explain-concept.d.ts.map +1 -0
- package/dist/tools/explain-concept.js +34 -0
- package/dist/tools/explain-concept.js.map +1 -0
- package/dist/tools/get-archetype.d.ts +29 -0
- package/dist/tools/get-archetype.d.ts.map +1 -0
- package/dist/tools/get-archetype.js +47 -0
- package/dist/tools/get-archetype.js.map +1 -0
- package/dist/tools/get-card.d.ts +13 -0
- package/dist/tools/get-card.d.ts.map +1 -0
- package/dist/tools/get-card.js +71 -0
- package/dist/tools/get-card.js.map +1 -0
- package/dist/tools/get-class-identity.d.ts +43 -0
- package/dist/tools/get-class-identity.d.ts.map +1 -0
- package/dist/tools/get-class-identity.js +69 -0
- package/dist/tools/get-class-identity.js.map +1 -0
- package/dist/tools/get-keyword.d.ts +30 -0
- package/dist/tools/get-keyword.d.ts.map +1 -0
- package/dist/tools/get-keyword.js +88 -0
- package/dist/tools/get-keyword.js.map +1 -0
- package/dist/tools/get-matchup.d.ts +32 -0
- package/dist/tools/get-matchup.d.ts.map +1 -0
- package/dist/tools/get-matchup.js +41 -0
- package/dist/tools/get-matchup.js.map +1 -0
- package/dist/tools/search-cards.d.ts +43 -0
- package/dist/tools/search-cards.d.ts.map +1 -0
- package/dist/tools/search-cards.js +167 -0
- package/dist/tools/search-cards.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// --- Types ---
|
|
2
|
+
// --- Signal helpers ---
|
|
3
|
+
function countCardsMatching(cards, test) {
|
|
4
|
+
return cards.filter(test).length;
|
|
5
|
+
}
|
|
6
|
+
function textContains(text, ...terms) {
|
|
7
|
+
if (!text)
|
|
8
|
+
return false;
|
|
9
|
+
const lower = text.toLowerCase();
|
|
10
|
+
return terms.some((t) => lower.includes(t.toLowerCase()));
|
|
11
|
+
}
|
|
12
|
+
function keywordsContain(keywords, term) {
|
|
13
|
+
if (!keywords)
|
|
14
|
+
return false;
|
|
15
|
+
const lower = keywords.toLowerCase();
|
|
16
|
+
return lower.includes(term.toLowerCase());
|
|
17
|
+
}
|
|
18
|
+
// --- Score calculators ---
|
|
19
|
+
function scoreAggro(profile) {
|
|
20
|
+
let score = 0;
|
|
21
|
+
const signals = [];
|
|
22
|
+
// Low average cost (<3.0): +3
|
|
23
|
+
if (profile.avg_cost < 3.0) {
|
|
24
|
+
score += 3;
|
|
25
|
+
signals.push(`Low average mana cost (${profile.avg_cost.toFixed(1)})`);
|
|
26
|
+
}
|
|
27
|
+
// Many 1-2 cost cards (>40% of deck): +2
|
|
28
|
+
const lowCostCount = (profile.mana_curve['1'] ?? 0) + (profile.mana_curve['2'] ?? 0);
|
|
29
|
+
if (profile.total_cards > 0 && lowCostCount / profile.total_cards > 0.4) {
|
|
30
|
+
score += 2;
|
|
31
|
+
signals.push(`${lowCostCount} cards costing 1-2 (${Math.round((lowCostCount / profile.total_cards) * 100)}% of deck)`);
|
|
32
|
+
}
|
|
33
|
+
// Cards with face damage / Charge / Rush: +1 each
|
|
34
|
+
const chargeCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'Charge') || keywordsContain(c.keywords, 'CHARGE'));
|
|
35
|
+
if (chargeCount > 0) {
|
|
36
|
+
score += Math.min(chargeCount, 3);
|
|
37
|
+
signals.push(`${chargeCount} card(s) with Charge`);
|
|
38
|
+
}
|
|
39
|
+
const faceDamageCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'deal damage to the enemy hero', 'face damage'));
|
|
40
|
+
if (faceDamageCount > 0) {
|
|
41
|
+
score += Math.min(faceDamageCount, 3);
|
|
42
|
+
signals.push(`${faceDamageCount} card(s) with face damage effects`);
|
|
43
|
+
}
|
|
44
|
+
const rushCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'Rush') || keywordsContain(c.keywords, 'RUSH'));
|
|
45
|
+
if (rushCount > 0) {
|
|
46
|
+
score += Math.min(rushCount, 2);
|
|
47
|
+
signals.push(`${rushCount} card(s) with Rush`);
|
|
48
|
+
}
|
|
49
|
+
// Few cards costing 6+: +1
|
|
50
|
+
const expensiveCount = (profile.mana_curve['6'] ?? 0) + (profile.mana_curve['7+'] ?? 0);
|
|
51
|
+
if (expensiveCount <= 2) {
|
|
52
|
+
score += 1;
|
|
53
|
+
signals.push('Few expensive cards');
|
|
54
|
+
}
|
|
55
|
+
return { score, signals };
|
|
56
|
+
}
|
|
57
|
+
function scoreControl(profile) {
|
|
58
|
+
let score = 0;
|
|
59
|
+
const signals = [];
|
|
60
|
+
// High average cost (>4.0): +3
|
|
61
|
+
if (profile.avg_cost > 4.0) {
|
|
62
|
+
score += 3;
|
|
63
|
+
signals.push(`High average mana cost (${profile.avg_cost.toFixed(1)})`);
|
|
64
|
+
}
|
|
65
|
+
// Cards with "destroy" / "remove" / "clear" text: +2
|
|
66
|
+
const removalCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'destroy', 'remove', 'clear'));
|
|
67
|
+
if (removalCount > 0) {
|
|
68
|
+
score += 2;
|
|
69
|
+
signals.push(`${removalCount} removal card(s)`);
|
|
70
|
+
}
|
|
71
|
+
// Cards with "heal" / "restore" / "armor": +2
|
|
72
|
+
const healCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'heal', 'restore', 'armor'));
|
|
73
|
+
if (healCount > 0) {
|
|
74
|
+
score += 2;
|
|
75
|
+
signals.push(`${healCount} healing/armor card(s)`);
|
|
76
|
+
}
|
|
77
|
+
// Cards costing 7+: +1 per card (max 3)
|
|
78
|
+
const sevenPlus = profile.mana_curve['7+'] ?? 0;
|
|
79
|
+
if (sevenPlus > 0) {
|
|
80
|
+
const bonus = Math.min(sevenPlus, 3);
|
|
81
|
+
score += bonus;
|
|
82
|
+
signals.push(`${sevenPlus} card(s) costing 7+`);
|
|
83
|
+
}
|
|
84
|
+
return { score, signals };
|
|
85
|
+
}
|
|
86
|
+
function scoreCombo(profile) {
|
|
87
|
+
let score = 0;
|
|
88
|
+
const signals = [];
|
|
89
|
+
// Many spells (>50% spells): +2
|
|
90
|
+
const spellCount = profile.type_distribution['SPELL'] ?? 0;
|
|
91
|
+
if (profile.total_cards > 0 && spellCount / profile.total_cards > 0.5) {
|
|
92
|
+
score += 2;
|
|
93
|
+
signals.push(`Spell-heavy deck (${Math.round((spellCount / profile.total_cards) * 100)}% spells)`);
|
|
94
|
+
}
|
|
95
|
+
// Cards with "draw" text: +1 per card (max 3)
|
|
96
|
+
const drawCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'draw'));
|
|
97
|
+
if (drawCount > 0) {
|
|
98
|
+
const bonus = Math.min(drawCount, 3);
|
|
99
|
+
score += bonus;
|
|
100
|
+
signals.push(`${drawCount} card draw effect(s)`);
|
|
101
|
+
}
|
|
102
|
+
// Low minion count (<10): +2
|
|
103
|
+
const minionCount = profile.type_distribution['MINION'] ?? 0;
|
|
104
|
+
if (minionCount < 10) {
|
|
105
|
+
score += 2;
|
|
106
|
+
signals.push(`Low minion count (${minionCount})`);
|
|
107
|
+
}
|
|
108
|
+
// Cards with COMBO mechanic: +2
|
|
109
|
+
const comboCount = countCardsMatching(profile.cards, (c) => keywordsContain(c.keywords, 'COMBO'));
|
|
110
|
+
if (comboCount > 0) {
|
|
111
|
+
score += 2;
|
|
112
|
+
signals.push(`${comboCount} card(s) with Combo keyword`);
|
|
113
|
+
}
|
|
114
|
+
return { score, signals };
|
|
115
|
+
}
|
|
116
|
+
function scoreMidrange(profile) {
|
|
117
|
+
let score = 0;
|
|
118
|
+
const signals = [];
|
|
119
|
+
// Average cost 3.0-4.5: +3
|
|
120
|
+
if (profile.avg_cost >= 3.0 && profile.avg_cost <= 4.5) {
|
|
121
|
+
score += 3;
|
|
122
|
+
signals.push(`Balanced average mana cost (${profile.avg_cost.toFixed(1)})`);
|
|
123
|
+
}
|
|
124
|
+
// Balanced curve (significant cards at 3, 4, 5 cost): +2
|
|
125
|
+
const midCards = (profile.mana_curve['3'] ?? 0) + (profile.mana_curve['4'] ?? 0) + (profile.mana_curve['5'] ?? 0);
|
|
126
|
+
if (midCards >= 10) {
|
|
127
|
+
score += 2;
|
|
128
|
+
signals.push(`Strong mid-game curve (${midCards} cards at 3-5 cost)`);
|
|
129
|
+
}
|
|
130
|
+
// Good mix of minions and spells (40-70% minions): +2
|
|
131
|
+
const minionCount = profile.type_distribution['MINION'] ?? 0;
|
|
132
|
+
if (profile.total_cards > 0) {
|
|
133
|
+
const minionPct = minionCount / profile.total_cards;
|
|
134
|
+
if (minionPct >= 0.4 && minionPct <= 0.7) {
|
|
135
|
+
score += 2;
|
|
136
|
+
signals.push(`Balanced minion/spell mix (${Math.round(minionPct * 100)}% minions)`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { score, signals };
|
|
140
|
+
}
|
|
141
|
+
function scoreTempo(profile) {
|
|
142
|
+
let score = 0;
|
|
143
|
+
const signals = [];
|
|
144
|
+
// Average cost 2.5-3.5: +2
|
|
145
|
+
if (profile.avg_cost >= 2.5 && profile.avg_cost <= 3.5) {
|
|
146
|
+
score += 2;
|
|
147
|
+
signals.push(`Tempo-friendly average cost (${profile.avg_cost.toFixed(1)})`);
|
|
148
|
+
}
|
|
149
|
+
// Weapons: +2
|
|
150
|
+
const weaponCount = profile.type_distribution['WEAPON'] ?? 0;
|
|
151
|
+
if (weaponCount > 0) {
|
|
152
|
+
score += 2;
|
|
153
|
+
signals.push(`${weaponCount} weapon(s)`);
|
|
154
|
+
}
|
|
155
|
+
// Cards with Rush: +1 each (max 2)
|
|
156
|
+
const rushCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'Rush') || keywordsContain(c.keywords, 'RUSH'));
|
|
157
|
+
if (rushCount > 0) {
|
|
158
|
+
const bonus = Math.min(rushCount, 2);
|
|
159
|
+
score += bonus;
|
|
160
|
+
signals.push(`${rushCount} Rush card(s)`);
|
|
161
|
+
}
|
|
162
|
+
// Good 1-3 curve: +2
|
|
163
|
+
const earlyCurve = (profile.mana_curve['1'] ?? 0) + (profile.mana_curve['2'] ?? 0) + (profile.mana_curve['3'] ?? 0);
|
|
164
|
+
if (earlyCurve >= 12) {
|
|
165
|
+
score += 2;
|
|
166
|
+
signals.push(`Strong early curve (${earlyCurve} cards at 1-3 cost)`);
|
|
167
|
+
}
|
|
168
|
+
return { score, signals };
|
|
169
|
+
}
|
|
170
|
+
function scoreValue(profile) {
|
|
171
|
+
let score = 0;
|
|
172
|
+
const signals = [];
|
|
173
|
+
// Cards with "Discover" / "generate" / "add.*to your hand" text: +2 per card (max 4)
|
|
174
|
+
const generateCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'Discover', 'generate', 'add') && textContains(c.text, 'hand'));
|
|
175
|
+
const discoverOnly = countCardsMatching(profile.cards, (c) => textContains(c.text, 'Discover') || keywordsContain(c.keywords, 'DISCOVER'));
|
|
176
|
+
const totalGen = Math.max(generateCount, discoverOnly);
|
|
177
|
+
if (totalGen > 0) {
|
|
178
|
+
const bonus = Math.min(totalGen * 2, 4);
|
|
179
|
+
score += bonus;
|
|
180
|
+
signals.push(`${totalGen} resource generation card(s)`);
|
|
181
|
+
}
|
|
182
|
+
// Cards with "copy" text: +1
|
|
183
|
+
const copyCount = countCardsMatching(profile.cards, (c) => textContains(c.text, 'copy'));
|
|
184
|
+
if (copyCount > 0) {
|
|
185
|
+
score += 1;
|
|
186
|
+
signals.push(`${copyCount} copy effect(s)`);
|
|
187
|
+
}
|
|
188
|
+
// High card count at 5+ cost: +1
|
|
189
|
+
const fivePlus = (profile.mana_curve['5'] ?? 0) + (profile.mana_curve['6'] ?? 0) + (profile.mana_curve['7+'] ?? 0);
|
|
190
|
+
if (fivePlus >= 8) {
|
|
191
|
+
score += 1;
|
|
192
|
+
signals.push(`${fivePlus} cards costing 5+`);
|
|
193
|
+
}
|
|
194
|
+
return { score, signals };
|
|
195
|
+
}
|
|
196
|
+
// --- Main classifier ---
|
|
197
|
+
export function classifyArchetype(profile) {
|
|
198
|
+
const scores = [
|
|
199
|
+
{ archetype: 'aggro', ...scoreAggro(profile) },
|
|
200
|
+
{ archetype: 'control', ...scoreControl(profile) },
|
|
201
|
+
{ archetype: 'combo', ...scoreCombo(profile) },
|
|
202
|
+
{ archetype: 'midrange', ...scoreMidrange(profile) },
|
|
203
|
+
{ archetype: 'tempo', ...scoreTempo(profile) },
|
|
204
|
+
{ archetype: 'value', ...scoreValue(profile) },
|
|
205
|
+
];
|
|
206
|
+
// Sort descending by score
|
|
207
|
+
scores.sort((a, b) => b.score - a.score);
|
|
208
|
+
const top = scores[0];
|
|
209
|
+
const second = scores[1];
|
|
210
|
+
const gap = top.score - second.score;
|
|
211
|
+
// Confidence based on gap
|
|
212
|
+
let confidence;
|
|
213
|
+
if (gap > 3) {
|
|
214
|
+
confidence = Math.min(0.8 + gap * 0.03, 1.0);
|
|
215
|
+
}
|
|
216
|
+
else if (gap >= 1) {
|
|
217
|
+
confidence = 0.5 + (gap - 1) * 0.1;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
confidence = Math.max(0.3, 0.5 - (1 - gap) * 0.2);
|
|
221
|
+
}
|
|
222
|
+
// Build reasoning from top archetype signals
|
|
223
|
+
const reasoning = top.signals.length > 0
|
|
224
|
+
? top.signals.join(', ') + ` suggest ${top.archetype === 'aggro' ? 'an aggressive' : `a ${top.archetype}`} strategy.`
|
|
225
|
+
: `Classified as ${top.archetype} based on overall deck composition.`;
|
|
226
|
+
return {
|
|
227
|
+
archetype: top.archetype,
|
|
228
|
+
confidence: Math.round(confidence * 100) / 100,
|
|
229
|
+
reasoning,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=archetype-classifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archetype-classifier.js","sourceRoot":"","sources":["../../src/knowledge/archetype-classifier.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAgBhB,yBAAyB;AAEzB,SAAS,kBAAkB,CAAC,KAA2B,EAAE,IAA6C;IACpG,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;AACnC,CAAC;AAED,SAAS,YAAY,CAAC,IAAmB,EAAE,GAAG,KAAe;IAC3D,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC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GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IACrC,CAAC;SAAM,CAAC;QACN,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IACpD,CAAC;IAED,6CAA6C;IAC7C,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QACtC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,YAAY,GAAG,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,SAAS,EAAE,YAAY;QACrH,CAAC,CAAC,iBAAiB,GAAG,CAAC,SAAS,qCAAqC,CAAC;IAExE,OAAO;QACL,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,GAAG,GAAG;QAC9C,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AA4C3C,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,aAgQjD"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { SearchCardsInput, searchCards } from './tools/search-cards.js';
|
|
6
|
+
import { GetCardInput, getCard } from './tools/get-card.js';
|
|
7
|
+
import { GetKeywordInput, getKeyword } from './tools/get-keyword.js';
|
|
8
|
+
import { DecodeDeckInput, decodeDeck } from './tools/decode-deck.js';
|
|
9
|
+
import { AnalyzeDeckInput, analyzeDeck } from './tools/analyze-deck.js';
|
|
10
|
+
import { GetArchetypeInput, getArchetype } from './tools/get-archetype.js';
|
|
11
|
+
import { GetClassIdentityInput, getClassIdentity, } from './tools/get-class-identity.js';
|
|
12
|
+
import { GetMatchupInput, getMatchup } from './tools/get-matchup.js';
|
|
13
|
+
import { ExplainConceptInput, explainConcept, } from './tools/explain-concept.js';
|
|
14
|
+
import { formatSearchCards, formatGetCard, formatGetKeyword, formatDecodeDeck, formatAnalyzeDeck, formatGetArchetype, formatGetClassIdentity, formatGetMatchup, formatExplainConcept, } from './format.js';
|
|
15
|
+
import { getDatabase } from './data/db.js';
|
|
16
|
+
import { runPipeline } from './data/pipeline.js';
|
|
17
|
+
import { seedStrategyKnowledge } from './data/strategy-seed.js';
|
|
18
|
+
function getVersion() {
|
|
19
|
+
try {
|
|
20
|
+
const require = createRequire(import.meta.url);
|
|
21
|
+
const pkg = require('../package.json');
|
|
22
|
+
return pkg.version;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return '0.0.0';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function createServer(db) {
|
|
29
|
+
const server = new McpServer({ name: 'hearthstone-oracle', version: getVersion() }, { capabilities: { tools: {} } });
|
|
30
|
+
// 1. search_cards
|
|
31
|
+
server.tool('search_cards', 'Search for Hearthstone cards by name, text, class, mana cost, type, rarity, set, or keyword. Use this when you need to find cards matching specific criteria. Returns a summary list — use get_card for full details on a specific card.', SearchCardsInput.shape, async (params) => {
|
|
32
|
+
try {
|
|
33
|
+
const result = searchCards(db, params);
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{ type: 'text', text: formatSearchCards(result) },
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
isError: true,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
// 2. get_card
|
|
53
|
+
server.tool('get_card', 'Get complete details for a specific Hearthstone card including stats, text, keywords, and type. Use this when you know the card name (or close to it) and need full information. Supports fuzzy matching.', GetCardInput.shape, async (params) => {
|
|
54
|
+
try {
|
|
55
|
+
const result = getCard(db, params);
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{ type: 'text', text: formatGetCard(result) },
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: 'text',
|
|
67
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
isError: true,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// 3. get_keyword
|
|
75
|
+
server.tool('get_keyword', 'Look up a Hearthstone keyword or mechanic (e.g., Battlecry, Deathrattle, Discover) and see all cards that have it. Use this to explain what a keyword does or find all cards with a specific mechanic.', GetKeywordInput.shape, async (params) => {
|
|
76
|
+
try {
|
|
77
|
+
const result = getKeyword(db, params);
|
|
78
|
+
return {
|
|
79
|
+
content: [
|
|
80
|
+
{ type: 'text', text: formatGetKeyword(result) },
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return {
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: 'text',
|
|
89
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
isError: true,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
// 4. decode_deck
|
|
97
|
+
server.tool('decode_deck', 'Decode a Hearthstone deck code into its full card list with mana curve and card type breakdown. Use this when a user shares a deck code and wants to see what\'s in it.', DecodeDeckInput.shape, async (params) => {
|
|
98
|
+
try {
|
|
99
|
+
const result = decodeDeck(db, params);
|
|
100
|
+
return {
|
|
101
|
+
content: [
|
|
102
|
+
{ type: 'text', text: formatDecodeDeck(result) },
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return {
|
|
108
|
+
content: [
|
|
109
|
+
{
|
|
110
|
+
type: 'text',
|
|
111
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
isError: true,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
// 5. analyze_deck
|
|
119
|
+
server.tool('analyze_deck', 'Analyze a Hearthstone deck code to classify its archetype, explain its gameplan, identify strengths and weaknesses, and predict matchup dynamics. Use this for strategic deck coaching — it combines card data with strategy knowledge.', AnalyzeDeckInput.shape, async (params) => {
|
|
120
|
+
try {
|
|
121
|
+
const result = analyzeDeck(db, params);
|
|
122
|
+
return {
|
|
123
|
+
content: [
|
|
124
|
+
{ type: 'text', text: formatAnalyzeDeck(result) },
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
return {
|
|
130
|
+
content: [
|
|
131
|
+
{
|
|
132
|
+
type: 'text',
|
|
133
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
isError: true,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
// 6. get_archetype
|
|
141
|
+
server.tool('get_archetype', 'Get a detailed explanation of a Hearthstone deck archetype (aggro, control, combo, midrange, tempo, value). Includes gameplan, win conditions, strengths, weaknesses, and example decks. Use this when explaining deck building strategy.', GetArchetypeInput.shape, async (params) => {
|
|
142
|
+
try {
|
|
143
|
+
const result = getArchetype(db, params);
|
|
144
|
+
return {
|
|
145
|
+
content: [
|
|
146
|
+
{ type: 'text', text: formatGetArchetype(result) },
|
|
147
|
+
],
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
return {
|
|
152
|
+
content: [
|
|
153
|
+
{
|
|
154
|
+
type: 'text',
|
|
155
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
isError: true,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
// 7. get_class_identity
|
|
163
|
+
server.tool('get_class_identity', 'Get the strategic identity of a Hearthstone class — hero power implications, historical archetypes, strengths, weaknesses, and how the class approaches each game phase. Omit the class name to get an overview of all 11 classes.', GetClassIdentityInput.shape, async (params) => {
|
|
164
|
+
try {
|
|
165
|
+
const result = getClassIdentity(db, params);
|
|
166
|
+
return {
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: 'text',
|
|
170
|
+
text: formatGetClassIdentity(result),
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
return {
|
|
177
|
+
content: [
|
|
178
|
+
{
|
|
179
|
+
type: 'text',
|
|
180
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
isError: true,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
// 8. get_matchup
|
|
188
|
+
server.tool('get_matchup', 'Get the theoretical matchup dynamics between two Hearthstone archetypes. Explains who is favoured, why, the key strategic tension, and what each side should prioritise.', GetMatchupInput.shape, async (params) => {
|
|
189
|
+
try {
|
|
190
|
+
const result = getMatchup(db, params);
|
|
191
|
+
return {
|
|
192
|
+
content: [
|
|
193
|
+
{ type: 'text', text: formatGetMatchup(result) },
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
catch (err) {
|
|
198
|
+
return {
|
|
199
|
+
content: [
|
|
200
|
+
{
|
|
201
|
+
type: 'text',
|
|
202
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
isError: true,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
// 9. explain_concept
|
|
210
|
+
server.tool('explain_concept', 'Explain a fundamental Hearthstone game concept like card advantage, tempo, value, board control, or mana curve. Includes how the concept applies specifically to Hearthstone.', ExplainConceptInput.shape, async (params) => {
|
|
211
|
+
try {
|
|
212
|
+
const result = explainConcept(db, params);
|
|
213
|
+
return {
|
|
214
|
+
content: [
|
|
215
|
+
{
|
|
216
|
+
type: 'text',
|
|
217
|
+
text: formatExplainConcept(result),
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
catch (err) {
|
|
223
|
+
return {
|
|
224
|
+
content: [
|
|
225
|
+
{
|
|
226
|
+
type: 'text',
|
|
227
|
+
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
isError: true,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
return server;
|
|
235
|
+
}
|
|
236
|
+
async function main() {
|
|
237
|
+
const version = getVersion();
|
|
238
|
+
const db = getDatabase();
|
|
239
|
+
// Run data pipeline
|
|
240
|
+
try {
|
|
241
|
+
console.error('[hearthstone-oracle] Starting data pipeline...');
|
|
242
|
+
const cardCount = await runPipeline(db);
|
|
243
|
+
console.error(`[hearthstone-oracle] Pipeline: ok (${cardCount} cards)`);
|
|
244
|
+
}
|
|
245
|
+
catch (err) {
|
|
246
|
+
console.error(`[hearthstone-oracle] Pipeline error: ${err instanceof Error ? err.message : String(err)}`);
|
|
247
|
+
console.error('[hearthstone-oracle] Continuing with existing data (if any)...');
|
|
248
|
+
}
|
|
249
|
+
// Seed strategy knowledge
|
|
250
|
+
seedStrategyKnowledge(db);
|
|
251
|
+
const server = createServer(db);
|
|
252
|
+
const transport = new StdioServerTransport();
|
|
253
|
+
console.error(`[hearthstone-oracle] v${version} starting on stdio...`);
|
|
254
|
+
await server.connect(transport);
|
|
255
|
+
console.error('[hearthstone-oracle] Server running — 9 tools registered');
|
|
256
|
+
process.on('SIGINT', async () => {
|
|
257
|
+
await server.close();
|
|
258
|
+
process.exit(0);
|
|
259
|
+
});
|
|
260
|
+
process.on('SIGTERM', async () => {
|
|
261
|
+
await server.close();
|
|
262
|
+
process.exit(0);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
main().catch((err) => {
|
|
266
|
+
console.error(`[hearthstone-oracle] Fatal: ${err instanceof Error ? err.message : String(err)}`);
|
|
267
|
+
process.exit(1);
|
|
268
|
+
});
|
|
269
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC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45 @@
|
|
|
1
|
+
import type Database from 'better-sqlite3';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { type ClassificationResult } from '../knowledge/archetype-classifier.js';
|
|
4
|
+
export declare const AnalyzeDeckInput: z.ZodObject<{
|
|
5
|
+
deck_code: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
deck_code: string;
|
|
8
|
+
}, {
|
|
9
|
+
deck_code: string;
|
|
10
|
+
}>;
|
|
11
|
+
export type AnalyzeDeckInputType = z.infer<typeof AnalyzeDeckInput>;
|
|
12
|
+
export interface AnalyzeDeckSuccess {
|
|
13
|
+
success: true;
|
|
14
|
+
deck: {
|
|
15
|
+
format: string;
|
|
16
|
+
hero_class: string;
|
|
17
|
+
cards: Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
mana_cost: number | null;
|
|
20
|
+
count: number;
|
|
21
|
+
}>;
|
|
22
|
+
total_cards: number;
|
|
23
|
+
mana_curve: Record<string, number>;
|
|
24
|
+
type_distribution: Record<string, number>;
|
|
25
|
+
};
|
|
26
|
+
classification: ClassificationResult;
|
|
27
|
+
archetype_info?: {
|
|
28
|
+
description: string;
|
|
29
|
+
gameplan: string;
|
|
30
|
+
strengths: string[];
|
|
31
|
+
weaknesses: string[];
|
|
32
|
+
};
|
|
33
|
+
matchups?: Array<{
|
|
34
|
+
vs_archetype: string;
|
|
35
|
+
favoured: string;
|
|
36
|
+
key_tension: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export interface AnalyzeDeckError {
|
|
40
|
+
success: false;
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
43
|
+
export type AnalyzeDeckResult = AnalyzeDeckSuccess | AnalyzeDeckError;
|
|
44
|
+
export declare function analyzeDeck(db: Database.Database, input: AnalyzeDeckInputType): AnalyzeDeckResult;
|
|
45
|
+
//# sourceMappingURL=analyze-deck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analy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