fix: show custom error for modal state (#240)
Calling a tool that resolves modal state, when there's no such modal state visible, currently shows this misleading message: ```md Tool "browser_file_upload" does not handle the modal state. ### Modal state ``` Instead, we should show the error message from the tool implementation.
This commit is contained in:
@@ -58,6 +58,8 @@ export class Context {
|
||||
|
||||
modalStatesMarkdown(): string[] {
|
||||
const result: string[] = ['### Modal state'];
|
||||
if (this._modalStates.length === 0)
|
||||
result.push('- There is no modal state present');
|
||||
for (const state of this._modalStates) {
|
||||
const tool = this.tools.find(tool => tool.clearsModalState === state.type);
|
||||
result.push(`- [${state.description}]: can be handled by the "${tool?.schema.name}" tool`);
|
||||
|
||||
Reference in New Issue
Block a user