MulaiMulai sekarang secara gratis

Building a Currency Converter MCP Server

Time to begin building your first MCP server! Here, you'll define an MCP server called 'Currency Converter' that consists of a single tool called convert_currency() to convert monetary values between different currencies.

This tool should take amount, from_currency, and to_currency parameters, and return a string containing the amount converted into the desired currency, along with the exchange rate used.

For example, 100 EUR = 88.04 GBP (Rate: 0.8804).

Latihan ini adalah bagian dari kursus

Introduction to Model Context Protocol (MCP)

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Create an MCP server instance
mcp = ____("____")
Edit dan Jalankan Kode