Back to course

Daily Repetition 2: The 'File Writer' Tool

Model Context Protocol (MCP) Server Engineering

Daily Repetition: Tool #2

Now, let's give the AI the power to create!

Implementation

Create a tool write_file that accepts a path and content.

Security Warning: In a real app, you should restrict where the AI can write files. For now, limit it to a ./sandbox/ directory.

Assignment: Build the tool and ask the AI to "Write a hello.md file in the sandbox folder with a short poem."