feat(string): add MGET and MSET batch string operations - #145
Open
darion-yaphet wants to merge 2 commits into
Open
feat(string): add MGET and MSET batch string operations#145darion-yaphet wants to merge 2 commits into
darion-yaphet wants to merge 2 commits into
Conversation
- Add mset() tool to set multiple keys atomically in a single call - Add mget() tool to retrieve multiple keys and return a key-value dict - Support str/int/float/dict/bytes value encoding in mset - Return None for missing keys in mget result
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 54d1cc5. Configure here.
- mget: add isinstance(value, bytes) guard before calling .decode() to avoid AttributeError when connection uses decode_responses=True - mset: normalize values to str instead of bytes, consistent with the decode_responses=True connection default
darion-yaphet
force-pushed
the
feat/mget-mset-batch-string
branch
from
May 26, 2026 15:18
54d1cc5 to
8eb2978
Compare
Contributor
|
Hi @darion-yaphet! Thank you for the contribution! Adding these tools make sense and will improve token efficiency. However, we are already at 53 tools and adding more makes LLM's selection job harder. We already expose the needed tools to add a single key which is also used for adding multiple keys. It also may be confusing which one to decide to use, depending on the LLM. Speed wise, MCP also executes them in parallel so it is no difference there. So I propose for now to hold on with these tools, until we optimize the number of the total tools and then revisit this case again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Note
Low Risk
New optional MCP tools alongside existing set/get; no changes to auth, existing set/get behavior, or expiration semantics.
Overview
Adds two new MCP Redis string tools in
string.py:msetfor atomic multi-key writes andmgetfor bulk reads.msetaccepts amappingsdict, rejects empty input, normalizes values (JSON for dicts, UTF-8 decode for bytes with a hard error on invalid UTF-8,str()otherwise), then calls RedisMSETand returns a success string listing keys.mgetaccepts a key list, rejects empty input, calls RedisMGET, and returns a key→value dict withNonefor missing keys. Byte values are UTF-8 decoded when possible, otherwise returned asrepr(bytes).Reviewed by Cursor Bugbot for commit 8eb2978. Bugbot is set up for automated code reviews on this repo. Configure here.