Skip to main content
Glama

count_clipboard_chars

Measure the character count of text excluding spaces and line breaks. Use this tool to analyze Japanese or English text for precise character counts, ensuring accurate text processing.

Instructions

テキストの文字数を計測します。スペースや改行を除いた実質的な文字数をカウントします。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYes文字数をカウントするテキスト

Implementation Reference

  • The private method countTextCharsImpl that contains the core logic for counting characters in the provided text, excluding whitespace and newlines. This is invoked by the count_clipboard_chars tool handler.
    private countTextCharsImpl(text: string, sourceName: string = 'テキスト') { try { // 改行とスペースを除外した文字数 const contentWithoutSpacesAndNewlines = text.replace(/[\s\n\r]/g, ''); const effectiveCharCount = contentWithoutSpacesAndNewlines.length; return { content: [{ type: 'text' as const, text: `${sourceName}の文字数: ${effectiveCharCount}文字(改行・スペース除外)` }] }; } catch (error: any) { return { content: [{ type: 'text' as const, text: `エラーが発生しました: ${error.message}` }], isError: true }; } }
  • src/index.ts:521-527 (registration)
    Registration of the 'count_clipboard_chars' tool using this.server.tool(), including the inline schema with zod and the handler function that delegates to countTextCharsImpl.
    this.server.tool( 'count_clipboard_chars', 'テキストの文字数を計測します。スペースや改行を除いた実質的な文字数をカウントします。', { text: z.string().describe('文字数をカウントするテキスト') }, async ({ text }) => this.countTextCharsImpl(text) );

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/Mistizz/mcp-JapaneseTextAnalyzer'

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