Skip to main content
Glama

search_collection

Search for AI personas, skills, agents, and prompts in the DollhouseMCP collection using keywords to find behavioral profiles and content types.

Instructions

Search for content in the collection by keywords. This searches all content types including personas (AI behavioral profiles that users activate to change AI behavior), skills, agents, prompts, etc. When a user asks to 'find a persona', search in the collection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for finding content. Examples: 'creative writer', 'explain like I'm five', 'coding assistant'. Users typically search for personas by their behavioral traits or names.

Implementation Reference

  • Core handler function that implements the search logic for the collection. Performs GitHub API search, falls back to cache and seed data, with security validation.
    async searchCollection(query: string): Promise<any[]> {
      logger.debug(`CollectionSearch.searchCollection called with query: "${query}"`);
      
      // Validate search query for security
      try {
        validateSearchQuery(query, 1000);
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        logger.error('Search query validation failed:', { query, error: errorMessage });
        ErrorHandler.logError('CollectionSearch.search.validateQuery', error, { query });
        return [];
      }
      
      try {
        // First, try GitHub API search if authenticated
        const searchUrl = `${this.searchBaseUrl}?q=${encodeURIComponent(query)}+repo:DollhouseMCP/collection+path:library+extension:md`;
        logger.debug(`Attempting GitHub API search with URL: ${searchUrl}`);
        const data = await this.githubClient.fetchFromGitHub(searchUrl, false); // Don't require auth for search
        
        if (data.items && Array.isArray(data.items)) {
          logger.debug(`Found ${data.items.length} items via GitHub API search`);
          
          // Update cache with fresh data from API
          await this.updateCacheFromGitHubItems(data.items);
          
          return data.items;
        }
        
        logger.debug('GitHub API search returned no items, falling back to cache');
        return [];
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        logger.debug(`GitHub API search failed: ${errorMessage}. Falling back to cached search.`);
        ErrorHandler.logError('CollectionSearch.search.githubApi', error, { query });
        
        // Fallback to cached search
        return this.searchFromCache(query);
      }
    }
  • Registers the 'search_collection' tool with schema and handler that delegates to server.searchCollection(query). This is returned by getCollectionTools() and registered in ServerSetup.
    {
      tool: {
        name: "search_collection",
        description: "Search for content in the collection by keywords. This searches all content types including personas (AI behavioral profiles that users activate to change AI behavior), skills, agents, prompts, etc. When a user asks to 'find a persona', search in the collection.",
        inputSchema: {
          type: "object",
          properties: {
            query: {
              type: "string",
              description: "Search query for finding content. Examples: 'creative writer', 'explain like I'm five', 'coding assistant'. Users typically search for personas by their behavioral traits or names.",
            },
          },
          required: ["query"],
        },
      },
      handler: (args: any) => server.searchCollection(args.query)
    },
  • Input schema definition for the search_collection tool requiring a 'query' string.
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search query for finding content. Examples: 'creative writer', 'explain like I'm five', 'coding assistant'. Users typically search for personas by their behavioral traits or names.",
        },
      },
      required: ["query"],
    },
  • Registers all collection tools (including search_collection) from getCollectionTools into the ToolRegistry.
    // Register collection tools
    this.toolRegistry.registerMany(getCollectionTools(instance));
  • Supporting helper methods for cache search, seed data search, fuzzy matching, and result formatting used by the main handler.
    }
    
    /**
     * Search cached collection items
     */
    private async searchFromCache(query: string): Promise<any[]> {
Behavior3/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 describes what the tool searches ('all content types') and provides a specific use case, but lacks details about behavioral traits like rate limits, authentication requirements, pagination, or what happens when no results are found. The description doesn't contradict any annotations (since none exist), but could provide more operational context.

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

Conciseness4/5

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

The description is appropriately sized with two sentences that each serve distinct purposes: the first explains the core functionality, the second provides usage guidance. It's front-loaded with the main purpose and avoids unnecessary elaboration. Minor improvement could be made by slightly tightening the phrasing, but overall it's efficient.

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

Completeness3/5

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

Given the tool's moderate complexity (single parameter search function), no annotations, and no output schema, the description provides adequate but not complete context. It explains what's searched and when to use it, but lacks information about return format, error conditions, or performance characteristics. For a search tool with no output schema, more detail about expected results would be beneficial.

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 already fully documents the single 'query' parameter with examples. The description adds marginal value by mentioning 'keywords' and listing content types, but doesn't provide additional parameter semantics beyond what's in the schema. This meets the baseline expectation when schema coverage is complete.

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

Purpose5/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 specific verbs ('search for content') and resources ('collection'), and explicitly distinguishes it from siblings by specifying it searches 'all content types including personas, skills, agents, prompts, etc.' This provides clear differentiation from other search tools like search_all, search_by_verb, search_collection_enhanced, and search_portfolio.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'When a user asks to 'find a persona', search in the collection.' This gives a concrete use case and context for selection, helping the agent distinguish this from alternative search tools. The mention of searching 'all content types' also implies when it's appropriate versus more specialized searches.

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