@hidechae/eztab-mcp 0.5.2 → 0.6.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 +13 -1
- package/dist/server.js +59 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,6 +102,7 @@ Run standalone for testing: `task mcp` (or `npx tsx mcp/server.ts`).
|
|
|
102
102
|
| `add_measures` / `remove_measure` | Insert/remove measures (keys & sections re-anchored) |
|
|
103
103
|
| `set_tuning` | Replace tuning / string count (`track` で対象パートを指定) |
|
|
104
104
|
| `add_track` / `remove_track` | パート(ベース・2本目のギターなど)の追加・削除。メインを含めて最大4、track 0(メイン)は削除不可 |
|
|
105
|
+
| `set_tone` | パートの再生音色を設定する(`track` で対象パートを指定)。`add_track` でも `tone` を指定できる |
|
|
105
106
|
|
|
106
107
|
### 複数パート(トラック)
|
|
107
108
|
|
|
@@ -113,10 +114,21 @@ Run standalone for testing: `task mcp` (or `npx tsx mcp/server.ts`).
|
|
|
113
114
|
- コードは track 0 のもの(`set_chords` は track 0 の列で指定)。`write_measures(track > 0)` ではコード指定と、
|
|
114
115
|
既存小節の拍子を変える `time` を拒否する
|
|
115
116
|
- `get_tab` は全パートを小節ごとに並べて表示する(`track` で1パートに絞れる)
|
|
116
|
-
- `send_to_eztab` は対応する最新の形式リビジョンをヘッダーに付けて送る(0.
|
|
117
|
+
- `send_to_eztab` は対応する最新の形式リビジョンをヘッダーに付けて送る(0.6.0では `7`)。
|
|
117
118
|
対応上限を超える形式のタブは閲覧のみで、編集・送信できない。
|
|
118
119
|
0.2.0以前のMCPは複数パートのタブを送り返せない(サーバが409で拒否する)。
|
|
119
120
|
|
|
121
|
+
### パートの音色
|
|
122
|
+
|
|
123
|
+
0.6.0以降はパートごとの再生音色(形式リビジョン7、docs/design/0010-track-tones.md)を扱えます。
|
|
124
|
+
|
|
125
|
+
- 値は `clean`(既定)/ `crunch` / `distortion` / `acoustic` / `piano` / `synth` / `strings`
|
|
126
|
+
- 値の意味はパートの楽器で変わる。名前かチューニングでベースと判定されるパートでは、
|
|
127
|
+
`crunch` はオーバードライブ、`acoustic` はウッドベース、`synth` はシンセベースとして鳴る
|
|
128
|
+
- `get_tab` はクリーン以外の音色をパート一覧に `[distortion]` のように表示する
|
|
129
|
+
(1パートのタブでは `tone=distortion`)
|
|
130
|
+
- 0.5.2以前のMCPは、クリーン以外の音色を持つタブを編集・送信できない
|
|
131
|
+
|
|
120
132
|
### 小節メモの保持
|
|
121
133
|
|
|
122
134
|
0.5.1以降はアプリで入力した小節共通メモ(形式リビジョン5)を保持して編集・送信できます。
|
package/dist/server.js
CHANGED
|
@@ -7,13 +7,26 @@ import { z } from "zod";
|
|
|
7
7
|
|
|
8
8
|
// ../src/types/tab.ts
|
|
9
9
|
var TAB_FILE_VERSION = 1;
|
|
10
|
-
var SUPPORTED_FORMAT_REVISION =
|
|
10
|
+
var SUPPORTED_FORMAT_REVISION = 7;
|
|
11
11
|
var SONG_MEMO_FORMAT_REVISION = 6;
|
|
12
12
|
var MULTI_TRACK_FORMAT_REVISION = 2;
|
|
13
13
|
var HARMONICS_FORMAT_REVISION = 3;
|
|
14
14
|
var TEMPO_CHANGES_FORMAT_REVISION = 4;
|
|
15
15
|
var MEASURE_MEMOS_FORMAT_REVISION = 5;
|
|
16
|
+
var TONE_FORMAT_REVISION = 7;
|
|
16
17
|
var MAX_TRACKS = 4;
|
|
18
|
+
var TONES = [
|
|
19
|
+
"clean",
|
|
20
|
+
"crunch",
|
|
21
|
+
"distortion",
|
|
22
|
+
"acoustic",
|
|
23
|
+
"piano",
|
|
24
|
+
"synth",
|
|
25
|
+
"strings"
|
|
26
|
+
];
|
|
27
|
+
function normalizeTone(raw) {
|
|
28
|
+
return raw !== "clean" && TONES.includes(raw) ? raw : void 0;
|
|
29
|
+
}
|
|
17
30
|
var DEFAULT_MAIN_TRACK_NAME = "Guitar";
|
|
18
31
|
var DEFAULT_TEMPO = 120;
|
|
19
32
|
var MIN_TEMPO = 20;
|
|
@@ -321,12 +334,15 @@ function normalizeDocument(data) {
|
|
|
321
334
|
}
|
|
322
335
|
function normalizeTrackMeta(raw, fallbackName) {
|
|
323
336
|
const volume = Number(raw?.volume);
|
|
324
|
-
|
|
337
|
+
const meta = {
|
|
325
338
|
id: typeof raw?.id === "string" && raw.id ? raw.id : newTabId(),
|
|
326
339
|
name: typeof raw?.name === "string" && raw.name.trim() ? raw.name : fallbackName,
|
|
327
340
|
volume: Number.isFinite(volume) ? Math.max(0, Math.min(1, volume)) : 1,
|
|
328
341
|
muted: raw?.muted === true
|
|
329
342
|
};
|
|
343
|
+
const tone = normalizeTone(raw?.tone);
|
|
344
|
+
if (tone) meta.tone = tone;
|
|
345
|
+
return meta;
|
|
330
346
|
}
|
|
331
347
|
function defaultMainTrack() {
|
|
332
348
|
return { id: newTabId(), name: DEFAULT_MAIN_TRACK_NAME, volume: 1, muted: false };
|
|
@@ -580,7 +596,7 @@ function closeWorkspace(doc) {
|
|
|
580
596
|
})
|
|
581
597
|
);
|
|
582
598
|
const mainMeta = ws.metas[0];
|
|
583
|
-
const mainIsDefault = mainMeta.name === DEFAULT_MAIN_TRACK_NAME && mainMeta.volume === 1 && !mainMeta.muted;
|
|
599
|
+
const mainIsDefault = mainMeta.name === DEFAULT_MAIN_TRACK_NAME && mainMeta.volume === 1 && !mainMeta.muted && !mainMeta.tone;
|
|
584
600
|
if (extras.length > 0 || !mainIsDefault) out.mainTrack = mainMeta;
|
|
585
601
|
if (extras.length > 0) out.tracks = extras;
|
|
586
602
|
if (tempoChanges) out.tempoChanges = tempoChanges;
|
|
@@ -591,6 +607,7 @@ function closeWorkspace(doc) {
|
|
|
591
607
|
required = Math.max(required, HARMONICS_FORMAT_REVISION);
|
|
592
608
|
}
|
|
593
609
|
if (tempoChanges) required = Math.max(required, TEMPO_CHANGES_FORMAT_REVISION);
|
|
610
|
+
if (ws.metas.some((m) => m.tone)) required = Math.max(required, TONE_FORMAT_REVISION);
|
|
594
611
|
if (out.measures.some((m) => m.memo !== void 0)) {
|
|
595
612
|
required = Math.max(required, MEASURE_MEMOS_FORMAT_REVISION);
|
|
596
613
|
}
|
|
@@ -691,6 +708,10 @@ function addTrack(doc, name, tuning) {
|
|
|
691
708
|
}))
|
|
692
709
|
};
|
|
693
710
|
const meta = { id: newTabId(), name, volume: 1, muted: false };
|
|
711
|
+
return appendTrack(doc, meta, body);
|
|
712
|
+
}
|
|
713
|
+
function appendTrack(doc, meta, body) {
|
|
714
|
+
const ws = doc.workspace;
|
|
694
715
|
const added = {
|
|
695
716
|
...doc,
|
|
696
717
|
workspace: { ...ws, metas: [...ws.metas, meta], parked: [...ws.parked, body] }
|
|
@@ -707,6 +728,16 @@ function removeTrack(doc, index) {
|
|
|
707
728
|
const active = w.active > index ? w.active - 1 : w.active;
|
|
708
729
|
return { ...shown, workspace: { active, metas, parked } };
|
|
709
730
|
}
|
|
731
|
+
function setTrackTone(doc, index, tone) {
|
|
732
|
+
const ws = doc.workspace;
|
|
733
|
+
if (!ws || !ws.metas[index]) return doc;
|
|
734
|
+
const metas = ws.metas.map((m, i) => {
|
|
735
|
+
if (i !== index) return m;
|
|
736
|
+
const { tone: _tone, ...rest } = m;
|
|
737
|
+
return tone === "clean" ? rest : { ...rest, tone };
|
|
738
|
+
});
|
|
739
|
+
return { ...doc, workspace: { ...ws, metas } };
|
|
740
|
+
}
|
|
710
741
|
function storedSize(doc) {
|
|
711
742
|
return new TextEncoder().encode(JSON.stringify(closeWorkspace(doc))).length;
|
|
712
743
|
}
|
|
@@ -927,11 +958,13 @@ function render(doc, from = 0, to = doc.measures.length - 1, track) {
|
|
|
927
958
|
lines.push(`Tracks (track index: name, tuning top\u2192bottom) measures=${main.measures.length}`);
|
|
928
959
|
metas.forEach((t, i) => {
|
|
929
960
|
lines.push(
|
|
930
|
-
` ${i}: ${t.name} ${bodies[i].tuning.join(" ")}${i === 0 ? " (main: carries the chords)" : ""}`
|
|
961
|
+
` ${i}: ${t.name}${t.tone ? ` [${t.tone}]` : ""} ${bodies[i].tuning.join(" ")}${i === 0 ? " (main: carries the chords)" : ""}`
|
|
931
962
|
);
|
|
932
963
|
});
|
|
933
964
|
} else {
|
|
934
|
-
lines.push(
|
|
965
|
+
lines.push(
|
|
966
|
+
`Tuning (top\u2192bottom): ${main.tuning.join(" ")} measures=${main.measures.length}${metas[0].tone ? ` tone=${metas[0].tone}` : ""}`
|
|
967
|
+
);
|
|
935
968
|
}
|
|
936
969
|
const ann = [];
|
|
937
970
|
main.measures.forEach((_, m) => {
|
|
@@ -1040,7 +1073,7 @@ var state = {
|
|
|
1040
1073
|
source: null
|
|
1041
1074
|
};
|
|
1042
1075
|
var server = new McpServer(
|
|
1043
|
-
{ name: "eztab", version: "0.
|
|
1076
|
+
{ name: "eztab", version: "0.6.0" },
|
|
1044
1077
|
{
|
|
1045
1078
|
instructions: "All indices are 0-based: measure 0 is the first measure, string 0 is the top (highest) string, and column 0 is the first column. Notes and chords share the same column grid. Subdivisions are per beat and can differ within a measure (e.g. [2,2,3,2] mixes a triplet beat into straight eighths), so columns per measure = the sum of its per-beat subdivisions; get_tab's ruler shows the column indices. add_measures `at` is a 0-based insert position too. No need to ask the user about indexing. Exception: write_measures uses guitar string numbers (1 = top line), matching the labels get_tab prints. To write whole measures (e.g. transcribing a score or an image), prefer write_measures over set_cells \u2014 it takes one string per beat and does the column arithmetic for you. For transcribing from an image, follow the import_tab_from_image prompt. To deliver a result to the EZTab app, call send_to_eztab; to fix an existing tab, list_tabs \u2192 open_tab \u2192 edit \u2192 send_to_eztab. A tab can hold up to 4 tracks (parts, e.g. guitar + bass); track 0 is the main track. Tools that edit notes take an optional 0-based `track` (default 0). Measures and time signatures are shared by all tracks (adding/removing a measure affects every track); subdivisions are per track; chords belong to track 0 and use its columns."
|
|
1046
1079
|
}
|
|
@@ -1529,6 +1562,21 @@ server.tool(
|
|
|
1529
1562
|
doc.measures = doc.measures.map((m) => resizeMeasureStrings(m, a.tuning.length));
|
|
1530
1563
|
}, a.track)
|
|
1531
1564
|
);
|
|
1565
|
+
var toneParam = z.enum(TONES).describe(
|
|
1566
|
+
"How the track sounds in playback. What a value means follows the track's instrument (a track named or tuned like a bass is a bass): clean; crunch = light overdrive (bass: overdrive); distortion; acoustic = acoustic guitar (bass: upright bass); piano; synth = synth lead (bass: synth bass); strings."
|
|
1567
|
+
);
|
|
1568
|
+
server.tool(
|
|
1569
|
+
"set_tone",
|
|
1570
|
+
"Set a track's playback tone (clean, crunch, distortion, acoustic, piano, synth, strings). Only the sound changes; the notes stay as written.",
|
|
1571
|
+
{ tone: toneParam, track: trackParam },
|
|
1572
|
+
async (a) => {
|
|
1573
|
+
const doc = edit(0, () => {
|
|
1574
|
+
});
|
|
1575
|
+
onTrack(doc, a.track);
|
|
1576
|
+
state.doc = setTrackTone(doc, a.track ?? 0, a.tone);
|
|
1577
|
+
return text(render(state.doc));
|
|
1578
|
+
}
|
|
1579
|
+
);
|
|
1532
1580
|
var TRACK_PRESETS = [
|
|
1533
1581
|
"Guitar (6)",
|
|
1534
1582
|
"Guitar (7)",
|
|
@@ -1543,17 +1591,19 @@ server.tool(
|
|
|
1543
1591
|
{
|
|
1544
1592
|
name: z.string().min(1).describe("Shown in the app, e.g. 'Bass' or 'Guitar 2'."),
|
|
1545
1593
|
preset: z.enum(TRACK_PRESETS).optional(),
|
|
1546
|
-
tuning: z.array(z.string()).min(1).optional().describe("Top (highest) to bottom; overrides preset.")
|
|
1594
|
+
tuning: z.array(z.string()).min(1).optional().describe("Top (highest) to bottom; overrides preset."),
|
|
1595
|
+
tone: toneParam.optional().describe("Playback tone (see set_tone); default clean.")
|
|
1547
1596
|
},
|
|
1548
1597
|
async (a) => {
|
|
1549
1598
|
const before = trackMetas(requireDoc()).length;
|
|
1550
1599
|
const tuning = a.tuning ?? PRESET_TUNINGS[a.preset ?? "Bass (4)"];
|
|
1551
1600
|
const doc = edit(0, () => {
|
|
1552
1601
|
});
|
|
1553
|
-
const
|
|
1554
|
-
if (trackMetas(
|
|
1602
|
+
const added = addTrack(doc, a.name, tuning);
|
|
1603
|
+
if (trackMetas(added).length === before) {
|
|
1555
1604
|
throw new Error("a tab can hold at most 4 tracks");
|
|
1556
1605
|
}
|
|
1606
|
+
const next = setTrackTone(added, before, a.tone ?? "clean");
|
|
1557
1607
|
state.doc = next;
|
|
1558
1608
|
return text(`Added track ${before} "${a.name}".
|
|
1559
1609
|
|