fastmcp 2.14.0__py3-none-any.whl → 2.14.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastmcp/client/client.py +79 -12
- fastmcp/client/sampling/__init__.py +69 -0
- fastmcp/client/sampling/handlers/__init__.py +0 -0
- fastmcp/client/sampling/handlers/anthropic.py +387 -0
- fastmcp/client/sampling/handlers/openai.py +399 -0
- fastmcp/client/tasks.py +0 -63
- fastmcp/client/transports.py +35 -16
- fastmcp/experimental/sampling/handlers/__init__.py +5 -0
- fastmcp/experimental/sampling/handlers/openai.py +4 -169
- fastmcp/prompts/prompt.py +5 -5
- fastmcp/prompts/prompt_manager.py +3 -4
- fastmcp/resources/resource.py +4 -4
- fastmcp/resources/resource_manager.py +9 -14
- fastmcp/resources/template.py +5 -5
- fastmcp/server/auth/auth.py +20 -5
- fastmcp/server/auth/oauth_proxy.py +73 -15
- fastmcp/server/auth/providers/supabase.py +11 -6
- fastmcp/server/context.py +448 -113
- fastmcp/server/dependencies.py +5 -0
- fastmcp/server/elicitation.py +7 -3
- fastmcp/server/middleware/error_handling.py +1 -1
- fastmcp/server/openapi/components.py +2 -4
- fastmcp/server/proxy.py +3 -3
- fastmcp/server/sampling/__init__.py +10 -0
- fastmcp/server/sampling/run.py +301 -0
- fastmcp/server/sampling/sampling_tool.py +108 -0
- fastmcp/server/server.py +84 -78
- fastmcp/server/tasks/converters.py +2 -1
- fastmcp/tools/tool.py +8 -6
- fastmcp/tools/tool_manager.py +5 -7
- fastmcp/utilities/cli.py +23 -43
- fastmcp/utilities/json_schema.py +40 -0
- fastmcp/utilities/openapi/schemas.py +4 -4
- {fastmcp-2.14.0.dist-info → fastmcp-2.14.2.dist-info}/METADATA +8 -3
- {fastmcp-2.14.0.dist-info → fastmcp-2.14.2.dist-info}/RECORD +38 -34
- fastmcp/client/sampling.py +0 -56
- fastmcp/experimental/sampling/handlers/base.py +0 -21
- fastmcp/server/sampling/handler.py +0 -19
- {fastmcp-2.14.0.dist-info → fastmcp-2.14.2.dist-info}/WHEEL +0 -0
- {fastmcp-2.14.0.dist-info → fastmcp-2.14.2.dist-info}/entry_points.txt +0 -0
- {fastmcp-2.14.0.dist-info → fastmcp-2.14.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -17,19 +17,22 @@ fastmcp/cli/install/gemini_cli.py,sha256=G7NhKnH21893baQjmVbFpwRyMbYIq7bocPQz1CB
|
|
|
17
17
|
fastmcp/cli/install/mcp_json.py,sha256=l7b0sWB10YlbcXtcwJv1X2iHEP9V9EwuuD63PyTMvXI,5832
|
|
18
18
|
fastmcp/cli/install/shared.py,sha256=Qf5VH0b6l66yyBzDYtZwbbESUDYn6k5oyb6u-xepPTI,4447
|
|
19
19
|
fastmcp/client/__init__.py,sha256=QHvSGJCLejQkQ4o070vsUdKNB8vUhxckBByvHjnteTQ,663
|
|
20
|
-
fastmcp/client/client.py,sha256=
|
|
20
|
+
fastmcp/client/client.py,sha256=3zBmdjUsJIx3GkPBZtzYez-XYIm0VogMFMMcNcz-z18,63206
|
|
21
21
|
fastmcp/client/elicitation.py,sha256=KlLvZn4FpwC5S5iXNq79mtqtbrtUjXyked-l-pZk6js,2878
|
|
22
22
|
fastmcp/client/logging.py,sha256=WBByRoBIB-Bl3ZUJVFvHqRt4teYPAvqC8MnJ358Elg8,1939
|
|
23
23
|
fastmcp/client/messages.py,sha256=g85Qca7aiMQLt4E4PwzUoLK6EIS8UM9j2qNwOEHjy0M,4636
|
|
24
24
|
fastmcp/client/oauth_callback.py,sha256=3xqL5_HD1QS9eGfw31HzoVF94QQelq_0TTqS7qWDlQQ,7709
|
|
25
25
|
fastmcp/client/progress.py,sha256=WjLLDbUKMsx8DK-fqO7AGsXb83ak-6BMrLvzzznGmcI,1043
|
|
26
26
|
fastmcp/client/roots.py,sha256=Uap1RSr3uEeQRZTHkEttkhTI2fOA8IeDcRSggtZp9aY,2568
|
|
27
|
-
fastmcp/client/
|
|
28
|
-
fastmcp/client/
|
|
29
|
-
fastmcp/client/transports.py,sha256=9WfOVMzLdYQqFcZ1cE2oR0KAp1XeOZ5hQNOhARkPl5s,42342
|
|
27
|
+
fastmcp/client/tasks.py,sha256=zjiTfvjU9NaA4e3XTBGHsqvSfBRR19UqZMIUhJ_nQTo,19480
|
|
28
|
+
fastmcp/client/transports.py,sha256=ZRxHTgNYK6_D_2GNa15cfGMNP-naZ0A9q8oc2jfgX8A,43231
|
|
30
29
|
fastmcp/client/auth/__init__.py,sha256=4DNsfp4iaQeBcpds0JDdMn6Mmfud44stWLsret0sVKY,91
|
|
31
30
|
fastmcp/client/auth/bearer.py,sha256=MFEFqcH6u_V86msYiOsEFKN5ks1V9BnBNiPsPLHUTqo,399
|
|
32
31
|
fastmcp/client/auth/oauth.py,sha256=8B1HTPoPhEFQUZBfuhR6jqq4CHu6BDATVowC3ayZmg8,12513
|
|
32
|
+
fastmcp/client/sampling/__init__.py,sha256=jaquyp7c5lz4mczv0d5Skl153uWrnXVcS4qCmbjLKRY,2208
|
|
33
|
+
fastmcp/client/sampling/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
+
fastmcp/client/sampling/handlers/anthropic.py,sha256=LjxTYzIWOnbJwJDHJOkRybW0dXBcyt2c7B4sCaG3uLM,14318
|
|
35
|
+
fastmcp/client/sampling/handlers/openai.py,sha256=9E5WyiNDGFnB_UJ--UxS36EgpZZ_n_pclmUIXDNCXrM,15399
|
|
33
36
|
fastmcp/contrib/README.md,sha256=rKknYSI1T192UvSszqwwDlQ2eYQpxywrNTLoj177SYU,878
|
|
34
37
|
fastmcp/contrib/bulk_tool_caller/README.md,sha256=5aUUY1TSFKtz1pvTLSDqkUCkGkuqMfMZNsLeaNqEgAc,1960
|
|
35
38
|
fastmcp/contrib/bulk_tool_caller/__init__.py,sha256=xvGSSaUXTQrc31erBoi1Gh7BikgOliETDiYVTP3rLxY,75
|
|
@@ -45,33 +48,32 @@ fastmcp/contrib/mcp_mixin/__init__.py,sha256=zZFHlAGexUJCDLAg4p7CGZDmb-mgPdN1xVv
|
|
|
45
48
|
fastmcp/contrib/mcp_mixin/example.py,sha256=GnunkXmtG5hLLTUsM8aW5ZURU52Z8vI4tNLl-fK7Dg0,1228
|
|
46
49
|
fastmcp/contrib/mcp_mixin/mcp_mixin.py,sha256=Ij009tiJBj1Lciz4abTICA1Il-kz_myr4aevQ4yGTNo,10582
|
|
47
50
|
fastmcp/experimental/sampling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
fastmcp/experimental/sampling/handlers/__init__.py,sha256=
|
|
49
|
-
fastmcp/experimental/sampling/handlers/
|
|
50
|
-
fastmcp/experimental/sampling/handlers/openai.py,sha256=r7FUUL6fGHkYxsgFS44MyMxnaCrEYOYt9V98O_bjbyQ,5752
|
|
51
|
+
fastmcp/experimental/sampling/handlers/__init__.py,sha256=cY6yyaI_DBx5NKH6t70tZQNjy1IEImbXV-VwKruk8UM,216
|
|
52
|
+
fastmcp/experimental/sampling/handlers/openai.py,sha256=0HK7GX3hwz7PKkiObS7lYE_70ugZURC0I2_whxV7Ac0,223
|
|
51
53
|
fastmcp/experimental/server/openapi/__init__.py,sha256=QNrM6ZNwJLk78jh7hq1tdZ-WnZLQ0KHd-7hjQgYeMqw,817
|
|
52
54
|
fastmcp/experimental/utilities/openapi/__init__.py,sha256=-SIYFQ4CE9MTxKQbksQ4J3lwm409EV3qKkHuTwAEyNk,907
|
|
53
55
|
fastmcp/prompts/__init__.py,sha256=BQ5ooDJcNhb5maYBcg2mF1VaHAY_A64cEU3UiCQ3Lw8,179
|
|
54
|
-
fastmcp/prompts/prompt.py,sha256=
|
|
55
|
-
fastmcp/prompts/prompt_manager.py,sha256=
|
|
56
|
+
fastmcp/prompts/prompt.py,sha256=6Q6xKDIw5MdPC9dTAnM-9FRtA-34dv4qqTrD_5s2w0Y,14483
|
|
57
|
+
fastmcp/prompts/prompt_manager.py,sha256=OJiRAlWLPrPVfyzAzKfP_OHBXKqsU4eotrbUJNABz-A,4205
|
|
56
58
|
fastmcp/resources/__init__.py,sha256=si8aT_9taxUNN0vkfbifst_SCId56DZmYi4YOb4mtlE,463
|
|
57
|
-
fastmcp/resources/resource.py,sha256=
|
|
58
|
-
fastmcp/resources/resource_manager.py,sha256=
|
|
59
|
-
fastmcp/resources/template.py,sha256=
|
|
59
|
+
fastmcp/resources/resource.py,sha256=PNzfTpywc5OIvDtFgAa8SGymzBbpwZCa32Mshh9YcGk,7890
|
|
60
|
+
fastmcp/resources/resource_manager.py,sha256=yG3EieKY9DqIcYTIFJkSJlRoXeffV6mTOnW3EwpoZfY,13008
|
|
61
|
+
fastmcp/resources/template.py,sha256=MSAK46bYk74nqJTQ923xb4KETlof9clfg_QaqLrJX_Y,15495
|
|
60
62
|
fastmcp/resources/types.py,sha256=efFLGD1Xc5Xq3sxlPaZ_8gtJ2UOixueTBV4KQTi4cOU,4936
|
|
61
63
|
fastmcp/server/__init__.py,sha256=qxNmIJcqsrpxpUvCv0mhdEAaUn1UZd1xLd8XRoWUlfY,119
|
|
62
|
-
fastmcp/server/context.py,sha256=
|
|
63
|
-
fastmcp/server/dependencies.py,sha256=
|
|
64
|
-
fastmcp/server/elicitation.py,sha256=
|
|
64
|
+
fastmcp/server/context.py,sha256=nd0bME6I7aB9RlKiESNBay97P8yDHJJ-IcjVCbkc7bc,42256
|
|
65
|
+
fastmcp/server/dependencies.py,sha256=gRc60PhEvna9rlqMW-ZlYNszPlUeEeOWT5winYGNH2A,20928
|
|
66
|
+
fastmcp/server/elicitation.py,sha256=CmHi_SERmhEcNjwnM90_HGihUKlCM3RPGHI0uns2t7M,17912
|
|
65
67
|
fastmcp/server/event_store.py,sha256=ZiBbrUQHw9--G8lzK1qLZmUAF2le2XchFen4pGbFKsE,6170
|
|
66
68
|
fastmcp/server/http.py,sha256=_HjMSYWH8mfKugDODU4iV0AhKDU2VRc40tS56L6i-_s,12737
|
|
67
69
|
fastmcp/server/low_level.py,sha256=o3jDf5SuZBQeurhLWRzaSVCnvrmaKMH_w-TbHk6BuZ4,7963
|
|
68
|
-
fastmcp/server/proxy.py,sha256=
|
|
69
|
-
fastmcp/server/server.py,sha256=
|
|
70
|
+
fastmcp/server/proxy.py,sha256=bsgVkcdlRtVK3bB4EeVKrq4PLjIoUvWN_hgzr1hq8yE,26837
|
|
71
|
+
fastmcp/server/server.py,sha256=3RmmJT2vM-ycXces_L6ORSQqlQvzMVITu37dCgqp-Ao,121385
|
|
70
72
|
fastmcp/server/auth/__init__.py,sha256=MTZvDKEUMqjs9-raRN0h8Zjx8pWFXs_iSRbB1UqBUqU,527
|
|
71
|
-
fastmcp/server/auth/auth.py,sha256=
|
|
73
|
+
fastmcp/server/auth/auth.py,sha256=Bvm98USOP0A0yTckKCN7yHJHS4JgCG804W5cQx6GgO4,20430
|
|
72
74
|
fastmcp/server/auth/jwt_issuer.py,sha256=lJYvrpC1ygI4jkoJlL_nTH6m7FKdTw2lbEycKo4eHLY,7197
|
|
73
75
|
fastmcp/server/auth/middleware.py,sha256=xwj3fUCLSlJK6n1Ehp-FN1qnjKqEz8b7LGAGMTqQ8Hk,3284
|
|
74
|
-
fastmcp/server/auth/oauth_proxy.py,sha256=
|
|
76
|
+
fastmcp/server/auth/oauth_proxy.py,sha256=c5BAyT07t3vZtfD9wCoN4f8hnSD1F5e0kCMqlUuO_00,93364
|
|
75
77
|
fastmcp/server/auth/oidc_proxy.py,sha256=gU_RgBbVMj-9vn0TSRTmT1YaT19VFmJLpARcIXn208k,17969
|
|
76
78
|
fastmcp/server/auth/redirect_validation.py,sha256=Jlhela9xpTbw4aWnQ04A5Z-TW0HYOC3f9BMsq3NXx1Q,2000
|
|
77
79
|
fastmcp/server/auth/handlers/authorize.py,sha256=1zrmXqRUhjiWSHgUhfj0CcCkj3uSlGkTnxHzaic0xYs,11617
|
|
@@ -89,11 +91,11 @@ fastmcp/server/auth/providers/introspection.py,sha256=v2hlcuxxwug5myCr4KcTZlawwa
|
|
|
89
91
|
fastmcp/server/auth/providers/jwt.py,sha256=c-2Wji-CvuYt3U3unxjJR-5-EABRDks_755EpxKBDH8,20798
|
|
90
92
|
fastmcp/server/auth/providers/oci.py,sha256=QxpsStKEyl_W4dcJOky4m6wdpGnCSnt7WQ8DWjGPmSU,9894
|
|
91
93
|
fastmcp/server/auth/providers/scalekit.py,sha256=30J2HImUAkyknMgH7lUGytcDOy4d01ClxTrBCO4E3GQ,9064
|
|
92
|
-
fastmcp/server/auth/providers/supabase.py,sha256=
|
|
94
|
+
fastmcp/server/auth/providers/supabase.py,sha256=T3Qq1mkkzZ9T9ah3uK7qRuMMLWeD_3eRLJRnpiqgTiY,7618
|
|
93
95
|
fastmcp/server/auth/providers/workos.py,sha256=_KWsgKPV4OJ6a37FaVgq2LIzM3Nx26G5QQhgS8x2MO4,17244
|
|
94
96
|
fastmcp/server/middleware/__init__.py,sha256=LXT2IcZI4gbAtR4TnA7v_1lOWBR6eaHiE3Cp32Pv0bc,155
|
|
95
97
|
fastmcp/server/middleware/caching.py,sha256=xYUXkFeuoLaIJ_TB2570qEBS1TtneJClJOpJGNsNbu8,18414
|
|
96
|
-
fastmcp/server/middleware/error_handling.py,sha256=
|
|
98
|
+
fastmcp/server/middleware/error_handling.py,sha256=TqERAA3qMvqb0Q0N_rwD5iOhoefOW2WT9IGSUZIWFik,7772
|
|
97
99
|
fastmcp/server/middleware/logging.py,sha256=Reta-f4z8suYkJn4rPyJWYrNBeU25w8Y40U0uaV9ygo,9427
|
|
98
100
|
fastmcp/server/middleware/middleware.py,sha256=-L4QuyyjIF1QIcydWzamrmpIE2w7d2f35-QyoXMZnZM,6643
|
|
99
101
|
fastmcp/server/middleware/rate_limiting.py,sha256=MwhMOhgsIhZjYwEQB8H8961hohV5564JlTwwYy_9ctU,7915
|
|
@@ -101,30 +103,32 @@ fastmcp/server/middleware/timing.py,sha256=lL_xc-ErLD5lplfvd5-HIyWEbZhgNBYkcQ74K
|
|
|
101
103
|
fastmcp/server/middleware/tool_injection.py,sha256=zElqBN-yjZvcTADp57e0dn86kpxT9xsFqvYztiXuA08,3595
|
|
102
104
|
fastmcp/server/openapi/README.md,sha256=1Mc1Ur15OxMn-wAPEa1rZIiNNSMdv9sboQ3YpvNpUXM,9886
|
|
103
105
|
fastmcp/server/openapi/__init__.py,sha256=cZPebMY9xwjW8nUgTN5MvawnZEFx9E0Oe_TFqSrevp0,728
|
|
104
|
-
fastmcp/server/openapi/components.py,sha256=
|
|
106
|
+
fastmcp/server/openapi/components.py,sha256=VdCwdyFh46Y8YIhz5qq1yVXhrQnIWu_KzWi9Ea2HOLc,13294
|
|
105
107
|
fastmcp/server/openapi/routing.py,sha256=_WWci6GNqtfF-5yO-uHwXXc9nNFNV-YlbIWHa7-lCk4,4018
|
|
106
108
|
fastmcp/server/openapi/server.py,sha256=aQ_VwvHxdsC-O-7k_uKmPDkOlcgtOW-gk-RtlLtEtuw,16069
|
|
107
|
-
fastmcp/server/sampling/
|
|
109
|
+
fastmcp/server/sampling/__init__.py,sha256=u9jDHSE_yz6kTzbFqIOXqnM0PfIAiP-peAjHJBNqDd0,249
|
|
110
|
+
fastmcp/server/sampling/run.py,sha256=1FIg9TMcvilQcgW0i00xlpgd7Yz6b814ntG3ihtFo6g,10469
|
|
111
|
+
fastmcp/server/sampling/sampling_tool.py,sha256=YltN7-NcMXUk6cFbuOQmuJ980bmQyh83qgFo0TogP5Q,3311
|
|
108
112
|
fastmcp/server/tasks/__init__.py,sha256=VizXvmXgA3SvrApQ6PSz4z1TPA9B6uROvmWeGSYOJ0I,530
|
|
109
113
|
fastmcp/server/tasks/capabilities.py,sha256=-8QMBjs6HZuQdUNmOrNEBvJs-opGptIyxOODU0TGGFE,574
|
|
110
114
|
fastmcp/server/tasks/config.py,sha256=msPkUuxnZKuqSj21Eh8m5Cwq0htwUzTCeoWsnbvKGkk,3006
|
|
111
|
-
fastmcp/server/tasks/converters.py,sha256=
|
|
115
|
+
fastmcp/server/tasks/converters.py,sha256=ON7c8gOMjBYiQoyk_vkymI8J01ccoYzizDwtgIIqIZQ,6701
|
|
112
116
|
fastmcp/server/tasks/handlers.py,sha256=8wiDiP6tHj8E3iMEIpjZmoiY_k1wgQg-F59KwGk56X8,12489
|
|
113
117
|
fastmcp/server/tasks/keys.py,sha256=w9diycj0N6ViVqe6stxUS9vg2H94bl_614Bu5kNRM-k,3011
|
|
114
118
|
fastmcp/server/tasks/protocol.py,sha256=g97D4k1U8ua_UBTyoqFXcPp5rf6KvuiY5d6mx5KMIPY,12222
|
|
115
119
|
fastmcp/server/tasks/subscriptions.py,sha256=iehPO2zx80aRIqKHCFj9kuR5NVMqYSkIepMXBifQFWw,6692
|
|
116
120
|
fastmcp/tools/__init__.py,sha256=XGcaMkBgwr-AHzbNjyjdb3ATgp5TQ0wzSq0nsrBD__E,201
|
|
117
|
-
fastmcp/tools/tool.py,sha256=
|
|
118
|
-
fastmcp/tools/tool_manager.py,sha256=
|
|
121
|
+
fastmcp/tools/tool.py,sha256=_l0HEnuTyYxm_xNWYxO2seRnzb6NunvjnEsWQIeKBDY,23394
|
|
122
|
+
fastmcp/tools/tool_manager.py,sha256=_SSHYgKygZaJ86B2pncmBm2Kbj0NLIDrpphsc9qgB3M,5788
|
|
119
123
|
fastmcp/tools/tool_transform.py,sha256=m1XDYuu_BDPxpH3yRNdT3jCca9KmVSO-Jd00BK4F5rw,38099
|
|
120
124
|
fastmcp/utilities/__init__.py,sha256=-imJ8S-rXmbXMWeDamldP-dHDqAPg_wwmPVz-LNX14E,31
|
|
121
125
|
fastmcp/utilities/auth.py,sha256=ZVHkNb4YBpLE1EmmFyhvFB2qfWDZdEYNH9TRI9jylOE,1140
|
|
122
|
-
fastmcp/utilities/cli.py,sha256=
|
|
126
|
+
fastmcp/utilities/cli.py,sha256=qjZtF9LvReKDOaLDIzcWWErMpWUBA8-Uvml8H4upuqs,11515
|
|
123
127
|
fastmcp/utilities/components.py,sha256=fF4M9cdqbZTlDAZ0hltcTTg_8IU2jNSzOyH4oqH49ig,6087
|
|
124
128
|
fastmcp/utilities/exceptions.py,sha256=7Z9j5IzM5rT27BC1Mcn8tkS-bjqCYqMKwb2MMTaxJYU,1350
|
|
125
129
|
fastmcp/utilities/http.py,sha256=1ns1ymBS-WSxbZjGP6JYjSO52Wa_ls4j4WbnXiupoa4,245
|
|
126
130
|
fastmcp/utilities/inspect.py,sha256=3wYUuQH1xCCCdzZwALHNqaRABH6iqpA43dIXEhqVb5Q,18030
|
|
127
|
-
fastmcp/utilities/json_schema.py,sha256
|
|
131
|
+
fastmcp/utilities/json_schema.py,sha256=H8RNucfulnXqYjCzRrlaWCBfToHmJGc7M32VJu5q7Eo,10587
|
|
128
132
|
fastmcp/utilities/json_schema_type.py,sha256=5cf1ZeHzqirrGx62kznqmgAWk0uCc29REVKcDRBeJX0,22348
|
|
129
133
|
fastmcp/utilities/logging.py,sha256=61wVk5yQ62km3K8kZtkKtT_3EN26VL85GYW0aMtnwKA,7175
|
|
130
134
|
fastmcp/utilities/mcp_config.py,sha256=lVllZtAXZ3Zy78D40aXN-S5fs-ms0lgryL1tY2WzwCY,1783
|
|
@@ -148,9 +152,9 @@ fastmcp/utilities/openapi/formatters.py,sha256=AWyETOfnBmTUcD1T2ajfkbsVyyMnN4tZ-
|
|
|
148
152
|
fastmcp/utilities/openapi/json_schema_converter.py,sha256=PxaYpgHBsdDTT0XSP6s4RZBMeDpAO_-dRXlBF2iYD9s,13089
|
|
149
153
|
fastmcp/utilities/openapi/models.py,sha256=-kfndwZSe92tVtKAgOuFn5rk1tN7oydCZKtLOEMEalA,2805
|
|
150
154
|
fastmcp/utilities/openapi/parser.py,sha256=qsa68Ro1c8ov77kdEP20IwZqD74E4IGKjtfeIkn3HdE,34338
|
|
151
|
-
fastmcp/utilities/openapi/schemas.py,sha256=
|
|
152
|
-
fastmcp-2.14.
|
|
153
|
-
fastmcp-2.14.
|
|
154
|
-
fastmcp-2.14.
|
|
155
|
-
fastmcp-2.14.
|
|
156
|
-
fastmcp-2.14.
|
|
155
|
+
fastmcp/utilities/openapi/schemas.py,sha256=UXHHjkJyDp1WwJ8kowYt79wnwdbDwAbUFfqwcIY6mIM,23359
|
|
156
|
+
fastmcp-2.14.2.dist-info/METADATA,sha256=pKt4x3lDwdG_CrWNz0oKxcuCYizqMuhFpUjK1vQsdCQ,20771
|
|
157
|
+
fastmcp-2.14.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
158
|
+
fastmcp-2.14.2.dist-info/entry_points.txt,sha256=ff8bMtKX1JvXyurMibAacMSKbJEPmac9ffAKU9mLnM8,44
|
|
159
|
+
fastmcp-2.14.2.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
160
|
+
fastmcp-2.14.2.dist-info/RECORD,,
|
fastmcp/client/sampling.py
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import inspect
|
|
2
|
-
from collections.abc import Awaitable, Callable
|
|
3
|
-
from typing import TypeAlias
|
|
4
|
-
|
|
5
|
-
import mcp.types
|
|
6
|
-
from mcp import CreateMessageResult
|
|
7
|
-
from mcp.client.session import ClientSession, SamplingFnT
|
|
8
|
-
from mcp.shared.context import LifespanContextT, RequestContext
|
|
9
|
-
from mcp.types import CreateMessageRequestParams as SamplingParams
|
|
10
|
-
from mcp.types import SamplingMessage
|
|
11
|
-
|
|
12
|
-
from fastmcp.server.sampling.handler import ServerSamplingHandler
|
|
13
|
-
|
|
14
|
-
__all__ = ["SamplingHandler", "SamplingMessage", "SamplingParams"]
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
ClientSamplingHandler: TypeAlias = Callable[
|
|
18
|
-
[
|
|
19
|
-
list[SamplingMessage],
|
|
20
|
-
SamplingParams,
|
|
21
|
-
RequestContext[ClientSession, LifespanContextT],
|
|
22
|
-
],
|
|
23
|
-
str | CreateMessageResult | Awaitable[str | CreateMessageResult],
|
|
24
|
-
]
|
|
25
|
-
|
|
26
|
-
SamplingHandler: TypeAlias = (
|
|
27
|
-
ClientSamplingHandler[LifespanContextT] | ServerSamplingHandler[LifespanContextT]
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def create_sampling_callback(
|
|
32
|
-
sampling_handler: ClientSamplingHandler[LifespanContextT],
|
|
33
|
-
) -> SamplingFnT:
|
|
34
|
-
async def _sampling_handler(
|
|
35
|
-
context: RequestContext[ClientSession, LifespanContextT],
|
|
36
|
-
params: SamplingParams,
|
|
37
|
-
) -> CreateMessageResult | mcp.types.ErrorData:
|
|
38
|
-
try:
|
|
39
|
-
result = sampling_handler(params.messages, params, context)
|
|
40
|
-
if inspect.isawaitable(result):
|
|
41
|
-
result = await result
|
|
42
|
-
|
|
43
|
-
if isinstance(result, str):
|
|
44
|
-
result = CreateMessageResult(
|
|
45
|
-
role="assistant",
|
|
46
|
-
model="fastmcp-client",
|
|
47
|
-
content=mcp.types.TextContent(type="text", text=result),
|
|
48
|
-
)
|
|
49
|
-
return result
|
|
50
|
-
except Exception as e:
|
|
51
|
-
return mcp.types.ErrorData(
|
|
52
|
-
code=mcp.types.INTERNAL_ERROR,
|
|
53
|
-
message=str(e),
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
return _sampling_handler
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
from collections.abc import Awaitable
|
|
3
|
-
|
|
4
|
-
from mcp import ClientSession, CreateMessageResult
|
|
5
|
-
from mcp.server.session import ServerSession
|
|
6
|
-
from mcp.shared.context import LifespanContextT, RequestContext
|
|
7
|
-
from mcp.types import CreateMessageRequestParams as SamplingParams
|
|
8
|
-
from mcp.types import (
|
|
9
|
-
SamplingMessage,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class BaseLLMSamplingHandler(ABC):
|
|
14
|
-
@abstractmethod
|
|
15
|
-
def __call__(
|
|
16
|
-
self,
|
|
17
|
-
messages: list[SamplingMessage],
|
|
18
|
-
params: SamplingParams,
|
|
19
|
-
context: RequestContext[ServerSession, LifespanContextT]
|
|
20
|
-
| RequestContext[ClientSession, LifespanContextT],
|
|
21
|
-
) -> str | CreateMessageResult | Awaitable[str | CreateMessageResult]: ...
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from collections.abc import Awaitable, Callable
|
|
2
|
-
from typing import TypeAlias
|
|
3
|
-
|
|
4
|
-
from mcp import CreateMessageResult
|
|
5
|
-
from mcp.server.session import ServerSession
|
|
6
|
-
from mcp.shared.context import LifespanContextT, RequestContext
|
|
7
|
-
from mcp.types import CreateMessageRequestParams as SamplingParams
|
|
8
|
-
from mcp.types import (
|
|
9
|
-
SamplingMessage,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
ServerSamplingHandler: TypeAlias = Callable[
|
|
13
|
-
[
|
|
14
|
-
list[SamplingMessage],
|
|
15
|
-
SamplingParams,
|
|
16
|
-
RequestContext[ServerSession, LifespanContextT],
|
|
17
|
-
],
|
|
18
|
-
str | CreateMessageResult | Awaitable[str | CreateMessageResult],
|
|
19
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|