Expand description
[[tools]] → ToolInfo + Arc<dyn ToolHandler> synthesizer.
Net-new code for Phase 83 TKIT-07. Turns curated [[tools]] config entries
into complete pmcp ToolInfo + Arc<dyn ToolHandler> pairs with zero
per-tool Rust handlers.
§Invariants enforced
- JSON Schema object envelope. Every synthesized
ToolInfocarries aninput_schemawith"type": "object", an explicitpropertiesmap, arequiredarray, and"additionalProperties": false. Unknown argument keys are rejected by pmcp’s request-validation path attools/calltime — defence-in-depth against arg-injection (threat T-83-05-02). handler.metadata()returnsSome(ToolInfo). Phase 82’stool_arcconsumeshandler.metadata()at registration; returningNonewould silently degrade the schema enforcement to “anything goes” (RESEARCH §Risks #2 — threat T-83-05-01).- Constructors, never struct-literals. Both
ToolInfoandToolAnnotationsare#[non_exhaustive](PATTERNS §Pattern C). The synthesizer usesToolInfo::with_annotations/ToolInfo::newand theToolAnnotations::new()-then-.with_*fluent builder. - Cognitive complexity ≤25 per function. Decomposed into
[
build_input_schema], [build_param_property], and [build_annotations] per Phase 75 D-03 + PATTERNS §Pattern G. No#[allow]annotations.
Functions§
- synthesize_
from_ config - Synthesize one
ToolInfo+ handler per[[tools]]config entry. - synthesize_
from_ config_ with_ connector - Synthesize tools that execute against a wired
SqlConnector(Phase 84 CONN-01 / D-06). ADDITIVE variant alongsidesynthesize_from_config— the existing API is unchanged and all P83 callers compile without modification. - synthesize_
from_ config_ with_ http_ connector - Synthesize one
ToolInfo+ handler per single-call[[tools]]entry, executing against a wiredHttpConnector(Phase 90 OAPI-02a / D-01). - synthesize_
from_ config_ with_ http_ connector_ and_ scripts - Synthesize single-call AND script
[[tools]]against a wiredHttpConnectorplus a sharedHttpCodeExecutor+ExecutionConfig(Phase 90 OAPI-02b / D-01 / D-02).
Type Aliases§
- Synthesized
Tool - Type alias for one synthesized tool tuple:
(name, ToolInfo, Arc<dyn ToolHandler>).