Skip to main content
Glama

set_tempo

Adjust the playback speed of a MIDI file by setting its tempo in beats per minute (BPM).

Instructions

Set tempo for midi file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesAbsoulate File Path to midi file
bpmYesBPM

Implementation Reference

  • Handler function that loads the MIDI file using loadMidiFile, sets the tempo on the header with bpm, saves the modified file with saveMidiFile, and returns a success message.
    withErrorHandling(({ filePath, bpm }) => { const midi = loadMidiFile(filePath) midi.header.setTempo(bpm) saveMidiFile(midi, filePath) return { content: [ { type: 'text', text: `Set tempo to ${bpm}`, }, ] } })
  • Input schema defined with Zod for filePath (string) and bpm (number).
    { filePath: z.string().describe('Absoulate File Path to midi file'), bpm: z.number().describe('BPM'), },
  • src/main.ts:67-87 (registration)
    Registration of the 'set_tempo' tool using McpServer's tool method, including name, description, input schema, and handler.
    server.tool( 'set_tempo', 'Set tempo for midi file', { filePath: z.string().describe('Absoulate File Path to midi file'), bpm: z.number().describe('BPM'), }, withErrorHandling(({ filePath, bpm }) => { const midi = loadMidiFile(filePath) midi.header.setTempo(bpm) saveMidiFile(midi, filePath) return { content: [ { type: 'text', text: `Set tempo to ${bpm}`, }, ] } }) )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xiaolaa2/midi-file-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server