FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-sdk/tests/test_types.py at main · amoycode/python-sdk · GitHub
amoycode
/
python-sdk
Public
forked from
modelcontextprotocol/python-sdk
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-sdk
/
tests
/
test_types.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (27 loc) · 932 Bytes
Breadcrumbs
python-sdk
/
tests
/
test_types.py
Copy path
File metadata and controls
32 lines (27 loc) · 932 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import
pytest
from
mcp
.
types
import
(
LATEST_PROTOCOL_VERSION
,
ClientRequest
,
JSONRPCMessage
,
JSONRPCRequest
,
)
@
pytest
.
mark
.
anyio
async
def
test_jsonrpc_request
():
json_data
=
{
"jsonrpc"
:
"2.0"
,
"id"
:
1
,
"method"
:
"initialize"
,
"params"
: {
"protocolVersion"
:
LATEST_PROTOCOL_VERSION
,
"capabilities"
: {
"batch"
:
None
,
"sampling"
:
None
},
"clientInfo"
: {
"name"
:
"mcp"
,
"version"
:
"0.1.0"
},
},
}
request
=
JSONRPCMessage
.
model_validate
(
json_data
)
assert
isinstance
(
request
.
root
,
JSONRPCRequest
)
ClientRequest
.
model_validate
(
request
.
model_dump
(
by_alias
=
True
,
exclude_none
=
True
))
assert
request
.
root
.
jsonrpc
==
"2.0"
assert
request
.
root
.
id
==
1
assert
request
.
root
.
method
==
"initialize"
assert
request
.
root
.
params
is
not
None
assert
request
.
root
.
params
[
"protocolVersion"
]
==
LATEST_PROTOCOL_VERSION
Back
|
FazBrowse Home
|
New Git URL