mcpwn API
    Preparing search index...

    Type Alias RuleAction

    RuleAction:
        | {
            kind: "injectToolResult";
            mode?: "append"
            | "prepend"
            | "replace";
            text: string;
        }
        | {
            kind: "poisonDescription";
            mode?: "append"
            | "prepend"
            | "replace";
            text: string;
            tool?: string;
        }
        | {
            kind: "injectResource";
            mode?: "append"
            | "prepend"
            | "replace";
            text: string;
        }
        | {
            kind: "poisonPrompt";
            mode?: "append"
            | "prepend"
            | "replace";
            text: string;
        }
        | {
            kind: "tamperSampling";
            mode?: "append"
            | "prepend"
            | "replace";
            text: string;
        }
        | { find: string; flags?: string; kind: "matchReplace"; replace: string }
        | { kind: "setArg"; path: string; tool?: string; value: unknown }
        | {
            args: Record<string, unknown>;
            kind: "rewriteArgs";
            mode?: "replace" | "merge";
            tool?: string;
        }
        | {
            kind: "fuzzArgs";
            path: string;
            payloads: string[]
            | string;
            tool?: string;
        }
        | { kind: "drop" }

    Actions a rule can apply to a matched message.

    Type Declaration

    • {
          kind: "injectToolResult";
          mode?: "append" | "prepend" | "replace";
          text: string;
      }
    • {
          kind: "poisonDescription";
          mode?: "append" | "prepend" | "replace";
          text: string;
          tool?: string;
      }
    • {
          kind: "injectResource";
          mode?: "append" | "prepend" | "replace";
          text: string;
      }

      Tamper a server->client resources/read result: mutate result.contents[] text (and blob, decoded then re-encoded, where relevant). Mirrors how injectToolResult walks a tools/call result's content.

    • { kind: "poisonPrompt"; mode?: "append" | "prepend" | "replace"; text: string }

      Tamper a server->client prompts/get result: mutate every result.messages[].content.text (prompt-template poisoning).

    • {
          kind: "tamperSampling";
          mode?: "append" | "prepend" | "replace";
          text: string;
      }

      Tamper a server->client sampling/createMessage request: rewrite every params.messages[].content.text (server-to-model prompt injection).

    • { find: string; flags?: string; kind: "matchReplace"; replace: string }
    • { kind: "setArg"; path: string; tool?: string; value: unknown }

      Set a single argument (by JSON path within params.arguments) to a value, creating it if absent. tool optionally restricts to one tool by name.

    • {
          args: Record<string, unknown>;
          kind: "rewriteArgs";
          mode?: "replace" | "merge";
          tool?: string;
      }

      Replace (or merge into) the whole params.arguments object.

    • { kind: "fuzzArgs"; path: string; payloads: string[] | string; tool?: string }

      Set an argument (by path) to the next payload from a list or payload library, cycling one payload per matching call (stateful cursor).

    • { kind: "drop" }