FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-sdk/docs_src/subscriptions/tutorial001.py at main · stophobia/python-sdk · GitHub
stophobia
/
python-sdk
Public
forked from
modelcontextprotocol/python-sdk
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
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
/
docs_src
/
subscriptions
/
tutorial001.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (23 loc) · 878 Bytes
Breadcrumbs
python-sdk
/
docs_src
/
subscriptions
/
tutorial001.py
Copy path
File metadata and controls
33 lines (23 loc) · 878 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
33
from
mcp
.
server
.
mcpserver
import
Context
,
MCPServer
mcp
=
MCPServer
(
"Sprint Board"
)
BOARDS
=
{
"sprint"
: {
"design"
:
False
,
"build"
:
False
,
"ship"
:
False
},
"backlog"
: {
"tidy docs"
:
False
},
}
@
mcp
.
resource
(
"board://{name}"
)
def
board
(
name
:
str
)
->
str
:
tasks
=
BOARDS
[
name
]
return
"
\n
"
.
join
(
f"[
{
'x'
if
done
else
' '
}
]
{
task
}
"
for
task
,
done
in
tasks
.
items
())
@
mcp
.
tool
()
async
def
complete_task
(
board
:
str
,
task
:
str
,
ctx
:
Context
)
->
str
:
BOARDS
[
board
][
task
]
=
True
await
ctx
.
notify_resource_updated
(
f"board://
{
board
}
"
)
return
f"
{
task
}
: done"
def
sprint_report
()
->
str
:
done
=
sum
(
done
for
tasks
in
BOARDS
.
values
()
for
done
in
tasks
.
values
())
return
f"
{
done
}
task(s) done"
@
mcp
.
tool
()
async
def
enable_reports
(
ctx
:
Context
)
->
str
:
mcp
.
add_tool
(
sprint_report
)
await
ctx
.
notify_tools_changed
()
return
"reporting is live"
Back
|
FazBrowse Home
|
New Git URL