Skip to content

Commit 7be0928

Browse files
committed
feat: add theme field to Icon type for light/dark mode support
Add IconTheme type alias and theme field to the Icon class for parity with the Go SDK. This allows servers to specify whether an icon is designed for a light or dark background, enabling clients to select the appropriate icon based on their UI theme. Closes #1977
1 parent 2182205 commit 7be0928

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/mcp/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
GetTaskRequestParams,
7171
GetTaskResult,
7272
Icon,
73+
IconTheme,
7374
ImageContent,
7475
Implementation,
7576
IncludeContext,
@@ -275,6 +276,7 @@
275276
"BlobResourceContents",
276277
"EmbeddedResource",
277278
"Icon",
279+
"IconTheme",
278280
"ImageContent",
279281
"ResourceContents",
280282
"ResourceLink",

src/mcp/types/_types.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
ProgressToken = str | int
2929
Role = Literal["user", "assistant"]
3030

31+
IconTheme = Literal["light", "dark"]
32+
3133
TaskExecutionMode = Literal["forbidden", "optional", "required"]
3234
TASK_FORBIDDEN: Final[Literal["forbidden"]] = "forbidden"
3335
TASK_OPTIONAL: Final[Literal["optional"]] = "optional"
@@ -170,6 +172,10 @@ class Icon(MCPModel):
170172
sizes: list[str] | None = None
171173
"""Optional list of strings specifying icon dimensions (e.g., ["48x48", "96x96"])."""
172174

175+
theme: IconTheme | None = None
176+
"""Optional theme specifier. 'light' indicates the icon is designed for a light
177+
background, 'dark' indicates the icon is designed for a dark background."""
178+
173179

174180
class Implementation(BaseMetadata):
175181
"""Describes the name and version of an MCP implementation."""

0 commit comments

Comments
 (0)