Skip to content

Commit 210d457

Browse files
committed
fix: improved inquire namespace prompts
1 parent 50dca8e commit 210d457

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

nerve/runtime/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def init(log_path: pathlib.Path | None = None, level: str = "INFO", litellm_debu
2424
logger.add(
2525
sys.stdout,
2626
colorize=True,
27-
format="{time} <level>{message}</level>",
27+
format="<level>[{time:MM-DD-YY HH:mm:ss}] {level}</level> {message}",
2828
level=level,
2929
)
3030

nerve/tools/mcp/client.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ async def _create_streams(
2828
async with stdio_client(server=self.server_params) as (read_stream, write_stream):
2929
try:
3030
yield read_stream, write_stream
31-
except GeneratorExit:
32-
pass
31+
except Exception as e:
32+
logger.debug("error yielding streams: {}", e)
3333
except Exception as e:
3434
# TODO: there's a weird bug, if we don't do this when the process exits
3535
# we will see an exception
36-
if "anext(): asynchronous generator is already running" in str(e):
37-
exit(0)
38-
else:
39-
raise e
36+
logger.debug("error creating streams: {}", e)
37+
exit(0)
4038

4139
async def connect(self) -> None:
4240
if self._session:

nerve/tools/namespaces/inquire.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def ask_question(
1717
Field(description="The question to ask the user.", examples=["What is your name?", "What is your age?"]),
1818
],
1919
) -> str:
20-
"""Ask a question to the user."""
20+
"""Use this tool to ask a question to the user."""
2121

2222
print()
2323
return str(inquirer.prompt([inquirer.Text("question", message=question)])["question"]).strip()
@@ -32,7 +32,7 @@ def ask_for_confirmation(
3232
],
3333
default: Annotated[bool, Field(description="The default answer to the question.", examples=[True, False])] = False,
3434
) -> str:
35-
"""Ask a confirmation question to the user."""
35+
"""Use this tool to ask a confirmation question to the user."""
3636

3737
print()
3838
return (
@@ -53,7 +53,7 @@ def ask_for_single_choice(
5353
Field(description="The choices to offer the user.", examples=["red", "blue", "green"]),
5454
],
5555
) -> str:
56-
"""Ask a single choice question to the user."""
56+
"""Use this tool to ask a single choice question to the user."""
5757

5858
print()
5959
return str(inquirer.prompt([inquirer.List("choice", message=question, choices=choices)])["choice"]).strip()
@@ -72,7 +72,7 @@ def ask_for_multiple_choice(
7272
Field(description="The choices to offer the user.", examples=["red", "blue", "green"]),
7373
],
7474
) -> str:
75-
"""Ask a multiple choice question to the user."""
75+
"""Use this tool to ask a multiple choice question to the user."""
7676

7777
print()
7878
return ", ".join(

0 commit comments

Comments
 (0)