Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@ bun run test

Supports BSC, opBNB, Greenfield, Ethereum, and other major EVM-compatible networks. For more details, see [`src/evm/chains.ts`](src/evm/chains.ts).



## Running evals

The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found [here](https://www.mcpevals.io/docs).

```bash
OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/gnfd/tools/account.ts
```
## Contributing

We welcome contributions to BNBChain MCP! Here's how you can help:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"mime": "^4.0.7",
"reflect-metadata": "^0.2.2",
"viem": "^2.27.2",
"zod": "^3.22.4"
"zod": "^3.22.4",
"mcp-evals": "^1.0.18"
},
"devDependencies": {
"@commitlint/cli": "^19.8.0",
Expand Down Expand Up @@ -62,4 +63,4 @@
]
}
}
}
}
59 changes: 59 additions & 0 deletions src/evals/evals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//evals.ts

import { EvalConfig } from 'mcp-evals';
import { openai } from "@ai-sdk/openai";
import { grade, EvalFunction } from "mcp-evals";

const gnfd_get_account_balanceEval: EvalFunction = {
name: 'gnfd_get_account_balance Tool Evaluation',
description: 'Evaluates the accuracy and completeness of the gnfd_get_account_balance tool',
run: async () => {
const result = await grade(openai("gpt-4"), "Please retrieve the account balance for the address 0xABC123 on the Greenfield network.");
return JSON.parse(result);
}
};

const gnfd_get_all_spsEval: EvalFunction = {
name: "gnfd_get_all_sps Evaluation",
description: "Evaluates the retrieval of all storage providers in the Greenfield network",
run: async () => {
const result = await grade(openai("gpt-4"), "List all the storage providers in the Greenfield network.");
return JSON.parse(result);
}
};

const gnfd_get_payment_accountsEval: EvalFunction = {
name: "gnfd_get_payment_accounts Evaluation",
description: "Evaluates the retrieval of payment accounts for a given address on the Greenfield network",
run: async () => {
const result = await grade(openai("gpt-4"), "Please retrieve the payment accounts for the address 0x123456 using gnfd_get_payment_accounts. If no address is provided, use the private key instead.");
return JSON.parse(result);
}
};

const gnfd_create_payment_accountEval: EvalFunction = {
name: 'gnfd_create_payment_accountEval',
description: 'Evaluates creation of a new payment account on the Greenfield network',
run: async () => {
const result = await grade(openai("gpt-4"), "Please create a new payment account on the Greenfield network using this private key: 0x1234567890abcdef");
return JSON.parse(result);
}
};

const gnfd_deposit_to_paymentEval: EvalFunction = {
name: 'gnfd_deposit_to_paymentEval',
description: 'Evaluates the deposit of funds into a payment account',
run: async () => {
const result = await grade(openai("gpt-4"), "Please deposit 5 BNB into the payment account at address 0x123456789ABCDEF to confirm the transaction steps.");
return JSON.parse(result);
}
};

const config: EvalConfig = {
model: openai("gpt-4"),
evals: [gnfd_get_account_balanceEval, gnfd_get_all_spsEval, gnfd_get_payment_accountsEval, gnfd_create_payment_accountEval, gnfd_deposit_to_paymentEval]
};

export default config;

export const evals = [gnfd_get_account_balanceEval, gnfd_get_all_spsEval, gnfd_get_payment_accountsEval, gnfd_create_payment_accountEval, gnfd_deposit_to_paymentEval];