fix: restore Python 3.12 startup and release 2.0.1
This commit is contained in:
1 parent
bf6247703d
commit
b584dae80a
19 files changed
+223
-20
No files matched your search
@@ -27,7 +27,9 @@ if _REPO_ROOT not in sys.path:
|
||||
|
||||
# pylint: disable=wrong-import-position
|
||||
from adbutils import AdbClient
|
||||
from mcp.server.fastmcp import Context, FastMCP
|
||||
from mcp.server.fastmcp import Context
|
||||
|
||||
from artemis.mcp.tool_server import ArtemisFastMCP
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -86,7 +88,7 @@ def configure_stdio_mode() -> None:
|
||||
|
||||
|
||||
# Create minimal MCP server
|
||||
mcp = FastMCP("Android_ADB_Controller")
|
||||
mcp = ArtemisFastMCP("Android_ADB_Controller")
|
||||
|
||||
_GLOBAL_CONTROLLER = None
|
||||
_CONTROLLERS: dict[str, Any] = {}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
"""Keep ARTEMIS tool descriptions stable across supported Python versions."""
|
||||
|
||||
from textwrap import dedent
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
|
||||
class ArtemisFastMCP(FastMCP):
|
||||
"""Normalize docstring indentation before FastMCP publishes tool metadata."""
|
||||
|
||||
def add_tool(
|
||||
self,
|
||||
fn,
|
||||
name=None,
|
||||
title=None,
|
||||
description=None,
|
||||
annotations=None,
|
||||
icons=None,
|
||||
meta=None,
|
||||
structured_output=None,
|
||||
):
|
||||
if not description:
|
||||
# Python 3.13+ removes this indentation at compilation; 3.12 leaves
|
||||
# it in __doc__. Retain blank lines, including the final newline,
|
||||
# so the existing catalog and pinned schemas stay byte-for-byte equal.
|
||||
first, separator, body = (fn.__doc__ or "").expandtabs().partition("\n")
|
||||
description = first.lstrip() + separator + dedent(body)
|
||||
super().add_tool(
|
||||
fn,
|
||||
name=name,
|
||||
title=title,
|
||||
description=description,
|
||||
annotations=annotations,
|
||||
icons=icons,
|
||||
meta=meta,
|
||||
structured_output=structured_output,
|
||||
)
|
||||
Reference in new issue
Block a user