Skip to content

Commit 77b973f

Browse files
committed
Add MCP sampling diagram
Signed-off-by: Christian Tzolov <[email protected]>
1 parent b8fb18b commit 77b973f

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-0
lines changed

model-context-protocol/sampling/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ The MCP Sampling workflow in these examples follows these steps:
6666
- The server combines the responses from different LLMs
6767
- It returns the combined result to the user
6868

69+
![MCP Sampling Sequence Diagram](./mvc-sampling-sq.svg)
70+
6971
## Server Implementation
7072

7173
The MCP Weather Server implements the server-side of MCP Sampling:
Lines changed: 63 additions & 0 deletions
Loading
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@startuml
2+
skinparam sequenceArrowThickness 2
3+
skinparam roundcorner 10
4+
skinparam sequenceParticipant {
5+
BackgroundColor #222222
6+
BorderColor #222222
7+
FontColor white
8+
}
9+
skinparam sequenceLifeLineBorderColor #AAAAAA
10+
skinparam sequenceGroupFontColor white
11+
12+
participant "MCP Server" as Server
13+
participant "MCP Client" as Client
14+
participant "LLM" as LLM
15+
16+
group Initialization
17+
18+
Client -> Server: Initialization Request
19+
activate Client
20+
activate Server
21+
22+
Server --> Client: Initialization Response
23+
deactivate Server
24+
25+
Client -\ Server: Initializated
26+
deactivate Client
27+
end
28+
29+
group Inside an Existing Client Invocation
30+
Client -> Server: Tool/Prompt/Resource Request
31+
activate Client
32+
activate Server
33+
34+
group Sampling
35+
Server -> Client: sampling/createMessage
36+
activate Client
37+
38+
group Model interaction
39+
Client -> LLM: Forward sampling request
40+
activate LLM
41+
LLM --> Client: Return generation
42+
deactivate LLM
43+
end
44+
45+
Client --> Server: Return generation
46+
deactivate Client
47+
end
48+
49+
Server --> Client: Tool/Prompt/Resource Response
50+
deactivate Server
51+
deactivate Client
52+
end
53+
54+
@enduml

0 commit comments

Comments
 (0)