Skip to content

fix(macros): respect local feature in #[prompt] macro — omit + Send bound#1

Open
WeekendSuperhero wants to merge 1 commit intomainfrom
WeekendSuperhero-patch-1
Open

fix(macros): respect local feature in #[prompt] macro — omit + Send bound#1
WeekendSuperhero wants to merge 1 commit intomainfrom
WeekendSuperhero-patch-1

Conversation

@WeekendSuperhero
Copy link
Copy Markdown

Fixes modelcontextprotocol#801

The #[prompt] macro unconditionally emits + Send on generated handler futures, preventing !Send types from being used in prompt handlers even when the local crate feature is enabled.

This brings #[prompt] to parity with #[tool], which already checks cfg!(feature = "local") to conditionally omit the Send bound (tool.rs:341).

Changes

  • Add let omit_send = cfg!(feature = "local"); in the prompt return type generation
  • Gate + Send behind !omit_send for both ReturnType::Default and ReturnType::Type arms

@WeekendSuperhero WeekendSuperhero changed the title ** fix(macros): respect local feature in #[prompt] macro — omit + Send bound fix(macros): respect local feature in #[prompt] macro — omit + Send bound Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[prompt] macro doesn't respect local feature — unconditionally emits + Send unlike #[tool]

1 participant