Skip to main content
Glama

search_by_verb

Find elements that perform specific actions by searching with action verbs like 'analyze', 'create', or 'debug' to identify matching capabilities within the system.

Instructions

Search for elements that can handle a specific action verb (e.g., 'analyze', 'create', 'debug'). Uses verb trigger patterns to find matching elements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
verbYesAction verb to search for (e.g., 'analyze', 'create', 'debug', 'review')
limitNoMaximum number of results to return. Defaults to 20.

Implementation Reference

  • Core implementation of the searchByVerb method in EnhancedIndexHandler class. Performs input validation (Unicode normalization), security logging, retrieves elements matching the verb via EnhancedIndexManager.getElementsByAction, limits results, and formats a markdown response listing matching elements by type and name.
    async searchByVerb(options: {
      verb: string;
      limit: number;
    }) {
      try {
        // FIX: DMCP-SEC-004 - Normalize Unicode in user input
        const normalized = UnicodeValidator.normalize(options.verb);
        if (!normalized.isValid) {
          throw new Error(`Invalid verb: ${normalized.detectedIssues?.join(', ')}`);
        }
        options.verb = normalized.normalizedContent;
    
        // Get the index with error handling
        await this.enhancedIndexManager.getIndex().catch(async (error) => {
          logger.error('Failed to get Enhanced Index, attempting rebuild', error);
          return this.enhancedIndexManager.getIndex({ forceRebuild: true });
        });
    
        // FIX: DMCP-SEC-006 - Add security audit logging
        SecurityMonitor.logSecurityEvent({
          type: 'ELEMENT_CREATED',
          severity: 'LOW',
          source: 'EnhancedIndexHandler.searchByVerb',
          details: `Verb search performed for action: ${options.verb}`,
          additionalData: {
            verb: options.verb,
            limit: options.limit
          }
        });
    
        // Search by verb
        const results = await this.enhancedIndexManager.getElementsByAction(options.verb);
    
        // Limit results
        const limited = results.slice(0, options.limit);
    
        // Format results
        let text = `${this.personaIndicator}🎯 **Elements for Action: "${options.verb}"**\n\n`;
        text += `**Found**: ${limited.length} element${limited.length === 1 ? '' : 's'}\n\n`;
    
        if (limited.length === 0) {
          text += `No elements found that can handle the action "${options.verb}".\n\n`;
          text += `**Tips:**\n`;
          text += `• Try related verbs (e.g., "analyze" → "review", "examine")\n`;
          text += `• Use common action verbs like "create", "debug", "optimize"\n`;
          text += `• Check element descriptions for supported actions\n`;
        } else {
          for (const elementName of limited) {
            // FIX: Use centralized element ID parsing
            // Note: getElementsByAction returns names in "type/name" format for legacy reasons
            const parsed = elementName.includes('/') ?
              { type: elementName.split('/')[0], name: elementName.split('/')[1] } :
              parseElementIdWithFallback(elementName);
    
            const icon = this.getElementIcon(parsed.type);
            text += `${icon} **${parsed.name}** (${parsed.type})\n`;
          }
        }
    
        return {
          content: [{
            type: "text",
            text
          }]
        };
      } catch (error: any) {
        ErrorHandler.logError('EnhancedIndexHandler.searchByVerb', error, options);
        return {
          content: [{
            type: "text",
            text: `${this.personaIndicator}❌ Failed to search by verb: ${SecureErrorHandler.sanitizeError(error).message}`
          }]
        };
      }
    }
  • Registers the MCP tool 'search_by_verb' in getEnhancedIndexTools function, providing tool definition (name, description, inputSchema) and a handler that forwards arguments to the server's searchByVerb method using config defaults.
      tool: {
        name: "search_by_verb",
        description: "Search for elements that can handle a specific action verb (e.g., 'analyze', 'create', 'debug'). Uses verb trigger patterns to find matching elements.",
        inputSchema: {
          type: "object",
          properties: {
            verb: {
              type: "string",
              description: "Action verb to search for (e.g., 'analyze', 'create', 'debug', 'review')",
            },
            limit: {
              type: "number",
              description: `Maximum number of results to return. Defaults to ${config.performance.defaultVerbSearchLimit}.`,
            },
          },
          required: ["verb"],
        },
      },
      handler: (args: SearchByVerbArgs) => server.searchByVerb({
        verb: args.verb,
        limit: args.limit || config.performance.defaultVerbSearchLimit
      })
    },
  • TypeScript interface defining the input arguments for the search_by_verb tool handler.
    interface SearchByVerbArgs {
      verb: string;
      limit?: number;
    }
  • Type definition in IToolHandler interface for the searchByVerb method signature used by the server.
    searchByVerb(options: {verb: string; limit: number}): Promise<any>;
Behavior2/5

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

With no annotations provided, the description carries full burden but only mentions the verb trigger pattern mechanism without detailing behavioral aspects like performance, rate limits, error handling, or output format. It lacks information on what 'elements' refer to or how results are structured.

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 concise with two sentences that efficiently convey the core functionality. It's front-loaded with the main purpose and includes a brief mechanism explanation, though the second sentence could be more tightly integrated.

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 search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'elements' are, how results are returned, or any limitations, leaving significant gaps for an AI agent to understand the tool's behavior and output.

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 both parameters. The description adds minimal value by providing example verbs ('analyze', 'create', 'debug') but doesn't explain semantics beyond what the schema already states, meeting the baseline for high coverage.

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 searches for elements based on action verbs, specifying the verb trigger pattern mechanism. It distinguishes from generic search siblings by focusing on verbs rather than content or collections, though it doesn't explicitly contrast with 'search_all' or 'search_collection'.

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 'search_all', 'search_collection', or 'find_similar_elements'. The description implies usage for verb-based searches but offers no context about prerequisites, limitations, or comparative advantages.

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