Skip to main content
Glama

z_function

Computes the Z-function of a string and optionally searches for a pattern, enabling efficient string matching and prefix analysis.

Instructions

Compute Z-function of a string with optional pattern matching.

Input Schema

NameRequiredDescriptionDefault
textYesInput string to compute Z-function for
patternNoOptional pattern to search for in text

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.11

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It doesn't say what the Z-function output looks like, whether pattern matching returns an index list or something else, edge cases (empty string), or performance characteristics. It only restates the operation.

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 short sentence with no filler, front-loaded with the core action and mention of the optional pattern. Nothing is wasted.

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?

With no output schema, no annotations, and only a two-parameter tool, the description should describe the return value (Z-array vs. pattern match positions) and edge cases. It does not, leaving the agent unable to predict output shape or interpret the pattern parameter's effect.

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%, so both parameters are already documented. The description hints that 'pattern' enables pattern matching, adding a little semantic value beyond the schema's 'Optional pattern to search for in text', but does not specify how the result differs when pattern is provided. Baseline 3 applies 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.

Purpose4/5

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

States a specific verb (Compute) and resource (Z-function of a string), and mentions an optional pattern-matching behavior. It is somewhat differentiated from sibling z_algorithm and prefix_function by naming the Z-function explicitly, though it does not call out those siblings directly.

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

Usage Guidelines2/5

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

There is no guidance on when to use this versus alternatives like z_algorithm, kmp_search, or rabin_karp_search, nor when the optional pattern should be supplied. The description implies a context (string matching) but provides no explicit when-to-use or when-not-to-use rules.

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