Back to course

Daily Repetition 4: The 'Fetch URL' Tool

Model Context Protocol (MCP) Server Engineering

Daily Repetition: Tool #4

Let's give the AI internet access (via your server).

Implementation

Use the fetch API to retrieve the HTML or JSON from a URL.

typescript const response = await fetch(url); const text = await response.text(); return { content: [{ type: "text", text }] };

Assignment: Ask the LLM to summarize the content of a public website using your new tool.