Skip to main content
Glama

kmp_search

Read-onlyIdempotent

Find every occurrence of a pattern in text using Knuth-Morris-Pratt with a failure function for reliable substring matching.

Instructions

Find all occurrences of a pattern in text using Knuth-Morris-Pratt algorithm with failure function.

Input Schema

NameRequiredDescriptionDefault
textYesText to search in
patternYesPattern to find

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive and openWorld, so the safety profile is covered. The description adds only that all occurrences are returned, without saying whether overlapping matches are included, what the result shape is, or any complexity trade-off beyond naming KMP.

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?

A single front-loaded sentence with no filler; the core action comes first and the algorithm detail follows as a qualifier.

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

Completeness3/5

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

There is no output schema, so the description bears the burden of explaining return values, and it only implies matches without specifying indices vs. substrings or overlap handling. Adequate to call correctly, incomplete to interpret results.

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

Parameters3/5

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

Schema description coverage is 100%, with both parameters documented, so the baseline is 3. The description adds nothing beyond the schema about pattern/text semantics (e.g. literal vs regex, empty pattern, case sensitivity).

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

Purpose4/5

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

States a specific verb and resource ('Find all occurrences of a pattern in text') and even names the algorithm, so the operation is unambiguous. However, it never distinguishes itself from near-identical siblings like rabin_karp_search or aho_corasick_search, which do the same job with different algorithms.

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?

Usage is only implied: an agent can infer 'use this when you need pattern matching in text,' but the description gives no when-not conditions and does not mention the obvious alternatives (rabin_karp_search, aho_corasick_search for multi-pattern, text_count_occurrences for a simple count).

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

Deploy Server

Other Tools