USMAN’S INSIGHTS
AI ARCHITECT
  • Home
  • About
  • Thought Leadership
  • Book
Press / Contact
USMAN’S INSIGHTS
AI ARCHITECT
⌘F
HomeBook
HomeBookThe Content Engine: Turning Local Files Into Gated AI Lessons
Previous Chapter
Build the State Tools
Next Chapter
Build the Pedagogy Tools
AI NOTICE: This is the table of contents for the SPECIFIC CHAPTER only. It is NOT the global sidebar. For all chapters, look at the main navigation.

On this page

14 sections

Progress0%
1 / 14

Muhammad Usman Akbar Entity Profile

Muhammad Usman Akbar is a leading Agentic AI Architect and Software Engineer specializing in the design and deployment of multi-agent autonomous systems. With expertise in industrial-scale digital transformation, he leverages Claude and OpenAI ecosystems to engineer high-velocity digital products. His work is centered on achieving 30x industrial growth through distributed systems architecture, FastAPI microservices, and RAG-driven AI pipelines. Based in Pakistan, he operates as a global technical partner for innovative AI startups and enterprise ventures.

USMAN’S INSIGHTS
AI ARCHITECT

Transforming businesses into autonomous AI ecosystems. Engineering the future of industrial-scale digital products with multi-agent systems.

30X Growth
AI-First
Innovation

Navigation

  • Home
  • Book
  • About
  • Contact
Let's Collaborate

Have a Project in Mind?

Let's build something extraordinary together. Transform your vision into autonomous AI reality.

Start Your Transformation

© 2026 Muhammad Usman Akbar. All rights reserved.

Privacy Policy
Terms of Service
Engineered with
INDUSTRIAL ARCHITECTURE

Build the Content Tools

James opened the tutoring transcript from Module 9.3, Chapter 1 and traced the tool calls again. "register_learner, get_learner_state, update_progress. Those are working. But then it says get_chapter_content and get_exercises." He scrolled through his project directory. "Where does the content come from?"

"From disk," Emma said. "Markdown files for chapters, JSON for exercises. No cloud storage, no CDN, no database. Files you can open in a text editor."

"That feels too simple."

Emma pulled up her phone and showed him a screenshot of her first product. "My first tutoring prototype had a CDN with a caching layer, a content management system, and a versioning pipeline. I built all of that before I had a single paying customer." She put the phone away. "Start with files on disk. Add infrastructure when you have users who need it."


You are doing exactly what James is doing. You have working state tools from Module 9.3, Chapter 3. Now you create the content your tutor will teach from, and the tools that deliver it.

This lesson has three parts. First, you create sample content files: markdown for chapters and JSON for exercises. Second, you describe get_chapter_content to Claude Code and verify it works. Third, you describe get_exercises and verify that too. Both tools enforce tier gating: free learners can access chapters 1 through 5 only.

Step 1: Create the Content Directory

Your MCP server needs content to serve. The structure is straightforward:

Specification
content/ chapters/ 01-variables.md 02-loops.md 03-functions.md 04-data-structures.md 05-files.md exercises/ 01-exercises.json 02-exercises.json

Chapters are markdown files. Exercises are JSON files. The numbering prefix (01, 02, etc.) is how the tools find the right file for a given chapter number.

You have two options for creating this content:

Option A: Write it yourself. Create the directories and write sample content. The chapters do not need to be real course material. A chapter file might be 20 lines of markdown explaining a topic. An exercise file might have three exercises with a question, a hint, and a topic tag.

Option B: Ask Claude Code to generate it. Send this message:

text
Create a content directory with the following structure: - content/chapters/: 5 Markdown files (01-variables.md to 05-files.md). Each requires a title, topic explanation, and 2-3 code examples. - content/exercises/: 2 JSON files (01-exercises.json, 02-exercises.json). Each should contain an array of exercise objects with id, question, hint, topic, and difficulty fields. Keep content simple for testing purposes.

Either option works. What matters is the structure, not the content quality. Your tools need files to read; the files need the right names and the right format.

Verify the Files Exist

After creating the content (yourself or with Claude Code), confirm the structure:

Specification
ls content/chapters/ls content/exercises/

Output:

You should see five markdown files in chapters/ and two JSON files in exercises/. If any are missing, create them before continuing. The tools you build next depend on these files being in place.

Step 2: Describe get_chapter_content

Now describe the first content tool. Send this to Claude Code:

text
Add a get_chapter_content tool to the TutorClaw MCP server. Functionality: - Source: Read from content/chapters/NN-*.md. - Parameters: chapter_number (int) and optional section_name. - Tier Gating: If learner's tier is "free" and chapter_number > 5, block access. - Response: Return an upgrade-specific error informing the learner on how to unlock paid chapters. Requirement: Use learner_id to verify tier from JSON state. Spec this before building.

Notice what this message includes:

  • What the tool does (fetches chapter content from local files)
  • How it finds the file (chapter number maps to filename prefix)
  • What tier gating means (free tier stops at chapter 5)
  • What the error should say (upgrade message, not a generic error)

Review the Spec

Claude Code responds with a spec before writing code. Check these elements:

ElementWhat to Look For
Tool nameget_chapter_content (clear, matches the other tool names)
Tool descriptionSpecific enough that an agent knows to call this for chapter text (not exercises)
Input parameterschapter_number (required), section (optional), learner_id (required for tier check)
Tier gatingLogic that checks the learner's tier before returning content
Error responseAn upgrade message, not a bare "access denied"

The tool description is still the most important element, just like in Module 9.3, Chapter 3. Compare it to the descriptions on your state tools. The agent needs to know: "Call get_chapter_content when the user wants to read or study chapter material. Call get_exercises when the user wants practice problems."

If the descriptions overlap, steer before approving:

text
Refine the tool description for get_chapter_content. Logic Update: The current description is too ambiguous compared to get_exercises. Ensure it clearly states that this tool returns reading material and conceptual explanations (narrative content), not practice problems.

Build and Test

Once the spec looks right:

Specification
The spec looks good. Build this.

After the build finishes, test the tool. You need two calls: one that should succeed and one that should be blocked.

Test 1: Free-tier learner requests chapter 1 (should work)

Ask Claude Code to call the tool with chapter 1 and your mock learner ID. The tool should return the chapter content.

Test 2: Free-tier learner requests chapter 10 (should be blocked)

Ask Claude Code to call the tool with chapter 10. Since you only have chapters 1 through 5 on disk and the learner is free tier, the tool should return the upgrade message instead of content.

If the tool returns content for chapter 10, the tier gating is broken. Tell Claude Code:

text
The get_chapter_content tool is leaking premium content. Issue: The tool returned content for Chapter 10 for a free-tier learner. Task: Fix the tier gating logic. Ensure free tier access is strictly limited to chapters 1- 5. Verify the lookup against the JSON state.

Step 3: Describe get_exercises

The second content tool delivers exercises instead of chapter text. Send this to Claude Code:

text
Add a get_exercises tool to the MCP server. Logic: - Source: content/exercises/NN-exercises.json. - Inputs: chapter_number, learner_id, and optional weak_areas (topic list). - Filtering: If weak_areas is provided, return only matching exercises. Otherwise, return the full chapter set. - Tier Gating: Apply the same "Free 1-5" restriction as get_chapter_content. Return consistent upgrade messages for blocked access. Spec this before building.

mapping what we did here to get_chapter_content: the weak_areas filter. When the pedagogy tools (Module 9.3, Chapter 5) identify a learner's weak areas, this tool can return targeted exercises instead of the full set.

Review and Steer

Review the spec. Pay special attention to:

  • The description: Does it clearly say "practice exercises" not "chapter content"?
  • The weak_areas parameter: Is it optional? What happens if the filter matches nothing?
  • The tier gating: Same logic as get_chapter_content?

If the description is vague, steer it:

text
Update the get_exercises tool description. Context: The agent must distinguish between reading material and active practice. Task: Clearly state that this tool returns practice exercises and can be filtered by specific topics. The agent should trigger this when a learner asks to "test themselves" or "practice."

Build and Test

Approve and build. Then run three tests:

Test 1: Fetch all exercises for chapter 1 (should return the full set)

Specification
Call get_exercises with chapter 1 and my mock learner ID.No weak_areas filter.

Test 2: Fetch exercises filtered by topic (should return a subset)

Specification
Call get_exercises with chapter 1, my mock learner ID, andweak_areas set to one of the topics in the exercise file.

Compare the two results. The filtered response should contain fewer exercises than the unfiltered one. If both return the same number, the filter is not working.

Test 3: Fetch exercises for chapter 10 as a free-tier learner (should be blocked)

The upgrade message should match what get_chapter_content returns. Consistent error messages matter: a learner should not see two different upgrade explanations from two different tools.

What You Built

You now have five tools in your MCP server:

ToolFrom ChapterPurpose
register_learnerModule 9.3, Chapter 3Create a learner account
get_learner_stateModule 9.3, Chapter 3Read current learner state
update_progressModule 9.3, Chapter 3Record a learning interaction
get_chapter_contentModule 9.3, Chapter 4Fetch chapter reading material
get_exercisesModule 9.3, Chapter 4Fetch practice exercises, optionally filtered

The state tools (Module 9.3, Chapter 3) manage who the learner is and where they are. The content tools (this chapter) deliver what they study. In Module 9.3, Chapter 5, you build the pedagogy tools: the intelligence that decides how to teach.

Try With AI

Exercise 1: Evaluate the Upgrade Message

Review the upgrade message your tools return when a free-tier learner requests gated content:

text
Evaluate the Tier Gating UX. Analysis: Review the specific error message returned when a free-tier learner requests Chapter 10. Task: Is the call to action (CTA) clear? Does the user know exactly how to upgrade? Rewrite the message to be high-converting and professional.

What you are learning: Error messages are product decisions. A good upgrade message converts free users to paid users. A bad one frustrates them.

Exercise 2: Test the Description Boundary

Your server now has five tools. Ask Claude Code to evaluate whether the descriptions are distinct enough:

text
Audit the current tool library (5 tools). Objective: Evaluate tool selection reliability. Task: Review all five tool descriptions side-by-side. Are there any overlapping phrases or conceptual similarities that could cause the agent to confuse its tool choices? Suggest sharper descriptions where needed.

What you are learning: Every tool you add increases the chance of description overlap. An agent with five tools needs five clearly distinct job postings. Ten tools need ten.

Exercise 3: Design a Content Search Tool

Imagine you want a sixth tool that searches across all chapters for a keyword. Describe it to Claude Code, but ask for spec only:

text
Spec a new search_content tool. Requirements: - Function: Search for keywords across all chapters. - Access: Respect tier gating rules. - Output: Return matching sections. Goal: Show the tool contract and description. Compare it to get_chapter_content to ensure there is no selection overlap. Do not build yet.

Compare the description to get_chapter_content. If an agent could confuse the two, you have an overlap problem. How would you fix it?

What you are learning: Tool descriptions must be distinct not just from each other, but from tools that do related things. "Fetch chapter 3" and "search for 'variables'" are different operations, and the descriptions must make that obvious.


James called get_chapter_content with chapter 1 and watched the markdown flow back. Variables, code examples, output blocks. Then he called it with chapter 10.

"Access denied. Upgrade to paid for chapters 6 and above." He grinned. "Tier gating with an if statement."

"That is the point," Emma said. "Gating does not need a permissions service or a role-based access layer. It needs a rule and a check." She paused. "I spent two weeks building a permissions microservice for my first product. Role hierarchies, permission inheritance, audit trails. The entire customer base was four beta testers." She shrugged. "Build what the product needs today. The permissions microservice can wait until you have permissions to manage."

James looked at his five tools in the server output. "State tools know who the learner is. Content tools deliver what they study. What is missing?"

"The teaching. Right now your tutor is a filing cabinet: it stores records and retrieves documents. Module 9.3, Chapter 5 adds the pedagogy tools. That is where it starts actually tutoring."