Skip to main content
Glama
icck

Toy MCP Server

by icck

count_letters

Count how many times a specific letter appears in any given word to analyze text patterns or verify character frequency.

Instructions

Count the number of times a letter appears in a word

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wordYesThe word to count letters in
letterYesThe letter to count

Implementation Reference

  • server.py:12-15 (registration)
    Registration of the 'count_letters' tool using @mcp.tool decorator with name and description.
    @mcp.tool( name="count_letters", description="Count the number of times a letter appears in a word", )
  • server.py:16-20 (handler)
    The handler function for the 'count_letters' tool, defining input schema via Annotated Fields and delegating to the implementation.
    def count_letters( word: Annotated[str, Field(description="The word to count letters in")], letter: Annotated[str, Field(description="The letter to count")], ) -> int: return count_letters_impl(word, letter)
  • Helper function containing the core logic for counting occurrences of a letter in a word, case-insensitively.
    def count_letters_impl( word: Annotated[str, Field(description="The word to count letters in")], letter: Annotated[str, Field(description="The letter to count")], ) -> int: """Count the number of times a letter appears in a word.""" return word.lower().count(letter.lower())

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/icck/toy'

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