Skip to content

Commit ee63bad

Browse files
authored
fix: Ensure compatibility with multiple Python versions (#3)
1 parent 21c0ce0 commit ee63bad

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: [ "3.11", "3.12" ]
18+
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
1919
os: [ "ubuntu-latest" ]
2020
os-label: [ "Ubuntu" ]
2121
include:
22-
- { python-version: "3.11", os: "windows-latest", os-label: "Windows" }
23-
- { python-version: "3.11", os: "macos-latest", os-label: "macOS" }
24-
- { python-version: "3.11", os: "ubuntu-22.04", os-label: "Ubuntu" }
22+
- { python-version: "3.8", os: "windows-latest", os-label: "Windows" }
23+
- { python-version: "3.8", os: "macos-latest", os-label: "macOS" }
24+
- { python-version: "3.8", os: "ubuntu-22.04", os-label: "Ubuntu" }
2525
steps:
2626
- uses: actions/checkout@v3
2727
- name: Set up Python

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "coze-mcp-server"
3-
version = "0.0.2"
3+
version = "0.0.3"
44
description = "MCP Server for Coze(coze.com/coze.cn)"
55
authors = [
66
{ name = "chyroc", email = "chyroc@bytedance.com" },

src/coze_mcp_server/server.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import sys
3-
from typing import List
3+
from typing import List, Optional, Union
44

55
from cozepy import ( # type: ignore
66
AsyncCoze,
@@ -91,22 +91,22 @@ async def list_workspaces():
9191

9292

9393
@mcp.tool(description="list bots in workspaces")
94-
async def list_bots(workspace_id: int | str):
94+
async def list_bots(workspace_id: Union[int, str]):
9595
res = await server.coze.bots.list(space_id=str(workspace_id))
9696
return res.items
9797

9898

9999
@mcp.tool(description="retrieve bot")
100-
async def retrieve_bot(bot_id: int | str) -> Bot:
100+
async def retrieve_bot(bot_id: Union[int, str]) -> Bot:
101101
return await server.coze.bots.retrieve(bot_id=str(bot_id))
102102

103103

104104
@mcp.tool(description="create bot in workspaces")
105105
async def create_bot(
106-
workspace_id: int | str,
106+
workspace_id: Union[int, str],
107107
name: str,
108-
description: str | None = None,
109-
prompt: str | None = None,
108+
description: Optional[str] = None,
109+
prompt: Optional[str] = None,
110110
) -> Bot:
111111
return await server.coze.bots.create(
112112
space_id=str(workspace_id),
@@ -118,10 +118,10 @@ async def create_bot(
118118

119119
@mcp.tool(description="update bot info")
120120
async def update_bot(
121-
bot_id: int | str,
122-
name: str | None = None,
123-
description: str | None = None,
124-
prompt: str | None = None,
121+
bot_id: Union[int, str],
122+
name: Optional[str] = None,
123+
description: Optional[str] = None,
124+
prompt: Optional[str] = None,
125125
):
126126
await server.coze.bots.update(
127127
bot_id=str(bot_id),
@@ -132,15 +132,15 @@ async def update_bot(
132132

133133

134134
@mcp.tool(description="publish bot info")
135-
async def publish_bot(bot_id: int | str) -> Bot:
135+
async def publish_bot(bot_id: Union[int, str]) -> Bot:
136136
return await server.coze.bots.publish(
137137
bot_id=str(bot_id),
138138
)
139139

140140

141141
@mcp.tool(description="chat with bot")
142142
async def chat_with_bot(
143-
bot_id: int | str,
143+
bot_id: Union[int, str],
144144
content: str,
145145
) -> str:
146146
return await server.bot_chat(
@@ -151,8 +151,8 @@ async def chat_with_bot(
151151

152152
@mcp.tool(description="chat with bot")
153153
async def chat_with_workflow(
154-
bot_id: int | str,
155-
workflow_id: int | str,
154+
bot_id: Union[int, str],
155+
workflow_id: Union[int, str],
156156
content: str,
157157
) -> str:
158158
return await server.workflow_chat(

uv.lock

Lines changed: 1 addition & 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)