Skip to main content

Crate rtk_mcp_cc

Crate rtk_mcp_cc 

Source
Expand description

Shared logic for the rtk-mcp-cc plugin.

Everything here is pure and unit-tested: settings resolution, the argument vectors handed to rtk, and the hook’s pass-through decision. The binaries in src/bin/ only move bytes and spawn processes.

The guiding constraint is that this plugin owns no rewriting logic. rtk already speaks Claude Code’s PreToolUse schema natively via rtk hook claude — it reads the event on stdin and writes hookSpecificOutput.updatedInput on stdout. Re-implementing that here would duplicate knowledge rtk owns and drift the moment rtk changes. So the hook delegates, and this crate’s job is only to delegate safely.

Structs§

Config
Resolved plugin settings.
DiscoverOptions
Options for the rtk_discover tool.
GainOptions
Options for the rtk_gain tool.

Functions§

check_args
Build the argv for rtk hook check <command> — a dry run that reports how a command would be rewritten, without executing anything.
delegate
Decide what this hook writes to stdout.
discover_args
Build the argv for rtk discover.
extract_frontmatter 🔒
Return the text between the leading --- fences, if present.
gain_args
Build the argv for rtk gain.
hook_args
The argument vector for the delegated hook call: rtk hook claude [flags].
parse_bool 🔒
Accept the spellings people actually write in config files and shells.
proxy_args
Build the argv for rtk proxy -- <argv>.
validate_format 🔒