Skip to content

RequestMetaObject extractor empties RequestContext::meta for later parameters #1580

Todo

Description

@orangeCatDeveloper

Describe the bug

A tool or prompt handler that takes both RequestMetaObject and RequestContext sees an empty RequestContext::meta when RequestMetaObject comes first. The RequestMetaObject extractor moves the meta out of the context instead of copying it:

// crates/rmcp/src/handler/server/common.rs
let request_context = context.as_request_context_mut();
let mut meta = crate::model::RequestMetaObject::default();
std::mem::swap(&mut meta, &mut request_context.meta);
Ok(meta)

Every other RequestContext-derived extractor (RequestContext, Peer, Extensions, RequestId, CancellationToken) clones.

To Reproduce

On main (3725772):

#[tool]
async fn probe(&self, meta: RequestMetaObject, ctx: RequestContext<RoleServer>) -> String {
    format!("meta={:?} ctx={:?}", meta.get_progress_token(), ctx.meta.get_progress_token())
}

Call it from an rmcp client (which attaches a progress token):

meta=Some(ProgressToken(Number(0))) ctx=None

Expected behavior

meta=Some(ProgressToken(Number(0))) ctx=Some(ProgressToken(Number(0))). The parameter order should not change what a handler sees.

Impact

Code that reads ctx.meta gets no progress token, so it cannot report progress, and on sessionless requests it also loses the client info and capabilities carried in _meta.

I have a fix with a test and can open a PR.

Activity

  1. github-actions commented on Dec 6, 2026

    @github-actions
    Contributor

    @connor4312 is on triage rotation this week and is the reviewer for this one.

    Automated classification did not run for this one, so it needs a full manual pass.

    Automated triage. Labels are a first pass and the assigned maintainer has the final say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions