comparatasas 0.0.1-alpha.0 → 1.0.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 ADDED
@@ -0,0 +1,51 @@
1
+ # comparatasas
2
+
3
+ CLI + MCP oficial para [Compara Tasas](https://comparatasas.ar).
4
+
5
+ Los datos salen de [ArgentinaDatos](https://api.argentinadatos.com) (la misma API que usa el sitio).
6
+
7
+ ## Uso
8
+
9
+ ```bash
10
+ npx -y comparatasas@1.0.0 ayuda
11
+ npx -y comparatasas@1.0.0 cuentas
12
+ npx -y comparatasas@1.0.0 plazos-fijos
13
+ npx -y comparatasas@1.0.0 plazos-fijos-usd
14
+ npx -y comparatasas@1.0.0 crypto
15
+ npx -y comparatasas@1.0.0 mejor
16
+ npx -y comparatasas@1.0.0 salud --json
17
+ ```
18
+
19
+ Flags útiles: `--json`, `--limit 10`, `--entidad galicia`.
20
+
21
+ ## MCP
22
+
23
+ ```bash
24
+ npx -y comparatasas@1.0.0 mcp
25
+ ```
26
+
27
+ Herramientas: `get_best`, `get_cuentas`, `get_plazos_fijos`, `get_crypto_yields`, `get_health`.
28
+
29
+ Config típica (Cursor / Claude Desktop):
30
+
31
+ ```json
32
+ {
33
+ "mcpServers": {
34
+ "comparatasas": {
35
+ "command": "npx",
36
+ "args": ["-y", "comparatasas@1.0.0", "mcp"]
37
+ }
38
+ }
39
+ }
40
+ ```
41
+
42
+ ## Local (monorepo)
43
+
44
+ ```bash
45
+ pnpm --filter comparatasas smoke
46
+ pnpm cli cuentas
47
+ ```
48
+
49
+ ## Publish
50
+
51
+ Tag: `comparatasas-cli-v1.0.0` → workflow Trusted Publisher OIDC.
@@ -0,0 +1,286 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI oficial de Compara Tasas — https://comparatasas.ar
4
+ * Datos: https://api.argentinadatos.com (misma fuente que el sitio)
5
+ *
6
+ * comparatasas cuentas
7
+ * comparatasas plazos-fijos
8
+ * comparatasas plazos-fijos-usd
9
+ * comparatasas crypto
10
+ * comparatasas mejor | best
11
+ * comparatasas mcp
12
+ * comparatasas salud | health
13
+ * comparatasas ayuda | help
14
+ */
15
+
16
+ import {
17
+ API,
18
+ PRODUCTS,
19
+ SITE,
20
+ formatTna,
21
+ getJson,
22
+ nameOfCuenta,
23
+ nameOfPlazo,
24
+ summarizeBestCuentas,
25
+ summarizeBestPlazos,
26
+ tnaOf,
27
+ } from '../src/api.mjs'
28
+
29
+ const HELP = `comparatasas — CLI de Compara Tasas (tasas en Argentina)
30
+
31
+ Listados:
32
+ comparatasas cuentas
33
+ comparatasas plazos-fijos
34
+ comparatasas plazos-fijos-usd
35
+ comparatasas crypto | rendimientos
36
+
37
+ Resumen:
38
+ comparatasas mejor | best top TNA cuentas + plazos fijos
39
+
40
+ MCP (Model Context Protocol, stdio):
41
+ comparatasas mcp
42
+ (Cursor, Claude Desktop, VS Code, etc.)
43
+
44
+ Otros:
45
+ salud | health | estado
46
+ ayuda | help
47
+
48
+ Flags:
49
+ --json salida JSON
50
+ --limit <n> tope de filas en tablas (default 20)
51
+ --entidad <texto> filtrar por nombre (substring)
52
+
53
+ Env:
54
+ COMPARATASAS_API_URL base finanzas (default ${API})
55
+
56
+ Sitio: ${SITE}
57
+ Datos: ${API}
58
+ `
59
+
60
+ function parseArgs(argv) {
61
+ const out = { cmd: null, flags: { json: false, limit: 20, entidad: null } }
62
+ const rest = []
63
+ for (let i = 0; i < argv.length; i++) {
64
+ const a = argv[i]
65
+ if (a === '--json') out.flags.json = true
66
+ else if (a === '--limit' && argv[i + 1]) {
67
+ out.flags.limit = Math.max(1, Number(argv[++i]) || 20)
68
+ } else if (a === '--entidad' && argv[i + 1]) {
69
+ out.flags.entidad = String(argv[++i]).toLowerCase()
70
+ } else if (!a.startsWith('-')) rest.push(a)
71
+ }
72
+ out.cmd = (rest[0] || 'ayuda').toLowerCase()
73
+ out.rest = rest.slice(1)
74
+ return out
75
+ }
76
+
77
+ function printJson(data) {
78
+ process.stdout.write(`${JSON.stringify(data, null, 2)}\n`)
79
+ }
80
+
81
+ function filterByName(rows, entidad, nameFn) {
82
+ if (!entidad) return rows
83
+ return rows.filter((r) => nameFn(r).toLowerCase().includes(entidad))
84
+ }
85
+
86
+ function printTable(headers, rows) {
87
+ const widths = headers.map((h, i) =>
88
+ Math.max(h.length, ...rows.map((r) => String(r[i] ?? '').length)),
89
+ )
90
+ const line = (cells) =>
91
+ cells.map((c, i) => String(c ?? '').padEnd(widths[i])).join(' ')
92
+ console.log(line(headers))
93
+ console.log(widths.map((w) => '-'.repeat(w)).join(' '))
94
+ for (const row of rows) console.log(line(row))
95
+ }
96
+
97
+ async function cmdCuentas(flags) {
98
+ let rows = await getJson(PRODUCTS.cuentas.path)
99
+ if (!Array.isArray(rows)) rows = []
100
+ rows = filterByName(rows, flags.entidad, nameOfCuenta)
101
+ rows = [...rows].sort((a, b) => (tnaOf(b) ?? -1) - (tnaOf(a) ?? -1))
102
+ if (flags.json) {
103
+ printJson({ product: 'cuentas', api: `${API}${PRODUCTS.cuentas.path}`, count: rows.length, rows })
104
+ return
105
+ }
106
+ const slice = rows.slice(0, flags.limit)
107
+ printTable(
108
+ ['ENTIDAD', 'TNA', 'TEA', 'TOPE', 'CONDICIONES'],
109
+ slice.map((r) => [
110
+ nameOfCuenta(r),
111
+ formatTna(tnaOf(r)),
112
+ formatTna(r.tea),
113
+ r.tope ? `$${Number(r.tope).toLocaleString('es-AR')}` : '—',
114
+ (r.condicionesCorto || r.condiciones || '—').slice(0, 40),
115
+ ]),
116
+ )
117
+ console.log(`\n${rows.length} cuentas · mostrando ${slice.length} · ${SITE}/`)
118
+ }
119
+
120
+ async function cmdPlazos(flags, productKey) {
121
+ const meta = PRODUCTS[productKey]
122
+ let rows = await getJson(meta.path)
123
+ if (!Array.isArray(rows)) rows = []
124
+ rows = filterByName(rows, flags.entidad, nameOfPlazo)
125
+ rows = [...rows].sort((a, b) => (tnaOf(b) ?? -1) - (tnaOf(a) ?? -1))
126
+ if (flags.json) {
127
+ printJson({ product: productKey, api: `${API}${meta.path}`, count: rows.length, rows })
128
+ return
129
+ }
130
+ const slice = rows.slice(0, flags.limit)
131
+ printTable(
132
+ ['ENTIDAD', 'TNA clientes', 'TNA no clientes', 'CONDICIONES'],
133
+ slice.map((r) => [
134
+ nameOfPlazo(r),
135
+ formatTna(r.tnaClientes ?? r.tna),
136
+ formatTna(r.tnaNoClientes),
137
+ (r.condicionesCorto || '—').slice(0, 36),
138
+ ]),
139
+ )
140
+ console.log(
141
+ `\n${rows.length} entidades · mostrando ${slice.length} · ${SITE}${meta.site}`,
142
+ )
143
+ }
144
+
145
+ async function cmdCrypto(flags) {
146
+ let rows = await getJson(PRODUCTS.crypto.path)
147
+ if (!Array.isArray(rows)) rows = []
148
+ if (flags.entidad) {
149
+ rows = rows.filter((r) =>
150
+ String(r.entidad || '')
151
+ .toLowerCase()
152
+ .includes(flags.entidad),
153
+ )
154
+ }
155
+ if (flags.json) {
156
+ printJson({ product: 'crypto', api: `${API}${PRODUCTS.crypto.path}`, count: rows.length, rows })
157
+ return
158
+ }
159
+ const flat = []
160
+ for (const ent of rows) {
161
+ for (const r of ent.rendimientos || []) {
162
+ flat.push([
163
+ ent.entidad,
164
+ r.moneda,
165
+ typeof r.apy === 'number' ? `${r.apy}%` : '—',
166
+ r.fecha || '—',
167
+ ])
168
+ }
169
+ }
170
+ const slice = flat.slice(0, flags.limit)
171
+ printTable(['ENTIDAD', 'MONEDA', 'APY', 'FECHA'], slice)
172
+ console.log(`\n${flat.length} filas · mostrando ${slice.length} · ${SITE}/crypto`)
173
+ }
174
+
175
+ async function cmdBest(flags) {
176
+ const [cuentas, plazos] = await Promise.all([
177
+ getJson(PRODUCTS.cuentas.path),
178
+ getJson(PRODUCTS['plazos-fijos'].path),
179
+ ])
180
+ const summary = {
181
+ cuentas: summarizeBestCuentas(cuentas),
182
+ plazosFijos: summarizeBestPlazos(plazos),
183
+ site: SITE,
184
+ api: API,
185
+ }
186
+ if (flags.json) {
187
+ printJson(summary)
188
+ return
189
+ }
190
+ console.log('Mejor cuenta remunerada (TNA):')
191
+ if (summary.cuentas.best) {
192
+ console.log(
193
+ ` ${summary.cuentas.best.name} ${formatTna(summary.cuentas.best.tna)}`,
194
+ )
195
+ } else console.log(' —')
196
+ console.log('\nMejor plazo fijo ARS (TNA clientes):')
197
+ if (summary.plazosFijos.best) {
198
+ console.log(
199
+ ` ${summary.plazosFijos.best.name} ${formatTna(summary.plazosFijos.best.tna)}`,
200
+ )
201
+ } else console.log(' —')
202
+ console.log(`\nTop 5 cuentas:`)
203
+ for (const r of summary.cuentas.top5) {
204
+ console.log(` ${formatTna(r.tna).padStart(7)} ${r.name}`)
205
+ }
206
+ console.log(`\nTop 5 plazos fijos:`)
207
+ for (const r of summary.plazosFijos.top5) {
208
+ console.log(` ${formatTna(r.tna).padStart(7)} ${r.name}`)
209
+ }
210
+ }
211
+
212
+ async function cmdHealth(flags) {
213
+ const started = Date.now()
214
+ const cuentas = await getJson(PRODUCTS.cuentas.path)
215
+ const payload = {
216
+ ok: Array.isArray(cuentas) && cuentas.length > 0,
217
+ latencyMs: Date.now() - started,
218
+ api: API,
219
+ site: SITE,
220
+ cuentas: Array.isArray(cuentas) ? cuentas.length : 0,
221
+ }
222
+ if (flags.json) printJson(payload)
223
+ else {
224
+ console.log(payload.ok ? 'OK' : 'FAIL')
225
+ console.log(` API ${API}`)
226
+ console.log(` ${payload.cuentas} cuentas · ${payload.latencyMs} ms`)
227
+ }
228
+ if (!payload.ok) process.exitCode = 1
229
+ }
230
+
231
+ async function main() {
232
+ const { cmd, flags } = parseArgs(process.argv.slice(2))
233
+
234
+ if (['ayuda', 'help', '-h', '--help'].includes(cmd)) {
235
+ console.log(HELP)
236
+ return
237
+ }
238
+
239
+ if (['mcp', 'server'].includes(cmd)) {
240
+ await import('../src/mcp.mjs')
241
+ return
242
+ }
243
+
244
+ if (['salud', 'health', 'estado'].includes(cmd)) {
245
+ await cmdHealth(flags)
246
+ return
247
+ }
248
+
249
+ if (['cuentas', 'cuenta', 'billeteras'].includes(cmd)) {
250
+ await cmdCuentas(flags)
251
+ return
252
+ }
253
+
254
+ if (['plazos-fijos', 'plazofijo', 'pf', 'plazo-fijo'].includes(cmd)) {
255
+ await cmdPlazos(flags, 'plazos-fijos')
256
+ return
257
+ }
258
+
259
+ if (
260
+ ['plazos-fijos-usd', 'plazofijo-usd', 'pf-usd', 'plazo-fijo-usd'].includes(
261
+ cmd,
262
+ )
263
+ ) {
264
+ await cmdPlazos(flags, 'plazos-fijos-usd')
265
+ return
266
+ }
267
+
268
+ if (['crypto', 'cripto', 'rendimientos'].includes(cmd)) {
269
+ await cmdCrypto(flags)
270
+ return
271
+ }
272
+
273
+ if (['mejor', 'best', 'top'].includes(cmd)) {
274
+ await cmdBest(flags)
275
+ return
276
+ }
277
+
278
+ console.error(`Comando desconocido: ${cmd}\n`)
279
+ console.log(HELP)
280
+ process.exitCode = 1
281
+ }
282
+
283
+ main().catch((err) => {
284
+ console.error(err instanceof Error ? err.message : err)
285
+ process.exitCode = 1
286
+ })
package/package.json CHANGED
@@ -1,12 +1,46 @@
1
1
  {
2
2
  "name": "comparatasas",
3
- "version": "0.0.1-alpha.0",
4
- "main": "index.js",
3
+ "version": "1.0.0",
4
+ "mcpName": "io.github.enzonotario/comparatasas",
5
+ "description": "CLI + MCP de Compara Tasas (cuentas remuneradas, plazos fijos, crypto; datos vía ArgentinaDatos)",
6
+ "type": "module",
7
+ "bin": {
8
+ "comparatasas": "bin/comparatasas.mjs"
9
+ },
5
10
  "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
11
+ "start": "node ./bin/comparatasas.mjs",
12
+ "cli": "node ./bin/comparatasas.mjs",
13
+ "smoke": "node ./scripts/smoke.mjs"
7
14
  },
8
- "keywords": [],
9
- "author": "",
15
+ "files": [
16
+ "bin",
17
+ "src",
18
+ "README.md"
19
+ ],
20
+ "keywords": [
21
+ "comparatasas",
22
+ "argentina",
23
+ "tasas",
24
+ "tna",
25
+ "plazo-fijo",
26
+ "cuentas-remuneradas",
27
+ "cli",
28
+ "mcp",
29
+ "model-context-protocol"
30
+ ],
31
+ "author": "Enzo Notario <hi@enzonotario.me>",
10
32
  "license": "MIT",
11
- "description": ""
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/enzonotario/comparatasas.ar.git",
36
+ "directory": "packages/cli"
37
+ },
38
+ "homepage": "https://comparatasas.ar",
39
+ "engines": {
40
+ "node": ">=18"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.32.0",
44
+ "zod": "^3.25.0"
45
+ }
12
46
  }
package/src/api.mjs ADDED
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Shared fetch helpers for ComparaTasas CLI/MCP.
3
+ * Data comes from ArgentinaDatos (same source as comparatasas.ar).
4
+ */
5
+
6
+ export const API =
7
+ process.env.COMPARATASAS_API_URL?.replace(/\/$/, '') ||
8
+ 'https://api.argentinadatos.com/v1/finanzas'
9
+
10
+ export const SITE = 'https://comparatasas.ar'
11
+
12
+ /** @type {Record<string, { path: string, site: string, label: string }>} */
13
+ export const PRODUCTS = {
14
+ cuentas: {
15
+ path: '/fci/otros/ultimo',
16
+ site: '/',
17
+ label: 'Cuentas remuneradas / billeteras',
18
+ },
19
+ 'plazos-fijos': {
20
+ path: '/tasas/plazoFijo',
21
+ site: '/plazos-fijos',
22
+ label: 'Plazos fijos ARS',
23
+ },
24
+ 'plazos-fijos-usd': {
25
+ path: '/tasas/plazoFijoUsd',
26
+ site: '/usd/plazos-fijos',
27
+ label: 'Plazos fijos USD',
28
+ },
29
+ crypto: {
30
+ path: '/rendimientos',
31
+ site: '/crypto',
32
+ label: 'Rendimientos crypto',
33
+ },
34
+ }
35
+
36
+ export async function getJson(path) {
37
+ const url = path.startsWith('http') ? path : `${API}${path}`
38
+ const res = await fetch(url, {
39
+ headers: { Accept: 'application/json' },
40
+ })
41
+ if (!res.ok) {
42
+ throw new Error(`${res.status} ${res.statusText} for ${url}`)
43
+ }
44
+ return res.json()
45
+ }
46
+
47
+ export function pct(n) {
48
+ if (typeof n !== 'number' || !Number.isFinite(n)) return null
49
+ // ArgentinaDatos often publishes TNA as 0.22 (= 22%)
50
+ const asPct = Math.abs(n) <= 1 ? n * 100 : n
51
+ return asPct
52
+ }
53
+
54
+ export function formatTna(n) {
55
+ const p = pct(n)
56
+ if (p == null) return '—'
57
+ return `${p.toFixed(2)}%`
58
+ }
59
+
60
+ export function nameOfCuenta(row) {
61
+ return row.fondo || row.entidad || row.nombre || '?'
62
+ }
63
+
64
+ export function nameOfPlazo(row) {
65
+ return row.nombreComercial || row.entidad || row.fondo || '?'
66
+ }
67
+
68
+ export function tnaOf(row) {
69
+ const n = row.tnaClientes ?? row.tna ?? row.tnaNoClientes
70
+ return typeof n === 'number' && Number.isFinite(n) ? n : null
71
+ }
72
+
73
+ export function summarizeBestCuentas(rows) {
74
+ const list = (Array.isArray(rows) ? rows : [])
75
+ .map((r) => ({ name: nameOfCuenta(r), tna: tnaOf(r), raw: r }))
76
+ .filter((r) => r.tna != null && r.tna > 0)
77
+ list.sort((a, b) => b.tna - a.tna)
78
+ const top = list[0]
79
+ return {
80
+ best: top
81
+ ? {
82
+ name: top.name,
83
+ tna: top.tna,
84
+ tnaPct: pct(top.tna),
85
+ condiciones: top.raw.condicionesCorto || top.raw.condiciones || null,
86
+ }
87
+ : null,
88
+ top5: list.slice(0, 5).map((r) => ({
89
+ name: r.name,
90
+ tna: r.tna,
91
+ tnaPct: pct(r.tna),
92
+ })),
93
+ count: list.length,
94
+ }
95
+ }
96
+
97
+ export function summarizeBestPlazos(rows) {
98
+ const list = (Array.isArray(rows) ? rows : [])
99
+ .map((r) => ({ name: nameOfPlazo(r), tna: tnaOf(r), raw: r }))
100
+ .filter((r) => r.tna != null && r.tna > 0)
101
+ list.sort((a, b) => b.tna - a.tna)
102
+ const top = list[0]
103
+ return {
104
+ best: top
105
+ ? {
106
+ name: top.name,
107
+ tna: top.tna,
108
+ tnaPct: pct(top.tna),
109
+ condiciones: top.raw.condicionesCorto || top.raw.condiciones || null,
110
+ }
111
+ : null,
112
+ top5: list.slice(0, 5).map((r) => ({
113
+ name: r.name,
114
+ tna: r.tna,
115
+ tnaPct: pct(r.tna),
116
+ })),
117
+ count: list.length,
118
+ }
119
+ }
package/src/mcp.mjs ADDED
@@ -0,0 +1,177 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * MCP stdio server for Compara Tasas (ArgentinaDatos-backed).
4
+ * Spawned by: comparatasas mcp
5
+ */
6
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
7
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
8
+ import { z } from 'zod'
9
+ import {
10
+ API,
11
+ PRODUCTS,
12
+ SITE,
13
+ getJson,
14
+ summarizeBestCuentas,
15
+ summarizeBestPlazos,
16
+ } from './api.mjs'
17
+
18
+ function textResult(data) {
19
+ return {
20
+ content: [
21
+ {
22
+ type: 'text',
23
+ text: typeof data === 'string' ? data : JSON.stringify(data, null, 2),
24
+ },
25
+ ],
26
+ }
27
+ }
28
+
29
+ function errorResult(err) {
30
+ return {
31
+ isError: true,
32
+ content: [
33
+ {
34
+ type: 'text',
35
+ text: err instanceof Error ? err.message : String(err),
36
+ },
37
+ ],
38
+ }
39
+ }
40
+
41
+ const server = new McpServer({
42
+ name: 'comparatasas',
43
+ version: '1.0.0',
44
+ })
45
+
46
+ server.tool(
47
+ 'get_health',
48
+ 'Check that ArgentinaDatos finanzas endpoints used by Compara Tasas respond.',
49
+ {},
50
+ async () => {
51
+ try {
52
+ const started = Date.now()
53
+ const cuentas = await getJson(PRODUCTS.cuentas.path)
54
+ return textResult({
55
+ ok: Array.isArray(cuentas) && cuentas.length > 0,
56
+ latencyMs: Date.now() - started,
57
+ api: API,
58
+ site: SITE,
59
+ cuentas: Array.isArray(cuentas) ? cuentas.length : 0,
60
+ })
61
+ } catch (err) {
62
+ return errorResult(err)
63
+ }
64
+ },
65
+ )
66
+
67
+ server.tool(
68
+ 'get_cuentas',
69
+ 'Latest TNA/TEA for Argentine remunerated accounts / wallets (home ranking on comparatasas.ar).',
70
+ {
71
+ limit: z
72
+ .number()
73
+ .int()
74
+ .positive()
75
+ .max(200)
76
+ .optional()
77
+ .describe('Max rows to return after sorting by TNA (default: all)'),
78
+ },
79
+ async ({ limit }) => {
80
+ try {
81
+ let rows = await getJson(PRODUCTS.cuentas.path)
82
+ if (!Array.isArray(rows)) rows = []
83
+ rows = [...rows].sort(
84
+ (a, b) => (b.tna ?? b.tnaClientes ?? 0) - (a.tna ?? a.tnaClientes ?? 0),
85
+ )
86
+ if (limit) rows = rows.slice(0, limit)
87
+ return textResult({
88
+ product: 'cuentas',
89
+ site: `${SITE}/`,
90
+ api: `${API}${PRODUCTS.cuentas.path}`,
91
+ count: rows.length,
92
+ rows,
93
+ })
94
+ } catch (err) {
95
+ return errorResult(err)
96
+ }
97
+ },
98
+ )
99
+
100
+ server.tool(
101
+ 'get_plazos_fijos',
102
+ 'Latest plazo fijo rates (ARS or USD) across banks and wallets.',
103
+ {
104
+ currency: z
105
+ .enum(['ars', 'usd'])
106
+ .default('ars')
107
+ .describe('ars = plazos fijos pesos; usd = plazos fijos en dólares'),
108
+ },
109
+ async ({ currency }) => {
110
+ try {
111
+ const key = currency === 'usd' ? 'plazos-fijos-usd' : 'plazos-fijos'
112
+ const meta = PRODUCTS[key]
113
+ let rows = await getJson(meta.path)
114
+ if (!Array.isArray(rows)) rows = []
115
+ return textResult({
116
+ product: key,
117
+ currency,
118
+ site: `${SITE}${meta.site}`,
119
+ api: `${API}${meta.path}`,
120
+ count: rows.length,
121
+ rows,
122
+ })
123
+ } catch (err) {
124
+ return errorResult(err)
125
+ }
126
+ },
127
+ )
128
+
129
+ server.tool(
130
+ 'get_crypto_yields',
131
+ 'Crypto yield APYs by exchange/wallet (rendimientos).',
132
+ {},
133
+ async () => {
134
+ try {
135
+ let rows = await getJson(PRODUCTS.crypto.path)
136
+ if (!Array.isArray(rows)) rows = []
137
+ return textResult({
138
+ product: 'crypto',
139
+ site: `${SITE}/crypto`,
140
+ api: `${API}${PRODUCTS.crypto.path}`,
141
+ count: rows.length,
142
+ rows,
143
+ })
144
+ } catch (err) {
145
+ return errorResult(err)
146
+ }
147
+ },
148
+ )
149
+
150
+ server.tool(
151
+ 'get_best',
152
+ 'Summary like the website: best remunerated account TNA and best plazo fijo ARS TNA, plus top 5.',
153
+ {},
154
+ async () => {
155
+ try {
156
+ const [cuentas, plazos] = await Promise.all([
157
+ getJson(PRODUCTS.cuentas.path),
158
+ getJson(PRODUCTS['plazos-fijos'].path),
159
+ ])
160
+ return textResult({
161
+ site: SITE,
162
+ api: API,
163
+ labels: {
164
+ bestCuenta: 'Mejor cuenta remunerada',
165
+ bestPlazoFijo: 'Mejor plazo fijo ARS',
166
+ },
167
+ cuentas: summarizeBestCuentas(cuentas),
168
+ plazosFijos: summarizeBestPlazos(plazos),
169
+ })
170
+ } catch (err) {
171
+ return errorResult(err)
172
+ }
173
+ },
174
+ )
175
+
176
+ const transport = new StdioServerTransport()
177
+ await server.connect(transport)
package/package.json.save DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "name": "json-",
3
- "version": "0.0.1-alpha.0",
4
- "main": "index.js",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
7
- },
8
- "keywords": [],
9
- "author": "",
10
- "license": "MIT",
11
- "description": ""
12
- }