Skip to content

Conversation

@jboolean
Copy link

@jboolean jboolean commented Dec 5, 2025

This updates the documentation comments for AddReceivingMiddleware and AddSendingMiddleware to clarify how middlewares are ordered. The existing documentation is confusing and could lead one to believe middleware is applied from right to left at the time of execution (e.g. the mcp-go sdk does it this way).
In fact, because the wrapping is done at the time of adding and not at the time of execution, middleware is only applied in reverse order (and therefore run in order) within the set of middlewares being added together, while middleware added successively is applied on top of existing middleware and thus run in reverse order.

…ddleware

Updated comment to clarify how middleware is ordered
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.

1 participant