Skip to content

Commit b949709

Browse files
Merge pull request #12 from appwrite/fix-list-typing
fix: typing for list params
2 parents b118deb + 76cb6f9 commit b949709

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[project]
22
name = "mcp-server-appwrite"
3-
version = "0.1.3"
3+
version = "0.1.4"
44
description = "MCP (Model Context Protocol) server for Appwrite"
55
readme = "README.md"
66
requires-python = ">=3.12"
77
dependencies = [
88
"appwrite>=9.0.2",
9+
"docstring-parser>=0.16",
910
"mcp[cli]>=1.3.0",
1011
]
1112

src/mcp_server_appwrite/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async def _run():
125125
write_stream,
126126
InitializationOptions(
127127
server_name="appwrite",
128-
server_version="0.1.3",
128+
server_version="0.1.4",
129129
capabilities=server.get_capabilities(
130130
notification_options=NotificationOptions(),
131131
experimental_capabilities={},

src/mcp_server_appwrite/service.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Any, get_type_hints, Dict, List, Optional, Union
22
import inspect
33
from mcp.types import Tool
4+
from docstring_parser import parse
45

56
class Service():
67
"""Base class for all Appwrite services"""
@@ -86,7 +87,7 @@ def list_tools(self) -> Dict[str, Dict]:
8687
# Get the overridden name if it exists
8788
tool_name = self._method_name_overrides.get(name, f"{self.service_name}_{name}")
8889

89-
docstring = (original_func.__doc__ or "No description available").strip()
90+
docstring = parse(original_func.__doc__)
9091
signature = inspect.signature(original_func)
9192
type_hints = get_type_hints(original_func)
9293

@@ -100,13 +101,17 @@ def list_tools(self) -> Dict[str, Dict]:
100101
param_type = type_hints.get(param_name, str)
101102
properties[param_name] = self.python_type_to_json_schema(param_type)
102103
properties[param_name]["description"] = f"Parameter '{param_name}'"
104+
105+
for doc_param in docstring.params:
106+
if doc_param.arg_name == param_name:
107+
properties[param_name]["description"] = doc_param.description
103108

104109
if param.default is param.empty:
105110
required.append(param_name)
106111

107112
tool_definition = Tool(
108113
name=tool_name,
109-
description=f"{docstring}",
114+
description=f"{docstring.short_description or "No description available"}",
110115
inputSchema={
111116
"type": "object",
112117
"properties": properties,

uv.lock

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)