Skip to main content
Glama

search_collection

Search across all content types including personas, skills, agents, and prompts using keywords. Use this tool to locate specific AI behavioral profiles or other resources within DollhouseMCP's collection.

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

  • Tool registration, schema, and thin handler for 'search_collection' tool. Schema requires 'query' string. Handler delegates to server.searchCollection(query).
    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) },
  • Registers the collection tools module, which includes the search_collection tool, into the MCP tool registry.
    // Register collection tools this.toolRegistry.registerMany(getCollectionTools(instance));
  • Core handler logic for collection search: validates query, attempts GitHub API search, falls back to cache/searchSeedData, with security and logging.
    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); } }
  • Helper function to format search results as formatted text with icons, paths, and install/get commands.
    formatSearchResults(items: any[], query: string, personaIndicator: string = ''): string { if (items.length === 0) { return `${personaIndicator}๐Ÿ” No content found for query: "${query}"`; } const textParts = [`${personaIndicator}๐Ÿ” **Search Results for "${query}"** (${items.length} found)\n\n`]; items.forEach((item: any) => { // Extract content type from path (library/personas/creative/writer.md -> personas) const pathParts = item.path.split('/'); const contentType = pathParts[1] || 'content'; const contentIcons: { [key: string]: string } = { 'personas': '๐ŸŽญ', 'skills': '๐Ÿ› ๏ธ', 'agents': '๐Ÿค–', 'prompts': '๐Ÿ’ฌ', 'templates': '๐Ÿ“„', 'tools': '๐Ÿ”ง', 'ensembles': '๐ŸŽผ' }; const icon = contentIcons[contentType] || '๐Ÿ“„'; textParts.push( ` ${icon} **${item.name.replace('.md', '')}**\n`, ` ๐Ÿ“‚ Path: ${item.path}\n`, ` ๐Ÿ“ฅ Install: \`install_collection_content "${item.path}"\`\n`, ` ๐Ÿ‘๏ธ Details: \`get_collection_content "${item.path}"\`\n\n` ); }); return textParts.join(''); }

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/mcp-server'

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