Skip to main content
Glama
LostInBrittany

RAGmonsters Custom PostgreSQL MCP Server

getMonsterByName

Search for fictional monster names in the RAGmonsters dataset using partial matches. Returns up to 5 results for efficient identification and retrieval.

Instructions

Get monsters by name (partial match, returns up to 5 matches)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the monster to search for (can be partial)

Implementation Reference

  • The handler function that implements the getMonsterByName tool. It queries the database for monsters whose names partially match the provided name (case-insensitive), returns up to 5 results with basic details, or a not-found message.
    export async function getMonsterByName(params) {
      try {
        if (!dbPool) {
          throw new Error('Database pool not initialized. Call initialize() first.');
        }
        
        logger.info(`getMonsterByName called with params: ${JSON.stringify(params)}`);
        
        const { name } = params;
        
        if (!name) {
          throw new Error('Monster name is required');
        }
        
        // Simple partial match query (case insensitive)
        const query = `
          SELECT 
            m.monster_id,
            m.name,
            m.category,
            m.habitat,
            m.rarity,
            m.primary_power,
            m.secondary_power,
            m.special_ability
          FROM 
            monsters m
          WHERE 
            LOWER(m.name) LIKE LOWER($1)
          ORDER BY
            m.name ASC
          LIMIT 5
        `;
        
        const monsters = await executeQuery(dbPool, query, [`%${name}%`]);
        
        if (monsters.length === 0) {
          logger.info(`No monsters found with name: ${name}`);
          return {
            content: [{
              type: 'text',
              text: JSON.stringify({
                found: false,
                message: `No monsters found with name: ${name}`
              })
            }]
          };
        }
        
        // Format the response for the matches
        logger.info(`Found ${monsters.length} monsters matching name: ${name}`);
        
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              found: true,
              count: monsters.length,
              monsters: monsters.map(monster => ({
                id: monster.monster_id,
                name: monster.name,
                category: monster.category,
                habitat: monster.habitat,
                rarity: monster.rarity,
                powers: {
                  primary: monster.primary_power,
                  secondary: monster.secondary_power,
                  special: monster.special_ability
                }
              }))
            })
          }]
        };
      } catch (error) {
        logger.error(`Error in getMonsterByName: ${error.message}`);
        logger.error(error.stack);
        throw new Error(`Failed to retrieve monster by name: ${error.message}`);
      }
    }
  • Registers the getMonsterByName tool with the MCP server via server.addTool, defining its name, description, input schema using Zod, and binds the execute function imported from monsters.js.
    server.addTool({
      name: 'getMonsterByName',
      description: 'Get monsters by name (partial match, returns up to 5 matches)',
      parameters: z.object({
        name: z.string().describe('Name of the monster to search for (can be partial)')
      }),
      execute: getMonsterByName
    });
  • Zod schema definition for the input parameters of getMonsterByName: requires a 'name' string.
    parameters: z.object({
      name: z.string().describe('Name of the monster to search for (can be partial)')
    }),
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. It discloses key behavioral traits: partial matching and a limit of 5 results, which are valuable beyond basic 'get' functionality. However, it lacks details on error handling, authentication needs, or rate limits, leaving gaps 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 extremely concise and front-loaded: a single sentence that efficiently conveys the core functionality and key constraints. Every word earns its place, with no wasted text or redundancy.

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 low complexity (1 parameter, no output schema, no annotations), the description is minimally complete. It covers the basic operation and behavioral constraints but lacks details on output format or error cases. For a simple lookup tool, this is adequate but leaves room for improvement in contextual richness.

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 documents the 'name' parameter as 'Name of the monster to search for (can be partial).' The description adds no additional meaning beyond this, merely restating 'partial match.' Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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's purpose: 'Get monsters by name' specifies the verb (get) and resource (monsters). It distinguishes from siblings like getMonsterById and getMonsters by focusing on name-based retrieval. However, it doesn't explicitly differentiate from getMonsterByHabitat, which is a similar lookup but by different criteria.

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?

The description implies usage context through 'partial match, returns up to 5 matches,' suggesting it's for fuzzy name searches with result limits. However, it doesn't explicitly state when to use this versus alternatives like getMonsterById (exact ID match) or getMonsters (full list). No guidance on prerequisites or exclusions is provided.

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

Related 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/LostInBrittany/RAGmonsters-mcp-pg'

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