Skip to main content
Glama
Aaryan-Kapoor

MCP Character Tools

Count Substring

count_substring
Read-onlyIdempotent

Count occurrences of a substring in text, with options for case sensitivity and overlapping matches. Returns the count and positions of each match.

Instructions

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]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe text to search in
substringYesThe pattern to find
overlappingNoCount overlapping matches
case_sensitiveNoMatch case exactly
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate read-only, idempotent, non-destructive. Description adds details about overlapping matches, case sensitivity, and return format (count and positions), providing behavioral context beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, well-structured with Args, Returns, and Example sections. It is front-loaded with the purpose and efficiently uses sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description explains return values (count and positions). It covers all parameters, behavior, and an example. The tool is well-defined for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions. The description repeats parameter info but adds an example with 'overlapping=true' clarifying behavior, enhancing semantics beyond the schema alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states 'Count occurrences of a substring or pattern in text' with clear distinction of overlapping vs non-overlapping. It is specific and differentiates from sibling tools like count_letter or count_letters.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or when-not-to-use guidance. The description implies usage via parameter details and example, but lacks comparisons to siblings like batch_count or compare_texts.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/Aaryan-Kapoor/mcp-character-tools'

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