WEBVTT

00:00.800 --> 00:04.280
And let's now go and rerun everything.

00:12.200 --> 00:17.520
And here we see that we initialize the session, we process the request of list tools.

00:17.520 --> 00:20.720
And then we had a request of call tool.

00:20.880 --> 00:29.240
So our graph agent our graph react agent which is our MCP host use the MCP client in order to invoke

00:29.640 --> 00:33.000
the add tool that the MCP server exposes.

00:34.320 --> 00:42.520
And if I will go to the MCP flow of the protocol, then the query we send to our app host.

00:42.680 --> 00:49.360
Then it sends to the LM the same query plus all the information about the MCP tools.

00:49.680 --> 00:57.520
So then the LM responded that it should go and run the add function with the correct arguments.

00:57.520 --> 00:59.240
So it's going to be two two.

01:00.200 --> 01:02.280
And something very cool happened here.

01:02.560 --> 01:10.240
So instead of the agent running and executing the tools in the actual graph application, what's happening

01:10.240 --> 01:18.280
is that the graph agent, with the help of the MCP client, is making a request to the MCP server,

01:18.480 --> 01:24.840
and the actual execution of the tool is happening in the server side, which is decoupled from our graph

01:24.840 --> 01:25.800
application.

01:25.800 --> 01:29.240
So our graph application is responsible for the orchestration.

01:29.440 --> 01:33.640
And the MCP server is responsible for the execution of the tools.

01:33.680 --> 01:38.560
This is one of the benefits of combining land graph and link chain with MCP.

01:40.080 --> 01:40.760
Alrighty.

01:40.800 --> 01:49.080
So after we execute it in the server side, the tool we send back the response to the MCP client which

01:49.160 --> 01:57.040
forwards it into our graph agent, which then sends the original query with the tool execution answer

01:57.040 --> 01:58.000
to the LM.

01:58.280 --> 02:03.400
The LM is then going to process it, and it's going to output as the final answer in this case.

02:03.600 --> 02:08.000
And this is what's being forwarded to the user by our application.

02:08.440 --> 02:10.840
So let's go back here to the final answer.

02:10.840 --> 02:13.880
And the final answer is two plus two is equal to four.

02:15.560 --> 02:18.120
And let me now go and change here instead of two.

02:18.160 --> 02:20.560
Let's put here for example 54.

02:20.920 --> 02:23.560
And let's make this example a bit more complicated.

02:23.560 --> 02:26.040
And let's add here times three.

02:26.840 --> 02:30.160
So we have here two invocations of the tool here.

02:30.640 --> 02:33.200
So let's go and rerun everything.

02:36.680 --> 02:39.360
And we can see we actually get three tool calls.

02:39.360 --> 02:43.280
And for me it's a surprise because I thought we would get two one call.

02:43.280 --> 02:46.880
It's going to be two times three which is going to output six.

02:47.000 --> 02:50.320
And the other two will call is going to be six plus 54.

02:50.600 --> 02:54.360
So we'll check in the trace soon and we'll see soon what's happening here.

02:54.560 --> 02:56.080
And let's wait for the result.

02:56.120 --> 02:57.720
The result here is 60.

02:57.840 --> 02:59.800
So the answer here is correct.

02:59.800 --> 03:03.640
So to complete the picture I want to go into lengthy tracing.

03:03.640 --> 03:10.030
And I want to see exactly what were the tool calls and to see what was this mysterious extra tool call.

03:10.470 --> 03:11.230
Alrighty.

03:11.390 --> 03:16.590
So let me open links meat and here I will go to MCP test.

03:16.630 --> 03:18.670
This is the project I'm tracing right now.

03:19.790 --> 03:24.190
And here we have two traces of our graph executions.

03:24.350 --> 03:27.390
So one is going to be for the two plus two query.

03:27.390 --> 03:31.070
And the other is going to be for the 54 plus two times three query.

03:31.550 --> 03:37.870
By the way I made those traces public and I am sharing them in the videos resources.

03:37.870 --> 03:40.390
So you can see exactly what I am seeing right now.

03:40.510 --> 03:47.870
If you didn't do it for yourself, let's open the two plus two trace and let's examine what are the

03:47.870 --> 03:49.350
calls made to the LM.

03:49.870 --> 03:54.630
And let's go and select here this instance of chat OpenAI message.

03:55.070 --> 03:56.750
And here we're seeing the trace.

03:57.230 --> 04:01.070
And we can see that we made a request with function calling.

04:01.230 --> 04:03.230
So we can see here the tools we have here.

04:03.230 --> 04:07.030
This is the tools that the graph agent sent.

04:07.230 --> 04:10.070
And we can see we have here with the add and then multiply tool.

04:10.230 --> 04:15.110
And we can see that the LM responded with the add tool that needs to be called.

04:15.110 --> 04:17.710
And we can see it by this called tag over here.

04:17.710 --> 04:20.030
So the input was what is two plus two.

04:20.070 --> 04:22.750
So this was the exact input of the original query.

04:23.070 --> 04:27.750
The augmentation with the tools that Landgraaf did for us was here.

04:28.030 --> 04:32.390
And the result is this tool call with those arguments here.

04:33.030 --> 04:39.590
So the MCP client then made a request to the MCP server with the input of two plus two.

04:39.630 --> 04:42.230
So we executed the tool in the MCP server.

04:42.430 --> 04:45.030
And this is the tracing of this execution.

04:45.030 --> 04:49.190
And we can see here the input is two and two and the output is four.

04:49.550 --> 04:56.670
And something interesting to note is that in this trace here we can't really see that the tool was actually

04:56.670 --> 05:02.710
executed on the MCP server, which is completely decoupled from the graph graph.

05:03.110 --> 05:06.870
So we can't really see it even by inspecting the metadata here.

05:07.070 --> 05:12.710
But I'm positive that the LinkedIn team is going to update this, and it's going to make this more visible

05:12.710 --> 05:17.430
and more noticeable for agents which leverage MCP servers.

05:19.110 --> 05:22.150
Anyways, here we can see now the final answer.

05:22.150 --> 05:26.190
So we have here the original prompt the tool call.

05:26.190 --> 05:28.750
And we get here the final answer which is four.

05:30.070 --> 05:36.350
And the last thing I owe you for this session is to show you this extra mysterious tool call that we

05:36.350 --> 05:37.790
had in the second round.

05:38.910 --> 05:42.590
And if we'll open the first request to the LLM.

05:42.590 --> 05:47.710
So this is the original prompt alongside the augmentation of the MCP tools here.

05:47.990 --> 05:53.270
Then we can see that the output we get back from the LLM is a multiple tool call.

05:53.270 --> 05:54.990
So we have here two tool calls.

05:54.990 --> 05:57.590
One is going to be 54 plus zero.

05:57.750 --> 06:01.430
And this is the extra tool call that I missed.

06:01.590 --> 06:04.310
And the other is going to be two times three.

06:04.590 --> 06:10.340
And an interesting thing with graph by the way is that it's going to run those tool calls concurrently.

06:10.340 --> 06:13.940
So it's going to make two concurrent requests into our MCP server.

06:13.940 --> 06:17.260
So one request is going to be to add 54 and zero.

06:17.500 --> 06:20.900
And the other request is going to be to multiply two and three.

06:21.100 --> 06:26.460
And you can see that they are concurrent because they are starting in the same start time, the same

06:26.460 --> 06:30.020
timestamp of 1131 and 17 milliseconds.

06:32.060 --> 06:36.660
And the rest of the execution is pretty straightforward.

06:36.900 --> 06:43.340
After we have the result from the MCP server of how much is two times three, we can send another request

06:43.380 --> 06:46.460
to the Lem with this observation with this result.

06:46.620 --> 06:48.980
So let's go and check it out.

06:50.300 --> 06:57.180
And here we are sending now the Lem, the same query but with the result of the tool call.

06:57.580 --> 07:01.940
And then the Lem is going to decide that it needs to add up 54 and six.

07:02.140 --> 07:04.620
So let's go and see if this tool execution here.

07:08.060 --> 07:10.540
And the rest is pretty straightforward.

07:10.540 --> 07:15.980
We send this final result to the LM again, alongside with the history of what we did.

07:16.020 --> 07:22.100
And then we get the final answer and let's go and let's check out the final answer here.

07:23.620 --> 07:25.220
And that's it.

07:25.260 --> 07:32.620
Let me go now and go back to cursor and let me go and add the implementation here.

07:32.620 --> 07:33.980
And let's commit it to GitHub.

07:34.660 --> 07:40.420
So I'm going to use again the cursor feature of creating the commit message.

07:44.340 --> 07:49.340
Let me commit that and let me push to the repository.

07:56.140 --> 07:59.420
All right so you can see the final artifact.

07:59.620 --> 08:02.580
Let's go to the GitHub repository.

08:02.860 --> 08:06.220
So the final artifact is going to be here in this branch.

08:06.420 --> 08:09.820
And you can see here that this is the code.
