refactor: simplify identifiers parameter in create_customer and update Docker config

This commit is contained in:
2026-03-18 22:41:02 -05:00
parent 89f95d2015
commit e78a8007c7
5 changed files with 24 additions and 7 deletions

View File

@@ -9,9 +9,10 @@ RUN pip install --no-cache-dir uv
COPY pyproject.toml uv.lock ./
COPY src/ ./src/
RUN uv sync --frozen --no-dev
RUN uv pip install --editable .
EXPOSE 3001
CMD ["uv", "run", "fastmcp", "run", "./src/tryton_mcp/server.py", "--transport", "http", "--host", "0.0.0.0", "--port", "3001"]
CMD ["uv", "run", "fastmcp", "run", "./src/tryton_mcp/server.py", "--reload"]

View File

@@ -5,7 +5,14 @@ services:
dockerfile: Dockerfile
ports:
- "3001:3001"
volumes:
- ./src:/app/src
env_file:
- .env
environment:
- FASTMCP_HOST=0.0.0.0
- FASTMCP_TRANSPORT=http
- FASTMCP_PORT=3001
volumes:
src:

View File

@@ -29,4 +29,4 @@ dev = [
]
[tool.taskipy.tasks]
start = "fastmcp run ./src/tryton_mcp/server.py --transport http --port 3001 --reload"
start = "fastmcp run src/tryton_mcp/server.py --transport 'http' --host 0.0.0.0 --port 3001 --reload"

View File

@@ -45,8 +45,8 @@ class FindCustomerInput(BaseModel):
class CreateCustomerInput(BaseModel):
name: str = Field(min_length=1, description="Customer name")
identifiers: List[tuple[str, List[Dict[str, Any]]]] = Field(
default_factory=list, description="List of identifier tuples"
identifiers: dict = Field(
default_factory=dict
)
@@ -96,7 +96,7 @@ def find_customer_by_identifier(identifier: str) -> List[Dict]:
@mcp.tool()
def create_customer(
name: str, identifiers: List[tuple[str, List[Dict[str, Any]]]]
name: str, identifiers: dict
) -> List[int]:
CreateCustomerInput(name=name, identifiers=identifiers)

View File

@@ -18,11 +18,20 @@ class PartyService(BaseService):
)
def create(
self, name: str, identifiers: List[tuple[str, List[Dict[str, Any]]]]
self, name: str, identifiers: dict
) -> TrytonResponse:
identifiers = [
'create', [
{
"type": identifiers.get('type', 'mobile'),
"code": identifiers.get('code')
}
]]
return self.call(
"model.party.party.create",
[{"name": name, "identifiers": identifiers}, {}],
[[{"name": name, "identifiers": [identifiers]}], {}],
)
def search_parties(