Skip to main content
Glama
MCP Character Tools

MCP Character Tools

MCP Character Tools

NPM Version TypeScript MCP License

The last thing you need for your LLM to work with individual characters or count the number of r's in a word. This is an MCP server providing 14+ comprehensive (and pretty) character and text analysis tools to help LLMs work with individual characters - something they struggle with due to tokenization.

See the Difference

Without MCP (Wrong)

With MCP (Correct)

Claims there are 2 r's in "garlic"

Correctly identifies 1 r in "garlic"

Related MCP server: text-count-mcp-server

Why This Exists

First of all, why not? Second, Large Language Models tokenize text into subwords, not individual characters. For example, "strawberry" might become tokens like ["straw", "berry"], so the model never truly "sees" individual letters. This MCP server gives LLMs "character-level vision" through a suite of tools.

Installation

npx mcp-character-tools

Via npm (global install)

npm install -g mcp-character-tools
mcp-character-tools

From source

git clone https://github.com/Aaryan-Kapoor/mcp-character-tools
cd mcp-character-tools
npm install
npm run build
npm start

Usage with Claude Desktop

Add to your Claude Desktop configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "char-tools": {
      "command": "npx",
      "args": ["mcp-character-tools"]
    }
  }
}

All Tools Reference

See sample_outputs.md for complete examples with inputs and outputs for all 14+ tools.

Tool

Description

count_letter

Count a specific letter

count_letters

Count multiple letters at once

count_substring

Count substring occurrences

letter_frequency

Get frequency distribution

spell_word

Break into characters

char_at

Get character at index

nth_character

Get nth character (1-based)

word_length

Get exact length

reverse_text

Reverse text, detect palindromes

compare_texts

Compare two texts

analyze_sentence

Word-by-word breakdown

batch_count

Count across multiple words

get_tricky_words

List commonly miscounted words

check_tricky_word

Check if word is tricky

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run tests with coverage
npm run test:coverage

# Development mode with auto-rebuild
npm run dev

Testing

The project includes comprehensive tests for all tools:

npm test

Test files:

  • tests/counting.test.ts - Counting tools tests

  • tests/spelling.test.ts - Spelling tools tests

  • tests/analysis.test.ts - Analysis tools tests

  • tests/tricky-words.test.ts - Tricky words resource tests

  • tests/visualization.test.ts - Visualization utility tests

License

MIT

Available Tools

14 tools
analyze_sentenceAnalyze SentenceA
Read-onlyIdempotent

Analyze a sentence word-by-word for a specific letter.

Shows exactly how many times a letter appears in each word.

Args:

  • text (string): The sentence to analyze

  • letter (string): The letter to count

  • case_sensitive (boolean): Match case exactly (default: false)

Returns: Per-word breakdown with counts and positions.

Example: analyze_sentence("The strawberry was very ripe", "r") → per-word counts

Inputs: text (required), letter (required), case_sensitive.

batch_countBatch CountA
Read-onlyIdempotent

Count a letter across multiple words at once.

Efficiently process a list of words.

Args:

  • words (string[]): Array of words to analyze

  • letter (string): The letter to count

  • case_sensitive (boolean): Match case exactly (default: false)

Returns: Results for each word, totals, sorted by count.

Example: batch_count(["strawberry", "raspberry", "blueberry"], "r") → individual and total counts

Inputs: words (required), letter (required), case_sensitive.

char_atCharacter At IndexA
Read-onlyIdempotent

Get the character at a specific index (0-based). Supports negative indices.

Args:

  • text (string): The text to index into

  • index (number): Position (0-based, negative counts from end)

Returns: The character at that position, or error if out of bounds.

Example: char_at("hello", 1) → 'e'; char_at("hello", -1) → 'o'

Inputs: text (required), index (required).

check_tricky_wordCheck Tricky WordA
Read-onlyIdempotent

Look up a specific word to see if it's a commonly miscounted word.

Args:

  • word (string): The word to check

Returns: Information about common mistakes if it's a tricky word, or empty if not.

Example: check_tricky_word("strawberry") → explains the 3 r's and common mistake of counting 2

Inputs: word (required).

compare_textsCompare TextsA
Read-onlyIdempotent

Compare letter frequencies between two texts.

Useful for analyzing similarity or differences.

Args:

  • text1 (string): First text

  • text2 (string): Second text

  • case_sensitive (boolean): Distinguish case (default: false)

Returns: Common characters, unique to each, frequency comparison, similarity score.

Example: compare_texts("hello", "world") → common: ['l', 'o'], unique_to_text1: ['h', 'e'], etc.

Inputs: text1 (required), text2 (required), case_sensitive.

count_letterCount LetterA
Read-onlyIdempotent

Count occurrences of a specific letter in text.

Returns the count, positions, a visual breakdown showing where each letter appears, and a density percentage.

Args:

  • text (string): The text to analyze

  • letter (string): The single letter to count

  • case_sensitive (boolean): Whether to match case exactly (default: false)

Returns: count, positions array, visual breakdown, and density summary.

Example: count_letter("strawberry", "r") → count: 3, positions: [2, 5, 8]

Inputs: text (required), letter (required), case_sensitive.

count_lettersCount Multiple LettersA
Read-onlyIdempotent

Count occurrences of multiple letters at once.

Efficiently counts several letters in a single call.

Args:

  • text (string): The text to analyze

  • letters (string[]): Array of letters to count

  • case_sensitive (boolean): Match case exactly (default: false)

Returns: Results for each letter with counts and positions.

Example: count_letters("strawberry", ["r", "s", "e"]) → r: 3, s: 1, e: 1

Inputs: text (required), letters (required), case_sensitive.

count_substringCount SubstringA
Read-onlyIdempotent

Count occurrences of a substring or pattern in text.

Can count overlapping or non-overlapping matches.

Args:

  • text (string): The text to search in

  • substring (string): The pattern to find

  • case_sensitive (boolean): Match case exactly (default: false)

  • overlapping (boolean): Count overlapping matches (default: false)

Returns: count and positions of each match.

Example: count_substring("banana", "ana", overlapping=true) → count: 2, positions: [1, 3]

Inputs: text (required), substring (required), overlapping, case_sensitive.

get_tricky_wordsGet Tricky WordsA
Read-onlyIdempotent

Get a list of words that are commonly miscounted by LLMs.

These are words with double letters, repeated patterns, or other features that cause counting errors.

Returns: List of tricky words with correct counts and explanations.

Example: Returns "strawberry" with explanation that it has 3 r's, not 2.

Inputs: no named parameters.

letter_frequencyLetter FrequencyA
Read-onlyIdempotent

Get frequency distribution of all characters in text.

Provides a complete breakdown of character frequencies.

Args:

  • text (string): The text to analyze

  • case_sensitive (boolean): Distinguish upper/lowercase (default: false)

  • include_spaces (boolean): Include spaces in count (default: false)

  • include_punctuation (boolean): Include punctuation (default: false)

  • letters_only (boolean): Only count a-z letters (default: true)

Returns: Frequency map, sorted list, most/least common characters.

Example: letter_frequency("hello") → h: 1, e: 1, l: 2, o: 1

Inputs: text (required), letters_only, case_sensitive, include_spaces, +1 more.

nth_characterNth CharacterA
Read-onlyIdempotent

Get the nth character (1-based, human-friendly numbering).

"What's the 3rd letter?" uses position=3.

Args:

  • text (string): The text to examine

  • position (number): Which character (1 = first, 2 = second, etc.)

  • from_end (boolean): Count from end instead (default: false)

Returns: The character and a human-readable description.

Example: nth_character("hello", 2) → 'e' (the 2nd character)

Inputs: text (required), position (required), from_end.

reverse_textReverse TextA
Read-onlyIdempotent

Reverse text character-by-character or word-by-word.

Also detects if the text is a palindrome.

Args:

  • text (string): The text to reverse

  • reverse_words_only (boolean): Reverse word order only, not characters (default: false)

Returns: Reversed text, palindrome detection.

Example: reverse_text("hello") → "olleh"; reverse_text("racecar") → "racecar" (palindrome!)

Inputs: text (required), reverse_words_only.

spell_wordSpell WordA
Read-onlyIdempotent

Break text into individual characters with optional indices.

Perfect for verifying character-by-character content.

Args:

  • text (string): The text to spell out

  • include_indices (boolean): Include position numbers (default: true)

Returns: Array of characters, indexed list, spelled out string.

Example: spell_word("cat") → ['c', 'a', 't'] with indices [0:'c', 1:'a', 2:'t']

Inputs: text (required), include_indices.

word_lengthWord LengthA
Read-onlyIdempotent

Get the exact length of text with detailed breakdown.

Args:

  • text (string): The text to measure

  • count_spaces (boolean): Include spaces in length (default: true)

Returns: Total length, length without spaces, space count, word count.

Example: word_length("hello world") → 11 total, 10 without spaces, 2 words

Inputs: text (required), count_spaces.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 14 tools

    Disambiguation4/5

    Most tools have distinct purposes, but char_at (0-based) and nth_character (1-based) could cause confusion, as could check_tricky_word vs get_tricky_words. Otherwise, tools like count_letter, count_letters, and count_substring are clearly differentiated.

    Naming Consistency3/5

    Tool names follow a verb_noun pattern but vary in detail (e.g., 'char_at' is abbreviated, 'nth_character' is more descriptive, 'letter_frequency' is noun_noun). Inconsistent use of 'count_letter' vs 'count_letters' and 'get_tricky_words' vs 'check_tricky_word' adds to the mixed style.

    Tool Count5/5

    14 tools is well-scoped for a character analysis server. Each tool serves a specific purpose (counting, indexing, frequency, tricky words, reversing, etc.) without being redundant or too many.

    Completeness4/5

    The set covers core character operations like counting, indexing, frequency, and substring analysis. Minor gaps exist (e.g., no case conversion or word-level tokenization beyond length), but the domain is well-served for typical letter-counting tasks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      F
      maintenance
      Precise character-level string indexing for LLMs. Provides tools for finding, extracting, and manipulating text by exact character position to solve position-based operations.
      12
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides tools for AI models to count characters and words in text, supporting English and other space-delimited languages.
      1
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Accurately counts characters, bytes, and manuscript paper based on Unicode grapheme clusters, and provides deterministic feedback to help AI meet exact length limits for self-introductions or school records.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Provides AI agents with local file-processing capabilities for token counting, RAG chunking, CSV/JSON conversion, QR generation, and more, while keeping documents private on the user's machine.
      7
      1
      MIT