-
Notifications
You must be signed in to change notification settings - Fork 1
feat: standardize README structure and add auto-sync workflow #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Restructure README to match mcp-opinion template with badges, usage examples, and cleaner organization - Add sync-tools.yml workflow to auto-generate tool documentation - Add generate-tools.mjs action that handles array-based tool exports - Add zod-to-json-schema devDependency for tool schema conversion - Include AUTO-GENERATED TOOLS markers for automated documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @Royal-lobster, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the project's documentation and maintenance workflow. It standardizes the README.md structure for better clarity and introduces an automated process to generate and keep the MCP tool documentation up-to-date. This automation ensures that the documentation accurately reflects the available tools and their parameters, reducing manual effort and potential discrepancies. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request significantly improves the project's documentation and maintainability by restructuring the README to a standard format and introducing a script to automatically generate tool documentation from the source code. The new README is much clearer and more comprehensive for users.
I've left a few comments with suggestions for improvement:
- In
.github/actions/generate-mcp-tools/generate-tools.mjs, I've suggested a couple of changes to improve cross-platform robustness and simplify error handling. - In
README.md, I've pointed out a discrepancy between the content in the auto-generated tools section and the output of the new generation script. It would be best to run the script and commit its output to ensure consistency.
Additionally, the pull request description mentions a sync-tools.yml workflow, but this file doesn't seem to be included in the changes. Could you please clarify if this will be added in this PR or a future one?
| <!-- AUTO-GENERATED TOOLS START --> | ||
|
|
||
| ### Protocol & TVL Data | ||
| * **`defillama_get_chains`**: Fetch blockchain chains ranked by Total Value Locked (TVL). | ||
| * **`defillama_get_protocol_data`**: Fetch TVL data for DeFi protocols with auto-resolution of protocol names. | ||
| * **`defillama_get_historical_chain_tvl`**: Fetch historical TVL data for blockchain chains over time. | ||
|
|
||
| ### DEX Data | ||
| * **`defillama_get_dexs_data`**: Fetch DEX trading volume data and metrics. | ||
|
|
||
| ### Fees & Revenue | ||
| * **`defillama_get_fees_and_revenue`**: Fetch fees and revenue metrics for DeFi protocols. | ||
|
|
||
| ### Stablecoins | ||
| * **`defillama_get_stablecoin`**: Fetch stablecoin data including circulation and price information. | ||
| * **`defillama_get_stablecoin_chains`**: Fetch stablecoin data by chains. | ||
| * **`defillama_get_stablecoin_charts`**: Fetch historical market cap charts for stablecoins. | ||
| * **`defillama_get_stablecoin_prices`**: Fetch historical stablecoin price data. | ||
|
|
||
| ### Token Prices | ||
| * **`defillama_get_prices_current_coins`**: Fetch current token prices. | ||
| * **`defillama_get_prices_first_coins`**: Fetch first recorded historical prices for tokens. | ||
| * **`defillama_get_batch_historical`**: Fetch historical price data for multiple cryptocurrencies at specific timestamps. | ||
| * **`defillama_get_historical_prices_by_contract`**: Fetch historical prices for tokens at specific timestamps. | ||
| * **`defillama_get_percentage_coins`**: Fetch percentage price change for tokens over time. | ||
| * **`defillama_get_chart_coins`**: Fetch historical price chart data for tokens. | ||
|
|
||
| ### Yield Farming | ||
| * **`defillama_get_latest_pool_data`**: Fetch current yield farming pool data including APY rates and TVL. | ||
| * **`defillama_get_historical_pool_data`**: Fetch historical APY and TVL data for a specific pool. | ||
|
|
||
| ### Options | ||
| * **`defillama_get_options_data`**: Fetch options protocol data including trading volume and premium metrics. | ||
|
|
||
| ### Blockchain | ||
| * **`defillama_get_blockchain_timestamp`**: Fetch blockchain block information at a specific timestamp. | ||
|
|
||
| <!-- AUTO-GENERATED TOOLS END --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content within the AUTO-GENERATED TOOLS block seems to be manually created and doesn't match the format that the new generate-tools.mjs script will produce. The script generates ### headings for each tool along with a detailed parameter table, whereas the current content uses a simple bulleted list without parameters.
To ensure consistency and provide users with the full documentation, please run the generate-tools.mjs script and commit the output it generates for this section. This will also serve as a good validation that the script works as expected.
| const indexPath = path.join(TOOLS_DIR, "index.ts"); | ||
| if (fs.existsSync(indexPath)) { | ||
| try { | ||
| const mod = await import(indexPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better cross-platform compatibility (especially on Windows), it's recommended to use file URLs with dynamic import(). This ensures that file paths are correctly interpreted across different operating systems.
First, import pathToFileURL at the top of the file (line 3):
import { fileURLToPath, pathToFileURL } from "node:url";Then, update this line and the similar import on line 69 to use it. The import on line 69 should be changed to:
const mod = await import(pathToFileURL(path.join(TOOLS_DIR, file)).href);| const mod = await import(indexPath); | |
| const mod = await import(pathToFileURL(indexPath).href); |
| async function main() { | ||
| try { | ||
| const readme = fs.readFileSync(README_PATH, "utf8"); | ||
| const tools = await loadTools(); | ||
|
|
||
| if (tools.length === 0) { | ||
| console.warn("Warning: No tools found!"); | ||
| } | ||
|
|
||
| const updated = updateReadme({ readme, tools }); | ||
|
|
||
| fs.writeFileSync(README_PATH, updated); | ||
| console.log(`Synced ${tools.length} MCP tools to README.md`); | ||
| } catch (error) { | ||
| console.error("Error updating README:", error); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| main().catch((err) => { | ||
| console.error(err); | ||
| process.exit(1); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling can be simplified. The try...catch block inside main makes the .catch() on the main() call redundant. The process will exit inside main's catch block, and the promise will never reject, so the outer .catch() is unreachable.
It's cleaner to remove the try...catch from main and let the top-level .catch() handle any errors that occur during execution. This centralizes error handling and makes the code easier to follow.
async function main() {
try {
const readme = fs.readFileSync(README_PATH, "utf8");
const tools = await loadTools();
if (tools.length === 0) {
console.warn("Warning: No tools found!");
}
const updated = updateReadme({ readme, tools });
fs.writeFileSync(README_PATH, updated);
console.log(`Synced ${tools.length} MCP tools to README.md`);
} catch (error) {
console.error("Error updating README:", error);
process.exit(1);
}
}
main().catch((err) => {
console.error("Error updating README:", err);
process.exit(1);
});
Summary
Test plan
🤖 Generated with Claude Code