MCP server project (TypeScript) · Chapter 4 of 12

Resources

By the end of this chapter your server offers data as well as actions: any day's programme at parda://programme/{day}, Parda's eight help pages at parda://help and parda://help/{page}, and the member's own bookings at parda://me/bookings. The assistant's app reads them, a name that is not there gets a clear error, and no name can reach a file outside the help folder. Build it in your browser: a real editor and terminal, AI that explains, and tests that tell you when it works.

  • Part: What the server offers
  • 3 tasks
  • TypeScript
  • In the all labs plan

The first 2 chapters of MCP server project (TypeScript) are free. This one comes with the all labs plan.

Why you need this

In October Datta's support team took 37 calls about things an assistant had said wrongly about Parda itself. One told a member she could walk into Ek Hota Gaon at Rangdeep Studio Theatre twenty minutes late; the help page says latecomers to a play wait for the interval. One quoted last year's booking fee; the page has said ₹20 a seat since 1 October. One put Pune 52's 9:30 pm show at Nilambari Cinema; it is at Kala Talkies. Each of the 4 integrations kept its own copy of the programme and the help text, pasted into its prompt, and nobody updated them.

Sayali wants one copy, read live: the programme from the API, the help pages from the files Datta's team edits.

Your server cannot offer that yet. It has five tools, and a tool is an action the model decides to call in the middle of a conversation. A help page is not an action. Neha's app may want to put Saturday's programme in front of the model before it says a word, or show it to Neha herself. MCP has a second kind of thing a server offers for exactly that: a resource.

What you build: 3 tasks

Each task has tests. You write the code in the lab's editor and press Check.

  1. Task 1

    resources.ts: the programme

    Write programmeMarkdown(day, memberId) in src/mcp/resources.ts and register the template parda://programme/{day} in addResources (name programme, title "A day's programme", mimeType text/markdown) returning it. A day that is not YYYY-MM-DD, or not a real date, throws McpError(ErrorCode.InvalidParams, "No programme for <day>: a day looks like 2026-11-07"). The Markdown is "# Parda programme for <Sat 7 Nov>", then, for each venue by name, an empty line, "## <venue> (<area>)", an empty line and "- <time>: <title> (<language>), <prices> (showtime <id>)" per showtime; a day with none is the heading, an empty line and "No showtimes on this day."; every line ends with a newline.

    The Check lists the resource templates through an MCP client, reads Saturday's programme and compares it with the showtimes in the database, reads a Monday with no showtimes, and reads parda://programme/7-nov and 2026-02-31 (error -32602).

  2. Task 2

    resources.ts: the help pages

    Register parda://help (name help, title Help pages, text/markdown) and parda://help/{page} (name help_page, title A help page, text/markdown) in addResources. The first is "# Parda help", an empty line, and "- <title>: parda://help/<page>" per page of helpPages(), each line ended by a newline. The second is the page's file text; a page that does not match PAGE, or is not one of helpPages(), throws McpError -32602 "No help page <page>. parda://help lists them."

    The Check lists the resources through an MCP client, reads the index and every page it lists, and reads a page that does not exist and names with dots, slashes and capitals.

  3. Task 3 · interview question

    Interview: resources.ts, the member's bookings

    Register parda://me/bookings (name my_bookings, title My bookings, mimeType application/json) in addResources: the bookings of listMyBookings({}, currentMember(extra)), as JSON.stringify(bookings, null, 2).

    The Check books E1 and E2 of showtime 18 as Neha, then reads parda://me/bookings as Neha (booking 2) and as Pranav (booking 1, his alone).

    Nikhil will ask: list_my_bookings is a tool and parda://me/bookings is a resource, with the same data. Who asks for each one, and why have both?

What you will learn

  • Tools, resources and who decides: the model calls a tool; the app reads a resource.
  • resources/list, resources/templates/list and resources/read on the wire, and what a reply's contents hold.
  • registerResource, a fixed URI, and a ResourceTemplate ({day} in braces) for a family of resources.
  • Mime types: text/markdown, application/json, and what they tell the app.
  • McpError with ErrorCode.InvalidParams: error -32602 with your sentence, instead of whatever a crash says.
  • A template value is input: why it is checked before it becomes a file path.

More in What the server offers

Build "Resources" yourself

Parda wants AI assistants like Claude Desktop to book seats for its members, safely. You build the MCP server that lets them, and only as the member who allowed it. A real editor and terminal in your browser, AI that explains, and a Check that says when it works.

The first 2 chapters of MCP server project (TypeScript) are free. This one comes with the all labs plan.