Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Follow an MCP Tool Call

Your agent can read files, edit them, and run commands, including the festival’s tests. It can start the festival’s web server and fetch the page’s HTML. However, the search results only appear once a browser runs the page’s JavaScript, so an agent without a browser tool can’t see them. An MCP server is one way to add that tool. MCP, the Model Context Protocol, is an open standard for giving an agent tools it doesn’t have.

Key Points

  • A server offers tools. A browser server is a separate program from the festival’s web server. When your session starts, the agent program starts it and asks which tools it offers. Playwright’s browser server answered with 25 tools in December 2026 (@playwright/mcp 0.0.86, default tools), such as one to open a page and one to read what’s on it. Their names and descriptions join the agent’s own tools in the request the model receives with your task.
  • One tool call is a round trip:
  • The model asks for a tool to open the search page, with “fiddle” already searched.
  • The agent program checks your settings. With approval on, it shows you the call, and you approve it.
  • The agent program passes the call to the server, which opens the page in its own browser, with its own access. Your approval decides whether the call runs, not what the server can do.
  • The server sends back the page’s title as text. A second call, to the reading tool, makes the same trip and brings back the results.
  • That text goes into the context, next to your task. It tells the model what each result says, but not how it looks.
  • A server can reach whatever its access allows, whatever your task says. Your task named only the festival’s page, but when the model asked for https://example.com/, the same server opened it once the call was approved, and that page’s text came back the same way. So read the address on the approval card before you approve.
  • What comes back is untrusted text. A web page can carry instructions, and in the context they sit right next to yours.
  • There are two kinds of server. The agent starts a local process, such as the browser server, on your machine, so it has your access and can do whatever your account can do there. A remote server, such as an issue tracker’s server on a code host like GitHub, is reached over HTTP. GitHub’s server needs a token, a key that lets it act on your account. It turned away a request with no token, and with one it can do what that token allows.

The Calls From the Video

Here are the two calls. The server’s side is real. It ran in December 2026 with Playwright’s browser server (@playwright/mcp 0.0.86), against a small stand-in for the festival’s search page. The model’s request and your approval were drawn the way an agent would show them, and your agent’s calls will differ:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

00:00 Your changelog skill runs the festival’s tests before it writes a word. However, those tests don’t check the search page a visitor sees. Say your agent changes what a search result shows.

00:12 Its tools read files, edit them and run commands. It can start the festival’s web server and fetch the page’s HTML. But the results only appear once a browser runs the page’s JavaScript, and this agent has no browser tool yet.

00:28 An MCP server is one way to add one. MCP, the Model Context Protocol, is an open standard for giving an agent tools it doesn’t have. Here, you’ll follow one tool call there and back.

00:44 A browser server is a separate program from the festival’s web server. When your session starts, the agent program starts it and asks which tools it offers.

00:54 Playwright’s browser server answered with twenty-five tools. One opens a page, and another reads what’s on it. Those tools’ names and descriptions join the agent’s own in the request the model receives with your task.

01:08 The model can’t open anything itself. It asks for a tool, and the agent program carries the call out.

01:17 Here’s one round trip. The server’s side is real, run on a small stand-in for the festival’s page. The model’s request and your approval are drawn.

01:28 First, the model asks the opening tool for the search page, with fiddle already searched. Second, the agent program checks your settings. With approval on, it shows you the call, and you approve it.

01:43 Third, the agent program passes the call to the server. The server opens the page in its own browser, with its own access. Your approval decides whether the call runs, not what the server can do.

01:57 Fourth, the server sends back text with the page’s title. A second call, to the reading tool, makes the same trip and brings back the two results.

02:08 Last, that text goes into the context, next to your task. It tells the model what each result says, but not how it looks.

02:18 That browser server runs on your machine. Your task only mentions the festival’s page. Your turn: pause the video and predict. If the model asked for a different website, could the server open it?

02:38 Yes, once you approve it. When the model asked for example.com, the server opened it, and that page’s text came back the same way. Your task doesn’t limit a server.

02:50 Its access does. So read the address on the approval card before you approve. And someone else wrote that text. A web page can carry instructions. In the context, they sit right next to yours.

03:07 The browser server is one kind of server, a local process. The agent starts it on your machine, so its own access is yours, whatever your account can do there.

03:18 The other kind is remote. An issue tracker’s server can run on the code host, such as GitHub, where a project’s issues live. The agent talks to it over HTTP.

03:30 GitHub’s server needs a token, a key that lets it act on your account. It turned away a request with no token. With one, it can do what that token allows.

03:42 That round trip shows three things to weigh. The first is reach, what the server’s access lets it do. The second is text, the untrusted content it brings into the context.

03:56 The third is room in the context. Playwright’s twenty-five tool definitions came to about twenty-one thousand characters, about six times as long as everything this video says.

04:07 They take room your task and files would use. Some agents load them only when needed. So add a server when a task needs it, and give it no more access than that task does.

04:21 Next, in Connect a Browser Through MCP, you’ll add a browser server to the festival project and have your agent check the search page.

Become a Member to join the conversation.