Skip to main content
Glama

get_avatar_name

Retrieve the name of the current avatar in VRChat using the VRChat MCP OSC server, enabling AI-driven avatar identification and control in virtual reality environments.

Instructions

Get the name of the current avatar.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Implementation of the getAvatarName method in AvatarTools class, which fetches the current avatar name from WebSocket client with retry logic, validation, logging, and fallback handling.
    public async getAvatarName(ctx?: ToolContext): Promise<string> {
      if (ctx) {
        await ctx.info('Getting avatar name');
      }
      
      try {
        // Multiple retry attempts
        let attempts = 0;
        const maxAttempts = 3;
        let lastError: Error | null = null;
        
        while (attempts < maxAttempts) {
          attempts++;
          logger.info(`Getting avatar info (attempt ${attempts}/${maxAttempts})`);
          
          try {
            // Get the latest avatar info with increased timeout
            const avatarInfo = await this.wsClient.getAvatarInfo();
            
            // Validate the response
            if (!avatarInfo || !avatarInfo.id) {
              throw new Error('Invalid avatar info response');
            }
            
            // Update stored info and return the name
            this.currentAvatarInfo = avatarInfo;
            logger.info(`Got avatar info: ${JSON.stringify(this.currentAvatarInfo)}`);
            
            // Return result
            if (ctx) {
              await ctx.info(`Current avatar: ${this.currentAvatarInfo.name}`);
            }
            
            return this.currentAvatarInfo.name;
          } catch (error) {
            lastError = error instanceof Error ? error : new Error(String(error));
            logger.warn(`Attempt ${attempts} failed: ${lastError.message}`);
            
            // Wait before retry
            if (attempts < maxAttempts) {
              const delay = 500 * attempts; // Increasing delay for each retry
              logger.info(`Retrying in ${delay}ms...`);
              await new Promise(resolve => setTimeout(resolve, delay));
            }
          }
        }
        
        // All attempts failed
        if (lastError) {
          throw lastError;
        } else {
          throw new Error('Failed to get avatar name after multiple attempts');
        }
      } catch (error) {
        logger.error(`Failed to get avatar info: ${error instanceof Error ? error.message : String(error)}`);
        
        // Try to fall back to loaded config info if available
        const fallbackName = this.getFallbackAvatarName();
        
        if (ctx) {
          await ctx.warning(`Could not get avatar name: ${error instanceof Error ? error.message : String(error)}. Using fallback: ${fallbackName}`);
        }
        
        return fallbackName;
      }
    }
  • MCP server registration of the 'get_avatar_name' tool using server.tool(), which delegates to avatarTools.getAvatarName() and handles response formatting and errors.
    server.tool(
      'get_avatar_name',
      'Get the name of the current avatar.',
      {},
      async () => {
        try {
          const name = await avatarTools.getAvatarName();
          return { content: [{ type: 'text', text: name }] };
        } catch (error) {
          return { 
            content: [{ 
              type: 'text', 
              text: `Error getting avatar name: ${error instanceof Error ? error.message : String(error)}` 
            }],
            isError: true
          };
        }
      }
    );
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 but only states the basic action. It doesn't reveal any behavioral traits such as whether this is a read-only operation, if it requires authentication, potential rate limits, or what the return format might be (e.g., string, object). This leaves significant gaps in understanding how the tool behaves in practice.

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, clear sentence that directly states the tool's purpose without any unnecessary words or fluff. It is front-loaded and efficiently communicates the core functionality, making it easy for an agent to parse and understand quickly.

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?

Given the lack of annotations and output schema, the description is incomplete for effective tool use. It doesn't explain what the tool returns (e.g., a string name, an error if no avatar exists), behavioral aspects like safety or side effects, or how it fits with sibling tools. For a tool in a server with multiple avatar-related tools, more context is needed to ensure proper selection and invocation.

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

Parameters4/5

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

The tool has 0 parameters, and the input schema coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and it correctly avoids mentioning any inputs. This meets the baseline expectation for a parameterless tool, though it doesn't go beyond that.

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 tool's purpose with a specific verb ('Get') and resource ('name of the current avatar'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_avatar_list' or 'set_avatar', which also deal with avatars, leaving room for potential confusion about when to use this specific tool.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any context, prerequisites, or exclusions, nor does it refer to sibling tools like 'get_avatar_list' for listing avatars or 'set_avatar' for modifying them, leaving the agent to infer usage scenarios independently.

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