Description
Rust API naming conventions (C-GETTER) call for simple accessors to be named after the field/value they return, without a get_ prefix (user.name() not user.get_name()). Several public methods in this crate use the get_ prefix for what are plain field/derived-value accessors, which is inconsistent with the rest of the crate's accessor naming (e.g. CompletionInfo::has_more_results, CompletionInfo::total_available in the same file use the idiomatic style) and with the wider Rust ecosystem's expectations.
Reproduction Steps
rg -n "pub fn get_[a-z_]+\(" crates/rmcp/src
- Compare against neighboring accessors in the same types that already follow C-GETTER (no
get_ prefix).
Expected Behavior
Simple accessors follow C-GETTER: argument(), text(), traceparent(), tracestate(), baggage(), progress_token(), required_scope(), authorization_url().
Actual Behavior
Named get_argument, get_text, get_traceparent, get_tracestate, get_baggage, get_progress_token, get_required_scope, get_authorization_url.
Environment
- Version: v3.1.2 (current
main, commit 02c62ae)
- Features: N/A
Locations
crates/rmcp/src/model.rs:3180 — Prompt::get_argument (or similar; simple field lookup)
crates/rmcp/src/model/content.rs:160 — get_text
crates/rmcp/src/model/meta.rs:271,292,302,436 — get_traceparent, get_tracestate, get_baggage, get_progress_token
crates/rmcp/src/transport/streamable_http_client.rs:167 — get_required_scope
crates/rmcp/src/transport/auth.rs:3417 — get_authorization_url
crates/rmcp/src/task_manager.rs:402 — get_task (borderline: does a lookup by id, get_task-style naming may be acceptable here similar to HashMap::get)
Not flagged: transport/auth.rs:489 get_access_token — this performs actual async work (token fetch/refresh), not a field read, so get_ more plausibly signals "go fetch" rather than "read a field."
Note on breaking change
Renaming these is a public API break — needs !:/BREAKING CHANGE: marker and cargo public-api diff / cargo semver-checks will need updated baselines. Consider batching with another planned breaking-change release rather than a standalone patch.
Upstream
None found — searched modelcontextprotocol/rust-sdk issues and PRs (all states) for "get_ getter naming" with no matches.
Logs / Evidence
N/A — static analysis / naming-convention finding.
Description
Rust API naming conventions (C-GETTER) call for simple accessors to be named after the field/value they return, without a
get_prefix (user.name()notuser.get_name()). Several public methods in this crate use theget_prefix for what are plain field/derived-value accessors, which is inconsistent with the rest of the crate's accessor naming (e.g.CompletionInfo::has_more_results,CompletionInfo::total_availablein the same file use the idiomatic style) and with the wider Rust ecosystem's expectations.Reproduction Steps
rg -n "pub fn get_[a-z_]+\(" crates/rmcp/srcget_prefix).Expected Behavior
Simple accessors follow C-GETTER:
argument(),text(),traceparent(),tracestate(),baggage(),progress_token(),required_scope(),authorization_url().Actual Behavior
Named
get_argument,get_text,get_traceparent,get_tracestate,get_baggage,get_progress_token,get_required_scope,get_authorization_url.Environment
main, commit 02c62ae)Locations
crates/rmcp/src/model.rs:3180—Prompt::get_argument(or similar; simple field lookup)crates/rmcp/src/model/content.rs:160—get_textcrates/rmcp/src/model/meta.rs:271,292,302,436—get_traceparent,get_tracestate,get_baggage,get_progress_tokencrates/rmcp/src/transport/streamable_http_client.rs:167—get_required_scopecrates/rmcp/src/transport/auth.rs:3417—get_authorization_urlcrates/rmcp/src/task_manager.rs:402—get_task(borderline: does a lookup by id,get_task-style naming may be acceptable here similar toHashMap::get)Not flagged:
transport/auth.rs:489get_access_token— this performs actual async work (token fetch/refresh), not a field read, soget_more plausibly signals "go fetch" rather than "read a field."Note on breaking change
Renaming these is a public API break — needs
!:/BREAKING CHANGE:marker andcargo public-api diff/cargo semver-checkswill need updated baselines. Consider batching with another planned breaking-change release rather than a standalone patch.Upstream
None found — searched
modelcontextprotocol/rust-sdkissues and PRs (all states) for "get_ getter naming" with no matches.Logs / Evidence
N/A — static analysis / naming-convention finding.