Recipes
A recipe gives an agent the steps of a larger job, for example the copy of a PDF score. The guide tool of the MCP server gives the agent the same text as this page.
An agent can make mistakes. Check its work against the original.
Use a recipe
Name the recipe in your request, for example: "Use the transcribe-pdf recipe to copy ~/Downloads/minuet.pdf to ~/Scores/minuet.mj." The agent then gets the steps from guide.
In Claude Code, each recipe is also a slash command: /mcp__modaljazz__transcribe-pdf, and so on.
transcribe-pdf: Copy the music of a PDF score into a ModalJazz score.import-musicxml: Make a ModalJazz score from a MusicXML file, and check it.fix-measures: Read, change, and check a range of measures.make-book: Put several pieces, each in its own `.mj` file, into one book PDF.
Programs that a recipe can use
Some recipes use other programs if they are installed. The guide tool tells the agent which of them are on your Mac. You do not need them, but a recipe works better with them.
| Program | For | Install with Homebrew |
|---|---|---|
pdftoppm (poppler) | Pictures of the pages of a PDF | brew install poppler |
gs (Ghostscript) | Pictures of the pages of a PDF, if pdftoppm is not installed | brew install ghostscript |
An agent does not install a program without your permission.
transcribe-pdf
Copy the music of a PDF score into a ModalJazz score.
Can use: pdftoppm, gs
-
Ask the user if the program that made the PDF can export MusicXML. If it can, use that file and follow the
import-musicxmlrecipe. MusicXML is more exact than a picture of the page. -
Make a PNG image of each page at about 150 dpi:
- With
pdftoppm(poppler):pdftoppm -png -r 150 score.pdf page. - With
gs(Ghostscript), ifpdftoppmis not installed:gs -dNOPAUSE -dBATCH -sDEVICE=png16m -r150 -sOutputFile=page-%d.png score.pdf. - If neither program is installed, tell the user. Do not install software without asking the user.
- With
-
Look at the first page. Find the title, the composer, the parts, the key, the time, and the tempo.
-
Make the score:
new_scorewith a new path and the nearest template, for examplepiano. The new score has eight empty measures.run_commandwith:instrumentto add, remove, move, or rename parts. Put the label of the part in front, asscore_summaryshows it::P3 instrument rename "Tenor",:P5 instrument brace off. With no label,:instrumentacts on P1. In a name,|starts a new line::P1 instrument rename "S|A"stacks "S" over "A".run_commandwith:title,:composer,:key,:time, and:tempo.run_commandwith:bars +Nto get the number of measures of the PDF.
Then call
score_summaryto see the staff labels. -
Call
text_formatonce and read it before you write. -
Write one page, or one system, with each
write_measurescall. Large writes are fast and correct, so do not cut the music into small steps of a few measures. -
After each write, read the same measures back with
read_measures. Compare the text with the page image: the notes, the rhythm, the ties, the accidentals, the dynamics, and the marks. Fix each error before you write the next page. This check is the most important step. -
At the end, call
score_summary, and compare the number of measures with the PDF. Callcheck_collisions: for each line, look at the measure in the page image, and write the measure again with the mark where the PDF has it (another side, as!p:above, or another time). Callsave.
import-musicxml
Make a ModalJazz score from a MusicXML file, and check it.
- Call
score_summarywith the MusicXML file (.musicxml,.xml, or.mxl). The tools read the file. The reply shows the import warnings, if there are any. - Read the measures that the warnings name with
read_measures. Fix them withwrite_measuresorrun_command. - Read some measures from the start, the middle, and the end of the score. Compare them with the original, if the user can show it.
- Call
savewithtoset to a path that ends in.mj. The MusicXML file does not change.
fix-measures
Read, change, and check a range of measures.
- Call
score_summaryto see the staff labels and the number of measures. - Read the measures with
read_measures. Givestavesto read only some staves. - Make the change:
- Use
run_commandfor a change that a:command can make, for example:5-8 transpose +P8or:5 key D.list_commandsshows the commands. - Use
write_measuresfor other changes. Write all the lines of a staff for each measure in the range. A staff with no line in the text does not change.
- Use
- Read the same measures again, and check that the change is correct.
If it is not correct, call
undoand try again. - Call
savewhen the user wants the change in the file.
make-book
Put several pieces, each in its own `.mj` file, into one book PDF.
Can use: mj
- Keep each piece in its own
.mjfile, with its own title block, copyright, tempo and page settings. Fix each piece alone first, and check its pages withmj info <file> --layout. - Write a book file next to the pieces, with the extension
.mjbook. One setting on each line;#starts a comment line:title In Your Head: the title on the cover. No title, no cover.line Six pieces for piano: a line under the title. Use one line for each: subtitle, composer.copyright: a copyright (imprint) page after the cover. Thelinesettings just after it are its lines: the copyright line, the rights notice, the ISBN, the credits, the publisher. They print small, in a block near the foot of the page.linewith no text is a blank line, and a long line wraps.contents: a table of contents after the cover.firstpage left: page 1, the first page of music, is a left-hand page, as in many printed books (rightfor a right-hand page). The cover is a right-hand page; blank pages fill the gap.piece daydreaming.mj: a piece, on the next page. Addleftorrightto start it on the next left-hand or right-hand page. A path is relative to the book file; put a path with spaces in quotes.
- Run
mj export book.mjbook --to pdf. It writesbook.pdfand lists the first page number of each piece. - In the book, each piece keeps the pages of its own file: the music of one piece does not change the pages of another. The cover, the copyright page and the contents have no page numbers. Page 1 is the first page of music, and each page of music shows its number, the first page of each piece too.
- The cover, the copyright page and the contents take no font from the
pieces: they are in Times New Roman, with a bold title and no small
caps. To change their look, add a
styleblock to the book (seemj help). For small caps, usefont-variant: small-caps.