MCPcopy
hub / github.com/Aider-AI/aider / _tool_message

Method _tool_message

aider/io.py:966–986  ·  view source on GitHub ↗
(self, message="", strip=True, color=None)

Source from the content-addressed store, hash-verified

964 return res
965
966 def _tool_message(self, message="", strip=True, color=None):
967 if message.strip():
968 if "\n" in message:
969 for line in message.splitlines():
970 self.append_chat_history(line, linebreak=True, blockquote=True, strip=strip)
971 else:
972 hist = message.strip() if strip else message
973 self.append_chat_history(hist, linebreak=True, blockquote=True)
974
975 if not isinstance(message, Text):
976 message = Text(message)
977 color = ensure_hash_prefix(color) if color else None
978 style = dict(style=color) if self.pretty and color else dict()
979 try:
980 self.console.print(message, **style)
981 except UnicodeEncodeError:
982 # Fallback to ASCII-safe output
983 if isinstance(message, Text):
984 message = message.plain
985 message = str(message).encode("ascii", errors="replace").decode("ascii")
986 self.console.print(message, **style)
987
988 def tool_error(self, message="", strip=True):
989 self.num_error_outputs += 1

Callers 3

tool_errorMethod · 0.95
tool_warningMethod · 0.95

Calls 3

append_chat_historyMethod · 0.95
ensure_hash_prefixFunction · 0.85
printMethod · 0.45

Tested by 1