Skip to main content
Glama

set_emote_parameter

Set VRCEmote on the current avatar by defining a specific value, enabling AI-driven avatar interaction and control in VRChat using the Model Context Protocol.

Instructions

Set VRCEmote on the current avatar.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYesValue to set

Implementation Reference

  • Registration of the 'set_emote_parameter' tool, including Zod input schema for 'value' (number or string) and the handler function that parses the value to number and delegates to avatarTools.setParameter('VRCEmote', ...) with context.
    // Register avatar parameter tools
    server.tool(
      'set_emote_parameter',
      'Set VRCEmote on the current avatar.',
      {
        value: z.union([z.number(),z.string()]).describe('Value to set')
      },
      async ({value }, extra) => {
        try {
          const ctx = createToolContext(extra);
          
         // 文字列が数値として解析可能な場合は数値に変換
         let value_con: number;
         if (typeof value === 'string') {
           // 数値として解析を試みる
           value_con = Number(value);
           // 変換できなかった場合(NaNの場合)はエラーを投げる
           if (isNaN(value_con)) {
             throw new Error(`文字列 "${value}" を数値に変換できませんでした`);
           }
         } else {
           value_con = value;
         }
          
          const result = await avatarTools.setParameter('VRCEmote', value_con, ctx);
          return { content: [{ type: 'text', text: result }] };
        } catch (error) {
          return { 
            content: [{ 
              type: 'text', 
              text: `Error setting parameter: ${error instanceof Error ? error.message : String(error)}` 
            }],
            isError: true
          };
        }
      }
    );
  • Core handler logic for setting avatar parameters (including VRCEmote for set_emote_parameter). Performs validation, logging via context, up to 3 retry attempts with exponential backoff when calling wsClient.setAvatarParameter, and returns success/error messages.
    public async setParameter(
      parameterName: string,
      value: ParameterValue,
      ctx?: ToolContext
    ): Promise<string> {
      if (!parameterName) {
        const errorMsg = 'Missing parameter name';
        logger.error(errorMsg);
        if (ctx) await ctx.error(errorMsg);
        return errorMsg;
      }
      
      // // Validate value type
      // if (typeof value !== 'number' && typeof value !== 'boolean') {
      //   const errorMsg = `Invalid parameter value type: ${typeof value} (must be number or boolean)`;
      //   logger.error(errorMsg);
      //   if (ctx) await ctx.error(errorMsg);
      //   return errorMsg;
      // }
      
      if (ctx) {
        await ctx.info(`Setting avatar parameter ${parameterName} to ${value}`);
      }
      
      try {
        // Multiple retry attempts
        let attempts = 0;
        const maxAttempts = 3;
        
        while (attempts < maxAttempts) {
          attempts++;
          logger.info(`Setting parameter ${parameterName}=${value} (attempt ${attempts}/${maxAttempts})`);
          
          try {
            // Set parameter with timeout
            const success = await this.wsClient.setAvatarParameter(parameterName, value);
            
            if (success) {
              const successMsg = `Successfully set ${parameterName} to ${value}`;
              logger.info(successMsg);
              return successMsg;
            } else {
              logger.warn(`Failed to set parameter ${parameterName} (attempt ${attempts})`);
              
              // Try again if we have attempts left
              if (attempts < maxAttempts) {
                const delay = 300 * attempts; // Increasing delay for each retry
                logger.info(`Retrying in ${delay}ms...`);
                await new Promise(resolve => setTimeout(resolve, delay));
              }
            }
          } catch (error) {
            logger.warn(`Error setting parameter ${parameterName} (attempt ${attempts}): ${error instanceof Error ? error.message : String(error)}`);
            
            // Try again if we have attempts left
            if (attempts < maxAttempts) {
              const delay = 300 * attempts; // Increasing delay for each retry
              logger.info(`Retrying in ${delay}ms...`);
              await new Promise(resolve => setTimeout(resolve, delay));
            }
          }
        }
        
        // All attempts failed
        const failMsg = `Failed to set ${parameterName} after ${maxAttempts} attempts`;
        logger.error(failMsg);
        return failMsg;
      } catch (error) {
        const errorMsg = `Error setting parameter ${parameterName}: ${error instanceof Error ? error.message : String(error)}`;
        logger.error(errorMsg);
        return errorMsg;
      }
    }
  • Reference to 'VRCEmote' parameter in fallback list of common VRChat avatar parameters.
    'VRCEmote',
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool sets a parameter, implying a mutation, but doesn't describe effects (e.g., whether it changes avatar state immediately, requires specific conditions, or has side effects). This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, clearly front-loading the core action. It's appropriately sized for a simple tool with one parameter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., what 'Set' entails, error conditions, or return values), making it inadequate for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'value' documented as a number or string. The description adds no additional meaning beyond implying it's for 'VRCEmote', which loosely relates to the parameter but doesn't specify valid values or formats. Baseline 3 is appropriate given the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Set') and the target ('VRCEmote on the current avatar'), making the purpose understandable. It doesn't explicitly differentiate from sibling tools like 'set_avatar_parameter', but the specific mention of 'VRCEmote' provides some distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'set_avatar_parameter' or other avatar-related tools. The description implies usage for setting emote parameters but offers no context about prerequisites, timing, or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/Krekun/vrchat-mcp-osc'

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