Skip to main content
Glama

rest

Regain health in Minecraft by resting for a specified time (default: 10 seconds). Use this tool as part of the MCP Server to enable AI agents to manage character recovery during gameplay.

Instructions

Rest to regain health

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
restTimeNoTime to rest in seconds (default: 10)

Implementation Reference

  • The main handler function that executes the 'rest' tool logic: validates parameters, waits for a configurable duration in ticks (simulating rest), handles interruptions, and emits observations.
    export const rest = async ( bot: Bot, params: ISkillParams, serviceParams: ISkillServiceParams, ): Promise<boolean> => { const skillName = 'rest'; const requiredParams: string[] = []; const isParamsValid = validateSkillParams( params, requiredParams, skillName, ); if (!isParamsValid) { serviceParams.cancelExecution?.(); bot.emit( 'alteraBotEndObservation', `Mistake: You didn't provide all of the required parameters ${requiredParams.join(', ')} for the ${skillName} skill.`, ); return false; } const unpackedParams = { restTime: params.restTime ?? 4, signal: serviceParams.signal, }; let {restTime, signal} = unpackedParams; const SECONDS_TO_TICKS = 20; // twenty ticks per second restTime = Math.min(restTime, 12); // Set max rest time to 12 seconds. const ticks_to_rest = restTime * SECONDS_TO_TICKS; // convert seconds to ticks const tick_interval = SECONDS_TO_TICKS * 2; // allow interrupting every 2 seconds let cur_sleep_ticks = 0; while (cur_sleep_ticks < ticks_to_rest) { if (isSignalAborted(signal)) { // You interrupted your own rest return bot.emit( 'alteraBotEndObservation', `You decided to do something else instead of resting.`, ); } await bot.waitForTicks(tick_interval); cur_sleep_ticks += tick_interval; } return bot.emit('alteraBotEndObservation', `You finished resting.`); };
  • Schema definition for the 'rest' tool, specifying the input parameters (restTime), description, and required fields (none).
    rest: { description: "Rest to regain health", params: { restTime: { type: "number", description: "Time to rest in seconds (default: 10)" } }, required: [] },
  • Function that registers all skills including 'rest' by iterating over SKILL_METADATA, creating SkillDefinition objects with schema and dynamic executor loader.
    export async function loadSkills(): Promise<SkillDefinition[]> { const skills: SkillDefinition[] = []; for (const [skillName, metadata] of Object.entries(SKILL_METADATA)) { skills.push({ name: skillName, description: metadata.description, inputSchema: { type: "object", properties: metadata.params, required: metadata.required }, execute: createSkillExecutor(skillName) }); } return skills; }

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/leo4life2/minecraft-mcp-http'

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