Skip to main content
Glama

z_algorithm

Compute a string's Z-array or find pattern matches in linear time, using an optional pattern to search the input text.

Instructions

Compute the Z-array for a string, or find pattern matches using the Z-algorithm in linear time.

Input Schema

NameRequiredDescriptionDefault
textYesInput text
patternNoOptional pattern to search for

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations, the description carries the full burden. It states the algorithm's time complexity (linear), which is helpful, but it doesn't disclose crucial behavioral details: whether it returns the Z-array or match positions when a pattern is provided, the format of the output, or any error conditions. For a tool with two distinct modes, this gap is significant.

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 that efficiently communicates the tool's core functionality and performance characteristic. No wasted words.

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

Completeness2/5

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

Without annotations or an output schema, the description should explain what the tool returns in each mode. It doesn't state whether the output is the Z-array, an array of match indices, or a boolean. For a tool with a dual purpose, this lack of return value clarity makes it incomplete.

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 coverage is 100%, so the schema already describes both parameters. The description doesn't add meaning beyond the schema; it merely restates that the tool operates on a string and optionally a pattern. Baseline 3 is appropriate when the schema does the heavy lifting.

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 states a specific verb and resource: 'Compute the Z-array for a string, or find pattern matches using the Z-algorithm in linear time.' It clearly distinguishes the tool's two functions and notes the linear-time property. Compared to algorithmic siblings like z_function or kmp_search, the purpose is unambiguous.

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?

The description implies when to use it (when you need a Z-array or pattern matching), but it doesn't specify when to choose it over alternatives, nor does it clarify the exact conditions for using the optional pattern parameter. There's no explicit 'use this instead of X' guidance.

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