100 lines
5.7 KiB
Markdown
100 lines
5.7 KiB
Markdown
# Step 11: Fix LM Studio-visible results and actionable request recovery
|
|
|
|
## Objective and verified reproduction
|
|
|
|
Fix the actual client-facing root cause, not speculative key capitalization.
|
|
Read current server/schemas/errors/profile/service tests and current architecture.
|
|
Keep the strict Python/Mido/native implementation. No commits or delegation.
|
|
|
|
Verified before editing:
|
|
|
|
- `"E minor"` and `"E Minor"` both validate and normalize to E minor.
|
|
- `"Em"` currently fails the structured key regex.
|
|
- The active LM Studio chat's FIRST actual generate_music arguments had
|
|
parts=["lead"], formats=["sd3p","mid"], key="E minor",
|
|
profiles={"lead":"aggressive_rock"}, and unrequested CC91.
|
|
- Lead+sd3p produces INVALID_REQUEST with issues field="$request",
|
|
reason="value_error". The text content is only
|
|
"Correct the invalid request fields identified in details and retry."
|
|
- The stored LM Studio tool result given to the model contains ONLY that
|
|
generic text. Structured details are not visible in that client message.
|
|
- Profile text currently says only "6 profiles; inspect mapping_kind and
|
|
limitations", so that text-only client cannot see the real IDs either.
|
|
- Exact user description is also currently unsupported; that musical feature
|
|
is Step 12 after this fix is reviewed. Do not pretend argument changes alone
|
|
make it supported.
|
|
|
|
Do not read/edit unrelated LM Studio chats/configuration. Do not upload local
|
|
conversation data. Do not modify the user's active chat or DAW.
|
|
|
|
## Owned implementation
|
|
|
|
- server.py: all client-visible result/error content and useful tool descriptions.
|
|
- schemas.py / errors.py: strict public validation context and field guidance,
|
|
canonical key shorthand if appropriate.
|
|
- Directly related unit/integration/stdio/schema/installed tests and docs.
|
|
- prompts/report_11.md.
|
|
|
|
## Required behavior
|
|
|
|
1. For every ProfileListResult, GenerationResult and GenerationError, include the
|
|
COMPLETE safe public JSON in TextContent as well as structuredContent.
|
|
JSON text must decode to the same public object; do not only print a vague
|
|
summary and expect every client to consume structuredContent.
|
|
This follows MCP structured-output backward-compatibility guidance.
|
|
2. Preserve isError, schemas, stdout framing, SDK lifecycle, and all native/MIDI
|
|
functionality. Text-only clients must see exact profile IDs, artifacts,
|
|
warnings and useful error details without private exception inputs.
|
|
3. Cross-field errors identify the actual field and correction, e.g.
|
|
formats: sd3p/sdp require drums; lead uses griff/agp or mid, bass briff/agp.
|
|
Use typed/custom error reasons or an equally safe precise approach.
|
|
Never expose raw Pydantic input/context/exception strings or unknown keys.
|
|
4. Include safe actionable expected grammar/bounds for key, meter, profile IDs,
|
|
parts/formats and CC shape/grid. Do not infer that the key is wrong for every
|
|
generic root error. Backend strict types, limits and privacy remain enforced.
|
|
5. Accept conventional structured key shorthand such as Em/F#m/Bb major and
|
|
canonicalize correctly without breaking existing major/minor full forms.
|
|
Make advertised schema/examples match actual accepted input. Preserve
|
|
malformed/unknown-mode rejection; do not weaken into arbitrary defaults.
|
|
6. Add concise input/tool descriptions explaining:
|
|
- omit formats for automatic correct per-part output;
|
|
- guitar lead -> griff, bass -> briff, drums -> sd3p, mid works for all;
|
|
- omit profiles for defaults, or use exact IDs from list_instrument_profiles;
|
|
- never invent profile IDs or add CC events without user intent;
|
|
- supported text vocabulary/known musical limits, and pass user intent
|
|
faithfully rather than embellishing unsupported instructions.
|
|
7. Do not strip JSON Schema constraints or change transport spec on an unproven
|
|
theory that llama.cpp cannot parse them. The verified bug is hidden text
|
|
feedback. Any schema simplification needs concrete engine evidence.
|
|
8. Known profile-selection/unsupported-description domain errors must also expose
|
|
an actionable public message/details in text. No success-shaped approximations.
|
|
|
|
## Tests
|
|
|
|
Unit:
|
|
- json.loads(TextContent.text) equals structuredContent for both tools, success
|
|
and validation/domain errors; exact IDs/corrections are visible through text.
|
|
- Reproduce lead+sd3p with valid E minor: error points to formats and lists valid
|
|
lead choices, not generic root value_error.
|
|
- Em, E minor, E Minor and other conventional aliases normalize identically;
|
|
invalid modes/values remain errors and privacy sentinels remain absent.
|
|
- Wrong/invented profile has an exact list-profiles/default recovery action.
|
|
- CC, meter, missing/unknown fields retain strict validation and useful context.
|
|
|
|
Integration:
|
|
- Real stdio text-only consumer can list IDs, receive wrong-format correction,
|
|
repair the call and generate actual guitar native/MIDI without guessing.
|
|
- Real installed-wheel client sees equivalent complete text/structured payloads.
|
|
- Existing native/CC/atomic/schema/stdio/source-template regressions still pass.
|
|
|
|
Run focused tests, full current suite, Ruff lint/format, strict mypy and pip check.
|
|
Fix actual regressions without weakening assertions. No model change, network
|
|
service, extra features, triplet composer implementation or later prompts here.
|
|
|
|
When complete, write your end-of-step report to ./prompts/report_11.md including: what was implemented, test results (pass/fail with details), any issues encountered, and whether you're ready for the next step
|
|
|
|
Entire report inside exactly one plain triple-backtick fence. Include actual
|
|
before/after text-only recovery evidence, exact tests/counts, privacy checks,
|
|
schema/key decisions and Step 12 readiness. Require LM Studio MCP restart/fresh
|
|
chat to refresh its cached tool schema; do not claim its live UI was restarted.
|