11 KiB
11 KiB
Step 11 — COMPLETE: visible JSON feedback and actionable request recovery
Date: 2026-10-20
Implemented
- Both tools now put the COMPLETE safe public object into structuredContent
and one JSON TextContent block. json.loads(content[0].text) equals
structuredContent for profile lists, generation successes, validation errors
and known domain errors. isError remains correct. No vague summary substitutes
for IDs, resolved metadata, artifacts, warnings or error details.
- Added authored field/reason/correction issues for formats, profiles and CC
cross-field failures. Applied the same safe validation after inferred parts
resolve. Meter type failures identify time_signature.denominator.
- Added actionable key/meter/parts/formats/profile/CC grammar, bounds and shape
guidance. Missing fields and unknown properties retain strict validation.
Known profile-selection and unsupported-description errors expose explicit
recovery/limitations in the JSON text, not success-shaped approximations.
- Added accurate tool and input descriptions: omit formats for automatic output;
guitar lead -> griff/agp, bass -> briff/agp, drums -> sd3p/sdp; mid for all.
Omit profiles for defaults or use exact list_instrument_profiles IDs. Never
invent IDs or add CC events without user intent. Preserve musical intent and
identify unsupported instructions rather than silently simplifying them.
- Structured keys accept attached lowercase-m minor shorthand. Full forms and
strict malformed/unknown-mode rejection remain intact.
- Updated README, architecture documentation, unit/schema/service tests,
official-client tests and real source/installed-wheel stdio acceptance.
Actual BEFORE evidence, captured before edits
A fresh real stdio process reproduced the failing fields from the supplied
report; no LM Studio conversations/configuration were read or edited.
list_instrument_profiles TextContent:
"6 profiles; inspect mapping_kind and limitations."
generate_music fixture:
parts=["lead"], formats=["sd3p","mid"], key="E minor",
profiles={"lead":"aggressive_rock"},
cc_events=[{"part":"lead","beat":{"numerator":0},"controller":91,"value":64}]
TextContent:
"Correct the invalid request fields identified in details and retry."
Structured details, not visible to the reported text-only client:
{"issues":[{"field":"$request","reason":"value_error"}]}
Direct validation in the same reproduction:
E minor -> E minor
E Minor -> E minor
Em -> rejected
Process exit: 0. Stderr: empty.
This was a hidden-feedback/format-association problem, not evidence that the
valid E minor spelling was wrong.
Actual AFTER evidence: source AND isolated installed-wheel stdio
The consumer makes recovery decisions from decoded TextContent only.
Equality with structuredContent is separately asserted for every response.
The profile-list text now exposes all six actual IDs and complete capabilities
and limitations:
ample.ame.4.0.1.riffer.v1
ample.amr.4.1.0.riffer.v1
standard.bass.v1
standard.gm-drums.v1
standard.lead.v1
toontrack.sd3.3.4.4.core.v1
The original wrong-format fixture now returns this complete decoded text:
{"code":"INVALID_REQUEST","message":"Correct the invalid request fields identified in details and retry.","details":{"issues":[{"field":"formats","reason":"format_parts","correction":"Omit formats for automatic per-part native output plus MIDI. sd3p/sdp requires drums; griff requires lead; briff requires bass; agp requires lead or bass. Guitar lead uses griff/agp or mid; bass uses briff/agp or mid; drums uses sd3p/sdp or mid. Use a nonempty unique array of these format names."}]}}
After omitting formats, the independently wrong profile becomes actionable:
{"code":"PROFILE_REQUIRED","message":"The requested profile is missing; list profiles with list_instrument_profiles({}) and select an available ID for that part, or omit profiles for defaults. Never invent profile IDs.","details":{"part":"lead","reason":"missing_profile"}}
Neither failure publishes a directory. A separate detailed-triplet-description
probe returns UNSUPPORTED_DESCRIPTION, with supported vocabulary and the
explicit limitation "Detailed triplet patterns, arbitrary melodies and
changes/sequences are not supported." It also publishes nothing.
The supported quarter-note recovery fixture uses an exact returned lead ID:
{"description":"lead only 1 bar quarter","basename":"text-recovered","parts":["lead"],"key":"Em","profiles":{"lead":"ample.ame.4.0.1.riffer.v1"}}
Formats are omitted for automatic correct output. Unrequested CC91 is omitted
by the consumer, not silently removed by the backend. This supported fixture
is NOT a claimed approximation of the user's unsupported triplet composition.
Source and installed wheel both produced:
status: complete
canonical key: E minor
profile: ample.ame.4.0.1.riffer.v1
text-recovered.mid: 117 bytes
SHA256 922d4c30e4618b6cce61a2ecebb36193773ca3884e56db80f7c18fe18e813f26
text-recovered_lead.griff: 1014 bytes
SHA256 213adde1c4785dccd2289e6888328c16bca720fb8d2786edb4df34f3863d1c2f
warning code: VERIFIED_SUBSET_LIMITS
fallback_for: [] on both artifacts
Independent disk checks:
- MIDI type 1; tracks Conductor/Lead; 960 ticks/quarter; both tracks end at 3840.
- Five MIDI note-ons: four musical notes plus the required normal-articulation
keyswitch at note 24. Articulation behavior was preserved, not discarded.
- Real Riffer XML root Riff, four native notes, no fabricated CC lane.
- Zero CC91 events. No partial publication from wrong/unsupported calls and no
leftover owned stage. Successful paths and full warnings are visible in text.
- Source process exits 0 with empty stderr. Installed acceptance checks real
JSON-RPC framing, lifecycle/EOF, output schemas and sanitized malformed-input
diagnostics. Its expanded initialized process has exactly 20 protocol stdout lines.
- Installed-wheel acceptance imports all 16 checked modules from the noneditable
installed wheel, outside the source checkout, with -I/-B; all six packaged
profile resources and existing native/template/MIDI/CC checks remain verified.
Schema, strictness and privacy decisions
- Retained JSON Schema constraints, conditional associations, uniqueItems,
numeric/array/string bounds, additionalProperties=false, output unions and
SDK protocol/lifecycle behavior. No schema simplification, transport rewrite,
model change or grammar-engine theory was used.
- E minor / E Minor / Em normalize to E minor; F#m -> F# minor;
Bbm -> A# minor; Bb major -> A# major. Accepted spellings are advertised in
schema examples and checked against both JSON Schema and runtime validation.
- Only explicit full major/minor forms or lowercase-m minor suffix are accepted.
Bare letters/missing modes, EM, E m, Emin, unknown modes, double/Unicode
accidentals, tabs and newlines remain errors. No arbitrary mode default.
Description text still requires full major/minor forms.
- Strict integer/boolean distinctions, finite numbers, CC bounds/grid/budget,
normalized duplicate rejection, profile identity/part checks and atomic/root
safety were not weakened. Explicit requested CC behavior remains supported.
- Public validation contains only known field names, numeric indices, redacted
<unknown> property locations, controlled reason codes and static corrections.
No raw Pydantic input/context/message, exception cause, traceback or unknown
user property name is serialized. Synthetic private-/secret/path/Unicode
privacy sentinels remain absent from validation/domain results and diagnostics.
- Unknown tools/protocol failures and unexpected internal failures retain SDK
error semantics rather than being mislabeled as request/domain errors.
Validation: exact executed results
Runtime: Windows; Python 3.13.13; MCP 1.30.0; Pydantic 2.14.1; Mido 1.3.3.
Commands use .\.venv\Scripts\python.exe; no dependency manifest changed.
1. Focused server/schema/service/text-only tests:
-m pytest tests\unit\test_server.py tests\unit\test_schemas.py
tests\unit\test_service.py tests\integration\test_text_feedback.py -q --tb=short
PASS: 408 passed in 4.54s.
2. Expanded focused validation:
-m pytest tests\unit\test_server.py tests\unit\test_schemas.py
tests\unit\test_service.py tests\unit\test_errors.py
tests\unit\test_cc_controls.py tests\unit\test_description.py
tests\unit\test_readme.py tests\integration\test_contracts.py
tests\integration\test_stdio.py tests\integration\test_text_feedback.py
-q --tb=short
PASS: 642 passed in 22.26s.
3. Affected offline distribution/installed-wheel tests:
-m pytest tests\integration\test_distribution.py -q --tb=short
PASS: 3 passed in 12.63s.
4. Final complete regression suite:
-m pytest -q --tb=short
PASS: 1458 passed in 61.68s; no failures or skips.
Includes native codecs/read-back, CC, atomic publication, source-template,
schemas, stdio, composition, packaging and installed-wheel regressions.
5. Final source plus installed text-only evidence rerun:
-m pytest tests\integration\test_text_feedback.py
tests\integration\test_distribution.py -q -s --tb=short
PASS: 4 passed in 13.34s. Both printed identical artifact sizes/hashes and
the actual text-only error/recovery evidence recorded above.
6. Final static/environment checks:
-m ruff check src tests
PASS: All checks passed!
-m ruff format --check src tests
PASS: 48 files already formatted.
-m mypy --strict src tests
PASS: Success: no issues found in 48 source files.
-m pip check
PASS: No broken requirements found.
git diff --check
PASS: exit 0, no whitespace errors.
Editor diagnostics for changed Python files: no errors found.
Issues encountered and resolved
- Editor runTests reported "No tests found"; used the actual configured venv
pytest commands above instead. No discovery/tooling changes were needed.
- Initial focused checks caught two test assumptions: raw Windows paths are
JSON-escaped in text, and the MIDI includes a required articulation keyswitch.
Tests now assert the decoded exact path and five note-ons with the explicit
four-musical/one-keyswitch split; no behavior or checks were weakened.
- The first full run had 1457 passed / 1 failed: the installed fixture expected
its old 15 response lines after five new recovery calls were added. Updated
the exact expected count to 20. Also fixed one strict-mypy test-fixture
dictionary annotation. Installed and full reruns above are all green.
- Existing unsupported detailed musical requests remain explicit domain errors.
Native plugin/Cubase application certification remains outside these tests.
- Project-local acceptance logs were used only as scratch evidence and removed;
generated test workspaces are fixture-cleaned. No user output/chat was changed.
Readiness and limits
Step 11 is implemented, persistent in the working tree, and verified.
Ready for review and then Step 12. The detailed triplet composer is NOT
implemented; no later prompt was executed. No commits or delegation occurred.
No user LM Studio chat/configuration, DAW, model or network service was modified.
Operator action required: restart the LM Studio MCP server and start a fresh
chat to refresh its cached tool schema/descriptions. Its live UI was NOT
restarted or verified here; real source/installed-wheel stdio recovery was.