Tools 2

Day 1 - Block 5

Chapter Shift: User -> Builder 1

We know how to use use tools …

… but how do we build them?

SKILL.md 1


<!-- Too verbose — the agent already knows what PDFs are -->
## Extract PDF text

PDF (Portable Document Format) files are a common file format that contains
text, images, and other content. To extract text from a PDF, you'll need to
use a library. pdfplumber is recommended because it handles most cases well.

<!-- Better — jumps straight to what the agent wouldn't know on its own -->
## Extract PDF text

Use pdfplumber for text extraction. For scanned documents, fall back to
pdf2image with pytesseract.

import pdfplumber

with pdfplumber.open("file.pdf") as pdf:
    text = pdf.pages[0].extract_text()

SKILL.md is high level; Precision: Use scripts!

Scripts Inside Skills 1

# Agent-friendly script usage
python scripts/tool.py --help
python scripts/tool.py --input data.csv --format json
  • Scripts should be standalone (agents love CLIs)
  • Naming matters!
  • warnings, errors, info messages become context …

Use an AI agent to create skills: skill-creator

Build your own MCP server 1

weather.py


from mcp.server.fastmcp import FastMCP

# Initialize FastMCP server
mcp = FastMCP("weather")

def call_weather_api(city: str, date: str) -> dict[str, Any] | None:
    """Make a request to the Weather API"""
    headers = {"City": city, "Date": date}
    response = client.get(
      api_key=WEATHER_API_KEY,
      headers=headers,
      timeout=30.0)
      
      return response.json()

@mcp.tool()
async def get_weather(city: str, date: str) -> str:
    """Get weather information for a city.

    Args:
        city: Name of the city
        date: Date for which to get weather information; options are "today", "tomorrow", or "YYYY-MM-DD"
    """
    try:
      data = call_weather_api(city, date)
    except Exception as e:
      return f"Error fetching weather data: {str(e)}"
    
    return "\n---\n".join(data)

Run your server in a terminal:

...

def main():
    # Initialize and run the server
    mcp.run(transport="stdio")


if __name__ == "__main__":
    main()

Wire MCP to an Agent

In the settings of your agent (e.g. MCP servers, …) add

{
  "mcpServers": {
    "weather": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather",
        "run",
        "weather.py"
      ]
    }
  }
}

References

Agent Skills. 2026a. “Best Practices for Skill Creators.” https://agentskills.io/skill-creation/best-practices.
———. 2026b. “Evaluating Skill Output Quality.” https://agentskills.io/skill-creation/evaluating-skills.
———. 2026c. “Using Scripts in Skills.” https://agentskills.io/skill-creation/using-scripts.
Willison, Simon. 2025. “Agentic Engineering Patterns.” https://simonwillison.net/guides/agentic-engineering-patterns/.
Yao, Shunyu, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. 2022. “ReAct: Synergizing Reasoning and Acting in Language Models.” arXiv Preprint arXiv:2210.03629. https://arxiv.org/abs/2210.03629.