Pudu programming language
Menu
Package

@chrismichaelps / pudu-lang-mcp

Model Context Protocol server for Pudu language documentation and compiler tools

0.1.1Apache-2.01

InstallClose

ToolError.md

Markdown73 lines1.8 KB

GitHub ↗

ToolError


type: module path: "@root/src/PuduLangMcp/Errors/ToolError.pudu" fidelity: Active grammar: "[[grammar/pudu]]" depth_score: 0.4 depth_status: MODERATE coupling: 1 interface_stability: 0.85 tags: [module] aliases: [Tool Failure]


Purpose

Failures a tool reports as a result with isError: true: things a model can correct by changing its arguments or by telling the user what is missing ([[decisions/ADR-0005-text-tool-results]]).

Interface

Signatures

export type ToolFailure
  = MissingArgument(Str)
  | WrongType(Str, Str)             // argument, expected type
  | UnknownArgument(Str)
  | OutOfRange(Str, Str)            // argument, allowed range
  | NotAnObject
  | ExactlyOne(Array[Str])          // names of which exactly one must be given
  | ToolchainMissing
  | OutsideWorkspace(Str)
  | NotFound(Str)                   // what was looked for
  | TimedOut(Str, Int)              // command, milliseconds
  | CommandFailed(Str)              // a command could not be started
  | Unavailable(Str)                // a feature cannot run here, and why

export fn explain(failure: &ToolFailure) -> Str

Linkage

  • Requires: [[src/PuduLangMcp/Constants/Server]].
  • Consumed by: [[src/PuduLangMcp/Domain/Catalog/Arguments]], [[src/PuduLangMcp/Services/Workspace]], App/Tools/*.

Algorithm

One sentence per case, each ending with what to do next.

Negative Logic (Prohibited Paths)

  • A compiler that ran and reported diagnostics is not a ToolFailure: diagnostics are the answer.

Edge Cases

  • ToolchainMissing names both PUDU_BIN and the download page.

Depth

DEPTH 0.4.

Grill Log

  • Q: Is a failed check a tool error? A: No. The check ran; its diagnostics are the result and isError stays false. _Rejected:_ isError on non-zero status, which reads to a model as "the tool broke".

Referenced by

[[src/PuduLangMcp/Errors/_MOC]]