🛠️ MCP Tools Dev – Build Your Own Tools Like a Pro!

May 19, 2025 (3d ago)
👁️ ... views

🧰 MCP Tools Dev – Build Your Own Tools Like a Pro! 💻🌐

MCP Server එක කියන්නෙ simple program එකක් 😎. ඒක ඔයාගේ AI model එකට 🌐 real-world access එකක් දෙන්න bridge එකක් වගේ act වෙනවා.

මෙහෙම හිතන්න: AI එකකට පොඩි assistant එකක් වගේ, එයා කියන instructions MCP Server එකෙන් tools වලට pass වෙනවා 🔁, result එක AI එකට එනවා back 🧠✨.


🔍 MCP Tool කියන්නෙ මොකක්ද?

Tool එකක් කියන්නෙ MCP Server එකට connect කරපු external function එකක් 🧰. AI model එක tool එක trigger කරලා outside API/endpoint එකක් call කරලා data ගෙනෙන්න පුළුවන්.


📦 Basic Tool Structure එක

MCP Server එකට tools add කරන විදිහ:

🧱 tools.json file එකක් තියෙන්න ඕනෙ. එකේ structure එක:


😂 Example Tool – Joke Generator

අපි joke කියන්න tool එකක් create කරමු.

🛠️ Tool Config:

- name: joke_maker  
- description: Get a random joke 🃏  
- url: https://official-joke-api.appspot.com/random_joke  
- method: GET

මෙතැනදී AI කියනවා: "Tell me a joke!"
➡️ MCP Server එක API එකට request එක යවනවා
➡️ Joke එක response එකෙන් model එකට එනවා


🗂️ Example tools.json Format

[
  {
    "name": "joke_maker",
    "description": "Get a random joke 🃏",
    "url": "https://official-joke-api.appspot.com/random_joke",
    "method": "GET"
  }
]

🛠️ Run MCP with:

mcp-server --tools ./tools.json


☁️ Dynamic Tools with Input Schema

Example: Weather tool එකක් create කරන්න

Tool Config:

- name: weather_tool  
- description: Get weather info for a city ☁️  
- url: https://api.weather.com/v1/{city}  
- method: GET  
- input_schema:  
  - type: object  
  - properties:  
    - city: { type: "string", description: "City name" }

Model එකට කියන්න පුළුවන්:
🗣️ "Check the weather in Colombo"
➡️ MCP replace කරයි {city} with "Colombo"
➡️ Result AI එකට!


💡 Tool Use Case Ideas

💼 Use Case 🛠️ Tool Idea
🌦️ Weather Bot Live city-based weather tool
📅 Calendar Agent Add meetings using Google Calendar API
🔍 Search Engine Instant web search
📄 PDF Reader Summarize uploaded PDFs
🤖 Discord Bot Trigger Discord bot replies

🧠 MCP Tool Best Practices


🚀 Summary

MCP Tools කියන්නෙ ඔයාගේ AI project එකට හෙවි power එකක්. ඔයාම tool එකක් build කරලා API එකක් call කරන්න පුළුවන්. මොකද MCP server එක ඒවට gateway එකක් වගේ වැඩ කරනවා 🔗.

🧠 MCP + Tools = Limitless Possibilities 🔓


📌 Next Blog Idea: "🌐 Connecting MCP Server to Local Scripts – Offline Power! 💻🔗"