Skip to main content
Glama

find_usage_examples

Retrieve real usage examples of a function in vanilla DayZ scripts by providing the class and method name.

Instructions

Find real usage examples of a function from vanilla DayZ scripts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
classNameYesClass name
methodNameYesMethod name
limitNoNumber of examples (default 3)

Implementation Reference

  • The actual implementation of findUsageExamples. It iterates over all embedding entries (indexed methods), checks if the entry matches the given className+methodName by comparing fully-qualified name or substring/text match, and returns up to `limit` results.
    findUsageExamples(className: string, methodName: string, limit: number = 3): EmbeddingEntry[] {
      const methodNameLower = methodName.toLowerCase();
      const fqMethod = `${className.toLowerCase()}.${methodNameLower}`;
      const results: EmbeddingEntry[] = [];
    
      for (const entry of this.embeddings) {
        if (entry.type !== 'method') continue;
    
        const methodText = entry.text.toLowerCase();
        const entryClass = (entry.className || '').toLowerCase();
        const entryMethod = (entry.methodName || '').toLowerCase();
        const entryFq = `${entryClass}.${entryMethod}`;
    
        if (entryFq === fqMethod || methodText.includes(fqMethod) || entryMethod === methodNameLower) {
          results.push({
            ...entry,
            similarity: entryFq === fqMethod ? 1 : 0.75
          });
        }
      }
    
      return results.slice(0, limit);
    }
  • Zod schema for the 'find_usage_examples' tool input: className (string), methodName (string), limit (number 1-10, default 3).
    const FindUsageExamplesSchema = z.object({
      className: z.string().describe('Class name'),
      methodName: z.string().describe('Method name'),
      limit: z.number().min(1).max(10).default(3)
    });
  • Tool registration in the ListToolsRequestSchema handler: declares the tool with name 'find_usage_examples', description, and JSON Schema input definition.
    {
      name: 'find_usage_examples',
      description: 'Find real usage examples of a function from vanilla DayZ scripts',
      inputSchema: {
        type: 'object',
        properties: {
          className: {
            type: 'string',
            description: 'Class name'
          },
          methodName: {
            type: 'string',
            description: 'Method name'
          },
          limit: {
            type: 'number',
            description: 'Number of examples (default 3)'
          }
        },
        required: ['className', 'methodName']
      }
    },
  • Tool invocation handler in CallToolRequestSchema: parses args with FindUsageExamplesSchema, calls this.index.findUsageExamples(), and formats the response.
    case 'find_usage_examples': {
      const args = FindUsageExamplesSchema.parse(request.params.arguments);
    
      const examples = this.index.findUsageExamples(args.className, args.methodName, args.limit);
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              className: args.className,
              methodName: args.methodName,
              count: examples.length,
              examples: examples.map(e => ({
                id: e.id,
                type: e.type,
                className: e.className,
                methodName: e.methodName,
                snippet: e.text.substring(0, 260),
                similarity: e.similarity
              }))
            }, null, 2)
          }
        ]
      };
    }
  • Interface declaration of findUsageExamples in the Indexer interface, defining the contract for the method signature.
    findUsageExamples(className: string, methodName: string, limit?: number): EmbeddingEntry[];
Behavior2/5

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

With no annotations, the description must fully inform about behavior. It only states a read-like operation but lacks details on scope (entire codebase?), performance, or output nature.

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?

A single sentence of 12 words, front-loaded with key information. No wasted words.

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?

Lacks explanation of return format (no output schema) and constraints like 'only vanilla scripts'. Adequate but not fully complete for a search tool.

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 coverage is 100% with simple parameter descriptions. The tool description adds no additional meaning beyond the schema, so baseline 3 is appropriate.

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 'Find real usage examples of a function from vanilla DayZ scripts' clearly states the tool's purpose with a specific verb and resource, and distinguishes it from sibling tools like find_callers or get_function_details.

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

Usage Guidelines3/5

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

No explicit when-to-use or alternative guidance is provided. The description implies usage for obtaining examples but does not clarify when to choose this over siblings like search_function.

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

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