You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Improve error messages and enhance AskNebulaToolSchema description (#68)
- Updated AskNebulaToolSchema to provide a more detailed description for querying ERC20 token metrics, emphasizing the importance of including token decimals for accurate formatting.
Copy file name to clipboardExpand all lines: src/tools/thirdWeb.ts
+15-7Lines changed: 15 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,9 @@ const AskNebulaToolSchema = {
31
31
message: z
32
32
.string()
33
33
.min(20)
34
-
.describe("The blockchain-related question to ask ThirdWeb"),
34
+
.describe(
35
+
"The blockchain-related question to ask ThirdWeb. When querying ERC20 token metrics (supply, balance, etc.), always request token decimals information to ensure accurate number formatting. Example: Instead of 'What is the total supply?' use 'What is the total supply? Include token decimals and calculate the human-readable amount.'"
36
+
),
35
37
}),
36
38
execute: async(input: ThirdWebParams)=>{
37
39
try{
@@ -57,11 +59,15 @@ export class ThirdWebTool extends APITool<ThirdWebParams> {
57
59
});
58
60
59
61
if(!process.env.THIRDWEB_SECRET_KEY){
60
-
thrownewError("Please set the THIRDWEB_SECRET_KEY environment variable.");
62
+
thrownewError(
63
+
"Please set the THIRDWEB_SECRET_KEY environment variable."
64
+
);
61
65
}
62
66
63
67
if(!process.env.THIRDWEB_SESSION_ID){
64
-
thrownewError("Please set the THIRDWEB_SESSION_ID environment variable.");
68
+
thrownewError(
69
+
"Please set the THIRDWEB_SESSION_ID environment variable."
70
+
);
65
71
}
66
72
}
67
73
@@ -88,21 +94,23 @@ export class ThirdWebTool extends APITool<ThirdWebParams> {
88
94
"x-secret-key": secretKey,
89
95
"Content-Type": "application/json",
90
96
},
91
-
timeout: timeout
97
+
timeout: timeout,
92
98
}
93
99
);
94
100
returnresponse.data;
95
101
}catch(error){
96
102
if(axios.isAxiosError(error)){
97
-
if(error.code==='ECONNABORTED'){
98
-
thrownewError(`Request timed out after ${timeout/1000} seconds`);
103
+
if(error.code==="ECONNABORTED"){
104
+
thrownewError(`Request timed out after ${timeout/1000} seconds`);
0 commit comments