Skip to content

Commit d64e468

Browse files
authored
Merge pull request #2 from syncable-dev/feature/pub-creates
feat: add replease plz path
2 parents c08489b + 1fa2825 commit d64e468

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import json
2+
from pprint import pprint
3+
4+
def render_utility_result(result):
5+
"""
6+
Parses and prints the formatted result from a tool.
7+
It can handle both raw formatted strings (with ANSI codes) and
8+
JSON-encoded strings containing a formatted report.
9+
"""
10+
if not result or not hasattr(result, 'content') or getattr(result, 'isError', False):
11+
print("Invalid or error result.")
12+
pprint(result)
13+
return
14+
15+
try:
16+
# The result is a single TextContent object
17+
text_content = result.content[0].text
18+
try:
19+
# First, try to load as JSON. This handles tool outputs that
20+
# are JSON-encoded strings (e.g., a report string inside a JSON string).
21+
report_string = json.loads(text_content)
22+
print(report_string)
23+
except json.JSONDecodeError:
24+
# If JSON decoding fails, assume it's a raw, pre-formatted string
25+
# (like the output from the 'about_info' tool with ANSI codes).
26+
print(text_content)
27+
except (IndexError, AttributeError) as e:
28+
print(f"Error parsing result: {e}")
29+
print("Printing raw result instead:")
30+
pprint(result)

release-plz.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[workspace]
2+
packages = ["mcp-rust-server"]
3+
4+
[release-plz]
5+
manifest_path = "mcp-rust-server/Cargo.toml"

0 commit comments

Comments
 (0)