Skip to content

Conversation

@Royal-lobster
Copy link
Member

Summary

  • Restructure README to match mcp-opinion template with npm badges, usage examples, and cleaner organization
  • Add sync-tools.yml workflow to auto-generate tool documentation on push to main
  • Add generate-tools.mjs action that handles array-based tool exports (compatible with defillama-mcp structure)
  • Add zod-to-json-schema devDependency for tool schema conversion

Test plan

  • Verify README displays correctly on GitHub
  • Verify npm badges link correctly
  • Verify sync-tools workflow triggers on push to main
  • Verify generate-tools.mjs correctly parses tools from index.ts

🤖 Generated with Claude Code

- 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>
@Royal-lobster Royal-lobster merged commit e5b2771 into main Jan 27, 2026
1 check failed
@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • README Standardization: The README.md has been restructured to follow a consistent template, enhancing readability and information organization with new sections for overview, features, installation, usage examples, and configuration.
  • Automated Tool Documentation: A new GitHub Actions workflow and a Node.js script (generate-tools.mjs) have been introduced to automatically generate and update the MCP tool documentation within the README.md, replacing manual listings.
  • Flexible Tool Loading: The new generation script supports loading MCP tools from either array exports in index.ts or individual tool files, accommodating different project structures.
  • Zod Schema Integration: The tool documentation generation now includes conversion of Zod schemas to JSON Schema for accurate parameter rendering, enabled by the new 'zod-to-json-schema' dependency.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/sync-tools.yml
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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?

Comment on lines +133 to +170
<!-- 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 -->

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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);
Suggested change
const mod = await import(indexPath);
const mod = await import(pathToFileURL(indexPath).href);

Comment on lines +180 to +202
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);
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant