Skip to content

Commit 6218ff1

Browse files
author
BlackDadd77
authored
Merge branch 'main' into main
2 parents 9af7910 + 5489e8b commit 6218ff1

File tree

125 files changed

+2164
-1495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2164
-1495
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# Applied 120 line-length rule to all files: https://github.com/modelcontextprotocol/python-sdk/pull/856
22
543961968c0634e93d919d509cce23a1d6a56c21
3+
4+
# Added 100% code coverage baseline with pragma comments: https://github.com/modelcontextprotocol/python-sdk/pull/1553
5+
89e9c43acf7e23cf766357d776ec1ce63ac2c58e

.gitattribute

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Generated
2-
uv.lock linguist-generated=true
2+
uv.lock linguist-generated=true

.github/workflows/shared.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ jobs:
3838
python-version: ["3.10", "3.11", "3.12", "3.13"]
3939
dep-resolution:
4040
- name: lowest-direct
41-
install-flags: "--resolution lowest-direct"
41+
install-flags: "--upgrade --resolution lowest-direct"
4242
- name: highest
43-
install-flags: "--frozen"
43+
install-flags: "--upgrade --resolution highest"
4444
os: [ubuntu-latest, windows-latest]
4545

4646
steps:
@@ -55,10 +55,11 @@ jobs:
5555
- name: Install the project
5656
run: uv sync ${{ matrix.dep-resolution.install-flags }} --all-extras --python ${{ matrix.python-version }}
5757

58-
- name: Run pytest
59-
run: uv run ${{ matrix.dep-resolution.install-flags }} --no-sync pytest
60-
env:
61-
UV_RESOLUTION: ${{ matrix.dep-resolution.name == 'lowest-direct' && 'lowest-direct' || 'highest' }}
58+
- name: Run pytest with coverage
59+
run: |
60+
uv run --frozen --no-sync coverage run -m pytest
61+
uv run --frozen --no-sync coverage combine
62+
uv run --frozen --no-sync coverage report
6263
6364
readme-snippets:
6465
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
fail_fast: true
22

33
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v6.0.0
6+
hooks:
7+
- id: end-of-file-fixer
8+
49
- repo: https://github.com/pre-commit/mirrors-prettier
510
rev: v3.1.0
611
hooks:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
python-dotenv>=1.0.0
22
requests>=2.31.0
33
mcp>=1.0.0
4-
uvicorn>=0.32.1
4+
uvicorn>=0.32.1

examples/clients/simple-chatbot/mcp_simple_chatbot/servers_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
1010
}
1111
}
12-
}
12+
}

examples/servers/everything-server/mcp_everything_server/server.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,38 @@ async def test_elicitation(message: str, ctx: Context[ServerSession, None]) -> s
166166
return f"Elicitation not supported or error: {str(e)}"
167167

168168

169+
class SEP1034DefaultsSchema(BaseModel):
170+
"""Schema for testing SEP-1034 elicitation with default values for all primitive types"""
171+
172+
name: str = Field(default="John Doe", description="User name")
173+
age: int = Field(default=30, description="User age")
174+
score: float = Field(default=95.5, description="User score")
175+
status: str = Field(
176+
default="active",
177+
description="User status",
178+
json_schema_extra={"enum": ["active", "inactive", "pending"]},
179+
)
180+
verified: bool = Field(default=True, description="Verification status")
181+
182+
183+
@mcp.tool()
184+
async def test_elicitation_sep1034_defaults(ctx: Context[ServerSession, None]) -> str:
185+
"""Tests elicitation with default values for all primitive types (SEP-1034)"""
186+
try:
187+
# Request user input with defaults for all primitive types
188+
result = await ctx.elicit(message="Please provide user information", schema=SEP1034DefaultsSchema)
189+
190+
# Type-safe discriminated union narrowing using action field
191+
if result.action == "accept":
192+
content = result.data.model_dump_json()
193+
else: # decline or cancel
194+
content = "{}"
195+
196+
return f"Elicitation result: action={result.action}, content={content}"
197+
except Exception as e:
198+
return f"Elicitation not supported or error: {str(e)}"
199+
200+
169201
@mcp.tool()
170202
def test_error_handling() -> str:
171203
"""Tests error response handling"""
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

0 commit comments

Comments
 (0)