Skip to content

Commit da2ddd2

Browse files
committed
type inline
1 parent 4f2942e commit da2ddd2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/mcp/server/lowlevel/server.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,6 @@ async def main():
105105
UnstructuredContent: TypeAlias = Iterable[types.ContentBlock]
106106
CombinationContent: TypeAlias = tuple[UnstructuredContent, StructuredContent]
107107

108-
# type alias for call_tool handler function signature
109-
CallToolHandler: TypeAlias = Callable[
110-
[str, dict[str, Any]],
111-
Awaitable[
112-
UnstructuredContent | StructuredContent | CombinationContent | types.CallToolResult | types.CreateTaskResult
113-
],
114-
]
115-
116108
# This will be properly typed in each Server instance's context
117109
request_ctx: contextvars.ContextVar[RequestContext[ServerSession, Any, Any]] = contextvars.ContextVar("request_ctx")
118110

@@ -505,7 +497,18 @@ def call_tool(self, *, validate_input: bool = True):
505497
If outputSchema is defined, validates structuredContent or errors if missing.
506498
"""
507499

508-
def decorator(func: CallToolHandler) -> CallToolHandler:
500+
def decorator(
501+
func: Callable[
502+
[str, dict[str, Any]],
503+
Awaitable[
504+
UnstructuredContent
505+
| StructuredContent
506+
| CombinationContent
507+
| types.CallToolResult
508+
| types.CreateTaskResult
509+
],
510+
],
511+
):
509512
logger.debug("Registering handler for CallToolRequest")
510513

511514
async def handler(req: types.CallToolRequest):

0 commit comments

Comments
 (0)