Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/reddit_mcp/tools/get_comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,13 @@ def get_comments_by_submission(
]


class GetCommentResponse(BaseModel):
"""Response wrapper for get_comment_by_id"""
comment: CommentResult


@validate_call(validate_return=True)
def get_comment_by_id(comment_id: str) -> CommentResult:
def get_comment_by_id(comment_id: str) -> GetCommentResponse:
"""
Retrieve a specific comment by ID.

Expand All @@ -82,4 +87,5 @@ def get_comment_by_id(comment_id: str) -> CommentResult:
Comment details with any replies
"""
client = RedditClient.get_instance()
return comment_to_model(client.reddit.comment(comment_id))
comment = comment_to_model(client.reddit.comment(comment_id))
return GetCommentResponse(comment=comment)
4 changes: 3 additions & 1 deletion tests/test_reddit_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def test_get_comments():
assert isinstance(comments[0].body, str)

# Test getting single comment
comment = get_comment_by_id("mgmk7d2")
response = get_comment_by_id("mgmk7d2")
assert hasattr(response, 'comment')
comment = response.comment
assert isinstance(comment, CommentResult)
assert isinstance(comment.id, str)
assert isinstance(comment.body, str)