Skip to main content

PLACEHOLDER_MAX_LENGTH

Constant PLACEHOLDER_MAX_LENGTH 

Source
pub const PLACEHOLDER_MAX_LENGTH: usize = 256; // 256usize
Expand description

The D4 path-placeholder floor, re-exported from core pmcp.

There is exactly ONE implementation of these rules and it lives in pmcp::server::schema_validation. This is a pub use, never a second copy (Phase 128, Q2). Two reasons the home is core rather than here:

  1. The toolkit’s curated http build has no pmcp-code-mode edge and must not gain one (SC-1), so the shared rule cannot live in this crate.
  2. This repo has a documented three-way-drift incident from a security rule that existed in more than one copy, so a second denylist is a prohibited shape rather than a style preference.

The re-export exists because D-09 obliges the SDK to publish the helper under the name a third-party HttpExecutor implementor would look for. An implementor whose template syntax is not OpenAPI’s {key} can call pmcp_code_mode::validate_path_placeholder on each value it substitutes and pmcp_code_mode::validate_resolved_path on the composed result — or pmcp_code_mode::validate_resolved_target, which is that rule widened by the single author-written ? separator, and is what ResolvedPath::from_checked itself calls. Either reaches the same rule the SDK itself applies before calling HttpExecutor::execute_request. (Plain backticks, not an intra-doc link: executor is gated on js-runtime and the link would not resolve in a default-feature doc build.) The hard upper bound on a path-placeholder value, in Unicode code points.

Deliberately a module CONSTANT and not a configuration value. D-08 requires the length half of the CR-01 fix to hold regardless of how D3 is configured — in particular when default_max_length is set to 0, which would otherwise silently disable the “Length via two placeholders” acceptance row along with the free-text policy. A validation rule that a configuration value can switch off is the silent-hole class this phase exists to remove.

Counted in code points, not bytes and not grapheme clusters, so it agrees with jsonschema’s own maxLength semantics (RESEARCH Finding 1d).