Skip to content

feat: pretty-print JSONL text responses in mcpcurl #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 12, 2025

Conversation

simondanielsson
Copy link
Contributor

@simondanielsson simondanielsson commented Apr 12, 2025

This PR adds functionality to pretty-print JSONL text responses.

  • Required to be able to preview response of for instance list_pull_requests.

Closes: #238

Before change:

$ ./mcpcurl --stdio-server-cmd "./github-mcp-server stdio" tools list_pull_requests --owner github --repo github-mcp-server --page 1 --perPage 1 --pretty
error printing response: failed to parse text content: json: cannot unmarshal array into Go value of type map[string]interface {}

After change:

$ ./mcpcurl --stdio-server-cmd "./github-mcp-server stdio" tools list_pull_requests --owner github --repo github-mcp-server --page 1 --perPage 1 --pretty
[
  {
    "_links": {
      "comments": {
        "href": "https://api.github.com/repos/github/github-mcp-server/issues/235/comments"
      },
      "commits": {
        "href": "https://api.github.com/repos/github/github-mcp-server/pulls/235/commits"
      },
      "html": {
        "href": "https://github.com/github/github-mcp-server/pull/235"
      },
      "issue": {
        "href": "https://api.github.com/repos/github/github-mcp-server/issues/235"
      },
      "review_comment": {
        "href": "https://api.github.com/repos/github/github-mcp-server/pulls/comments{/number}"
      },
      "review_comments": {
        "href": "https://api.github.com/repos/github/github-mcp-server/pulls/235/comments"
      },
      "self": {
        "href": "https://api.github.com/repos/github/github-mcp-server/pulls/235"
      },
      "statuses": {
        "href": "https://api.github.com/repos/github/github-mcp-server/statuses/908e3b05fab6777cf3aae284896a61d3b727c844"
      }
    },
    "author_association": "CONTRIBUTOR",
    ...

@simondanielsson simondanielsson changed the title Pretty-print JSONL text responses in mcpcurl feat: pretty-print JSONL text responses in mcpcurl Apr 12, 2025
Copy link
Collaborator

@juruen juruen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simondanielsson thank you so much for your contributions! It's great to see them coming.

This looks great. I just have one stylistic suggestion to have an early continue. But otherwise, this is awesome to see!

@simondanielsson
Copy link
Contributor Author

Thanks @juruen, great suggestion :)

@simondanielsson simondanielsson requested a review from juruen April 12, 2025 12:25
Copy link
Collaborator

@juruen juruen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you so much! 🚀

@juruen juruen merged commit bbba3bb into github:main Apr 12, 2025
9 checks passed
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.

Pretty-print JSONL with mcpcurl
3 participants