Arguments.md
Arguments
type: module path: "@root/src/PuduLangMcp/Domain/Catalog/Arguments.pudu" fidelity: Active domain: "[[domain/Tool]]" grammar: "[[grammar/pudu]]" depth_score: 0.6 depth_status: DEEP coupling: 3 interface_stability: 0.85 tags: [module, deep] aliases: [Arguments]
Purpose
Validate a tools/call arguments value against its [[src/PuduLangMcp/Domain/Catalog/ToolSpec]], and hand tools typed values they no longer need to check.
Interface
Signatures
export type Args = { values: Array[(Str, Json.Json)] }
export fn validate(spec: &ToolSpec.ToolSpec, arguments: &Json.Json) -> Result[Args, ToolError.ToolFailure]
export fn text(args: &Args, name: Str) -> Option[Str]
export fn integer(args: &Args, name: Str) -> Option[Int]
export fn integerOr(args: &Args, name: Str, fallback: Int) -> IntLinkage
- Requires: [[src/PuduLangMcp/Domain/Catalog/ToolSpec]], [[src/PuduLangMcp/Errors/ToolError]], [[src/PuduLangMcp/Utils/JsonAccess]].
- Consumed by: [[src/PuduLangMcp/App/Tools/Registry]] and every tool handler.
Algorithm
nullarguments are{}; any other non-object isNotAnObject.- Every member must be a declared property, else
UnknownArgument(name)(first in member order). - Each declared property, in declaration order: absent and required is
MissingArgument; present with the wrong JSON kind isWrongType(name, kind); a text property that is required must not be blank (WrongType(name, "a non-empty string")); an integer outsideminimum..maximumisOutOfRange(name, "between a and b"). - With an
exactlyOnegroup, the number of its names present must be 1, elseExactlyOne(group).
Negative Logic (Prohibited Paths)
- No coercion between kinds;
"5"is not an integer. - A
nullmember is the wrong kind, not an absent one.
Edge Cases
- A blank optional text property is accepted and handled by the tool.
- Both
sourceandpathgiven, or neither:ExactlyOne.
Depth
DEPTH 0.6 (DEEP).
Grill Log
- Q: Refuse undeclared members? A: Yes; the schema says
additionalProperties: false, and silently ignoring a misspeltlimthides the model's mistake. _Rejected:_ lenient extra members.
Referenced by
[[src/PuduLangMcp/Domain/Catalog/_MOC]]
