mcp-strawberry
Version:
The crucial MCP tool that finally teaches LLMs how to count 'R's in words like 'strawberry'. Because apparently, they can't do it themselves. Seriously.
26 lines (25 loc) • 763 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CounterLetterInWordService = void 0;
class CounterLetterInWordService {
counterLetters(word) {
const counter = {};
const regex = /[a-zA-ZÀ-ÿ]/;
for (const letter of word.toLowerCase()) {
if (regex.test(letter)) {
counter[letter] = (counter[letter] || 0) + 1;
}
}
return JSON.stringify(counter);
}
counterRLetters(word) {
let rCount = 0;
for (const letter of word.toLowerCase()) {
if (letter === "r") {
rCount++;
}
}
return String(rCount);
}
}
exports.CounterLetterInWordService = CounterLetterInWordService;