Skip to main content
Glama

list_elements

Retrieve available elements by type to manage AI personas, skills, templates, agents, memories, or ensembles within the DollhouseMCP server.

Instructions

List all available elements of a specific type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesThe element type to list

Implementation Reference

  • Core handler logic for the list_elements tool. Scans the filesystem portfolio directory for the specified element type, filters files by type-specific extension, excludes test elements, and handles filesystem errors (missing dir, permissions, etc.) by returning empty list or throwing appropriately.
    public async listElements(type: ElementType): Promise<string[]> {
      const elementDir = this.getElementDir(type);
      const fileExtension = ELEMENT_FILE_EXTENSIONS[type] || DEFAULT_ELEMENT_FILE_EXTENSION;
    
      try {
        const files = await fs.readdir(elementDir);
        // Filter for correct file extension based on element type and exclude test elements
        return files
          .filter(file => file.endsWith(fileExtension))
          .filter(file => !this.isTestElement(file));
      } catch (error) {
        const err = error as NodeJS.ErrnoException;
        
        if (err.code === 'ENOENT') {
          // Directory doesn't exist yet - this is expected for new installations
          logger.debug(`[PortfolioManager] Element directory doesn't exist yet: ${elementDir}`);
          return [];
        }
        
        if (err.code === 'EACCES' || err.code === 'EPERM') {
          // Permission denied - log but return empty array
          ErrorHandler.logError('PortfolioManager.listElements', error, { elementDir });
          return [];
        }
        
        if (err.code === 'ENOTDIR') {
          // Path exists but is not a directory
          ErrorHandler.logError('PortfolioManager.listElements', error, { elementDir });
          throw ErrorHandler.createError(`Path is not a directory: ${elementDir}`, ErrorCategory.SYSTEM_ERROR);
        }
        
        // For any other errors, throw with context
        ErrorHandler.logError('PortfolioManager.listElements', error, { elementDir });
        throw ErrorHandler.wrapError(error, 'Failed to list elements', ErrorCategory.SYSTEM_ERROR);
      }
    }
  • Tool registration and schema definition for list_elements. Registers the tool with MCP server, defines input schema requiring 'type' parameter (enum from ElementType), and provides handler that delegates to server.listElements(type). This is returned by getElementTools().
    {
      tool: {
        name: "list_elements",
        description: "List all available elements of a specific type",
        inputSchema: {
          type: "object",
          properties: {
            type: {
              type: "string",
              description: "The element type to list",
              enum: Object.values(ElementType),
            },
          },
          required: ["type"],
        },
      },
      handler: (args: ListElementsArgs) => server.listElements(args.type)
    },
  • Global tool registration where ElementTools (including list_elements) are registered with the ToolRegistry during server setup.
    // Register element tools (new generic tools for all element types)
    this.toolRegistry.registerMany(getElementTools(instance));
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it 'lists all available elements' but doesn't disclose behavioral traits like pagination, rate limits, permissions needed, or what 'available' means (e.g., active vs. all). This is a significant gap for a tool with no annotation coverage.

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 that directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse 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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'list' returns (e.g., format, fields) or behavioral aspects like safety or constraints. For a tool in a complex server with many siblings, this leaves critical gaps for an 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?

Schema description coverage is 100%, so the schema fully documents the 'type' parameter with its enum values. The description adds no additional meaning beyond implying it filters by type, which is already clear from the schema. Baseline 3 is appropriate as 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 verb ('list') and resource ('elements of a specific type'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_active_elements' or 'search_all', which might also retrieve elements, so it's not fully specific to sibling context.

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 such as 'get_active_elements' or 'search_all'. It lacks context about prerequisites, exclusions, or comparative use cases, leaving the agent with minimal direction.

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

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/DollhouseMCP/DollhouseMCP'

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