Skip to main content
Glama
icck

Toy MCP Server

by icck

count_letters

Count occurrences of a specific letter in a given word using this utility. Input the word and letter to get precise results.

Instructions

Count the number of times a letter appears in a word

Input Schema

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

Implementation Reference

  • server.py:16-20 (handler)
    The handler function for the count_letters MCP tool. It defines the input parameters with schema and delegates execution to the core 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)
  • server.py:12-15 (registration)
    Registration of the count_letters tool using FastMCP's @mcp.tool decorator, specifying name and description.
    @mcp.tool( name="count_letters", description="Count the number of times a letter appears in a word", )
  • Core helper function implementing the letter counting logic: converts to lowercase and uses string count method.
    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())
  • Pydantic-based input schema for the tool parameters: word (str) and letter (str).
    word: Annotated[str, Field(description="The word to count letters in")], letter: Annotated[str, Field(description="The letter to count")],

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

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