Skip to main content
Glama
Traves-Theberge

Word of the Day MCP Server

get_word_definition

Retrieve definitions, pronunciations, and meanings for any word using a dictionary API to enhance vocabulary understanding.

Instructions

Get the definition, pronunciation, and meanings of a word using the Dictionary API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wordYesThe word to get the definition for
languageNoLanguage code (default: en)en

Implementation Reference

  • The handler function that validates input using GetDefinitionArgsSchema, fetches word data from Dictionary API, handles errors, formats response with pronunciation, origin, meanings, definitions, examples, synonyms, antonyms, and audio links.
    private async getWordDefinition(args: unknown) {
      const { word, language = 'en' } = GetDefinitionArgsSchema.parse(args);
      
      try {
        const response = await fetch(`https://api.dictionaryapi.dev/api/v2/entries/${language}/${encodeURIComponent(word)}`);
        
        if (!response.ok) {
          if (response.status === 404) {
            return {
              content: [
                {
                  type: 'text',
                  text: `No definition found for "${word}". Please check the spelling or try a different word.`,
                },
              ],
            };
          }
          throw new Error(`Dictionary API error: ${response.status} ${response.statusText}`);
        }
    
        const data: WordEntry[] = await response.json();
        
        if (!data || data.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: `No definition found for "${word}".`,
              },
            ],
          };
        }
    
        const entry = data[0];
        let result = `**${entry.word}**\n\n`;
        
        // Add phonetic information
        if (entry.phonetic) {
          result += `**Pronunciation:** ${entry.phonetic}\n\n`;
        } else if (entry.phonetics && entry.phonetics.length > 0) {
          const phoneticTexts = entry.phonetics
            .filter(p => p.text)
            .map(p => p.text)
            .join(', ');
          if (phoneticTexts) {
            result += `**Pronunciation:** ${phoneticTexts}\n\n`;
          }
        }
    
        // Add origin if available
        if (entry.origin) {
          result += `**Origin:** ${entry.origin}\n\n`;
        }
    
        // Add meanings
        result += `**Meanings:**\n\n`;
        entry.meanings.forEach((meaning, index) => {
          result += `${index + 1}. **${meaning.partOfSpeech}**\n`;
          meaning.definitions.forEach((def, defIndex) => {
            result += `   ${defIndex + 1}. ${def.definition}\n`;
            if (def.example) {
              result += `      *Example: "${def.example}"*\n`;
            }
            if (def.synonyms && def.synonyms.length > 0) {
              result += `      *Synonyms: ${def.synonyms.join(', ')}*\n`;
            }
            if (def.antonyms && def.antonyms.length > 0) {
              result += `      *Antonyms: ${def.antonyms.join(', ')}*\n`;
            }
          });
          result += '\n';
        });
    
        // Add audio pronunciation links if available
        const audioLinks = entry.phonetics
          .filter(p => p.audio)
          .map(p => p.audio)
          .filter(Boolean);
        
        if (audioLinks.length > 0) {
          result += `**Audio Pronunciation:**\n`;
          audioLinks.forEach((audio, index) => {
            result += `${index + 1}. ${audio}\n`;
          });
        }
    
        return {
          content: [
            {
              type: 'text',
              text: result,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to fetch definition for "${word}": ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • Zod schema defining input parameters for get_word_definition: required 'word' string, optional 'language' string defaulting to 'en'.
    const GetDefinitionArgsSchema = z.object({
      word: z.string().min(1, 'Word cannot be empty'),
      language: z.string().default('en').optional(),
    });
  • src/index.ts:72-90 (registration)
    Tool registration in ListTools handler, specifying name, description, and JSON schema matching the Zod schema.
    {
      name: 'get_word_definition',
      description: 'Get the definition, pronunciation, and meanings of a word using the Dictionary API',
      inputSchema: {
        type: 'object',
        properties: {
          word: {
            type: 'string',
            description: 'The word to get the definition for',
          },
          language: {
            type: 'string',
            description: 'Language code (default: en)',
            default: 'en',
          },
        },
        required: ['word'],
      },
    },
  • TypeScript interface defining the structure of the Dictionary API response entry used in the handler.
    interface WordEntry {
      word: string;
      phonetic?: string;
      phonetics: PhoneticInfo[];
      origin?: string;
      meanings: Meaning[];
    }
  • Interface for meaning objects containing partOfSpeech and definitions array.
    interface Meaning {
      partOfSpeech: string;
      definitions: Definition[];
    }
Behavior2/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 states what the tool does but lacks details on traits like rate limits, error handling, or response format. This is a significant gap for a tool that interacts with an external API.

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 a single, efficient sentence that front-loads the key information (what the tool does) without any wasted words. It is appropriately sized for the tool's complexity.

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 (2 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavior, usage context, or output, leaving gaps that could hinder effective tool selection.

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?

The input schema has 100% description coverage, documenting both parameters ('word' and 'language') clearly. The description adds no additional meaning beyond what the schema provides, such as examples or constraints, so it meets the baseline for high schema 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 action ('Get') and the resources involved ('definition, pronunciation, and meanings of a word'), making the purpose evident. However, it doesn't explicitly differentiate from the sibling tool 'get_random_word', which appears to serve a different purpose (fetching random words rather than definitions).

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?

The description provides no guidance on when to use this tool versus alternatives, such as the sibling 'get_random_word'. It mentions the Dictionary API but doesn't specify contexts or exclusions, leaving usage decisions unclear.

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/Traves-Theberge/Word_of_the_day'

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