fenix-mcp 0.5.7__py3-none-any.whl → 0.5.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fenix_mcp/__init__.py CHANGED
@@ -8,4 +8,4 @@ Fênix Cloud MCP Server (Python edition).
8
8
  __all__ = ["__version__"]
9
9
 
10
10
 
11
- __version__ = "0.5.7"
11
+ __version__ = "0.5.9"
@@ -6,7 +6,7 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any, Dict, List, Optional
8
8
 
9
- from pydantic import Field
9
+ from pydantic import Field, field_validator
10
10
 
11
11
  from fenix_mcp.application.presenters import text
12
12
  from fenix_mcp.application.tool_base import Tool, ToolRequest
@@ -83,7 +83,40 @@ class IntelligenceRequest(ToolRequest):
83
83
  default=False,
84
84
  description="Retornar metadata completa das memórias? Defina true para incluir o campo bruto.",
85
85
  )
86
- tags: Optional[List[str]] = Field(default=None, description="Tags da memória.")
86
+ tags: Optional[List[str]] = Field(
87
+ default=None,
88
+ description="Tags da memória como array JSON de strings.",
89
+ json_schema_extra={"example": ["tag1", "tag2", "tag3"]},
90
+ )
91
+
92
+ @field_validator("tags", mode="before")
93
+ @classmethod
94
+ def validate_tags(cls, v: Any) -> Optional[List[str]]:
95
+ """Validate and normalize tags field."""
96
+ if v is None or v == "":
97
+ return None
98
+
99
+ # If it's already a list, return as is
100
+ if isinstance(v, (list, tuple, set)):
101
+ return [str(item).strip() for item in v if str(item).strip()]
102
+
103
+ # If it's a string, try to parse as JSON
104
+ if isinstance(v, str):
105
+ try:
106
+ import json
107
+
108
+ parsed = json.loads(v)
109
+ if isinstance(parsed, list):
110
+ return [str(item).strip() for item in parsed if str(item).strip()]
111
+ except (json.JSONDecodeError, TypeError):
112
+ pass
113
+
114
+ # If JSON parsing fails, treat as comma-separated string
115
+ return [item.strip() for item in v.split(",") if item.strip()]
116
+
117
+ # For any other type, convert to string and wrap in list
118
+ return [str(v).strip()] if str(v).strip() else None
119
+
87
120
  limit: int = Field(default=20, ge=1, le=100, description="Limite de resultados.")
88
121
  offset: int = Field(default=0, ge=0, description="Offset para paginação.")
89
122
  query: Optional[str] = Field(default=None, description="Termo de busca.")
@@ -342,6 +375,17 @@ def _ensure_tag_sequence(raw: Optional[Any]) -> Optional[List[str]]:
342
375
  result = [str(item).strip() for item in raw if str(item).strip()]
343
376
  return result or None
344
377
  if isinstance(raw, str):
378
+ # Try to parse as JSON array first
379
+ try:
380
+ import json
381
+
382
+ parsed = json.loads(raw)
383
+ if isinstance(parsed, list):
384
+ result = [str(item).strip() for item in parsed if str(item).strip()]
385
+ return result or None
386
+ except (json.JSONDecodeError, TypeError):
387
+ pass
388
+
345
389
  raise ValueError(
346
390
  "O campo `tags` deve ser enviado como array JSON, por exemplo: "
347
391
  '["tag1", "tag2"].'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fenix-mcp
3
- Version: 0.5.7
3
+ Version: 0.5.9
4
4
  Summary: Fênix Cloud MCP server implemented in Python
5
5
  Author: Fenix Inc
6
6
  Requires-Python: >=3.10
@@ -1,4 +1,4 @@
1
- fenix_mcp/__init__.py,sha256=Qi1wiiPapwJ_vgEtVqDYN13mhpWUaNqtkUJsEOkN2Ug,180
1
+ fenix_mcp/__init__.py,sha256=CK5DDNwwAvRETZa1HP55z98Zpxbo2AnC05_u4xeEtyU,180
2
2
  fenix_mcp/main.py,sha256=iJV-9btNMDJMObvcn7wBQdbLLKjkYCQ1ANGEwHGHlMU,2857
3
3
  fenix_mcp/application/presenters.py,sha256=fGME54PdCDhTBhXO-JUB9yLdBHiE1aeXLTC2fCuxnxM,689
4
4
  fenix_mcp/application/tool_base.py,sha256=qUcb46qx9gHQfrSHgj4RD4NCHW-OIvKQdR5G9uxZ5l4,1316
@@ -6,7 +6,7 @@ fenix_mcp/application/tool_registry.py,sha256=bPT5g8GfxG_qu28R1WaDOZHvtmG6TPDvZi
6
6
  fenix_mcp/application/tools/__init__.py,sha256=Gi1YvYh-KdL9HD8gLVrknHrxiKKEOhHBEZ02KBXJaKQ,796
7
7
  fenix_mcp/application/tools/health.py,sha256=m5DxhoRbdwl6INzd6PISxv1NAv-ljCrezsr773VB0wE,834
8
8
  fenix_mcp/application/tools/initialize.py,sha256=f33DNDn9u8IYwpqiBj6bjJ-wHgaUP1zEuAvUM1rMYPc,4674
9
- fenix_mcp/application/tools/intelligence.py,sha256=rwQzBVq9nE4tIzdLuu7HPXnr3OX3n47OShN-05ZjNZg,14605
9
+ fenix_mcp/application/tools/intelligence.py,sha256=icvkHQlFbFHXaSbGIpWfdWqkdJPxcgkaUaggGKOekRE,16127
10
10
  fenix_mcp/application/tools/knowledge.py,sha256=4ClGoFRqyFIPuzzg2DAg-w2eMvTP37mH0THXDGftinw,44634
11
11
  fenix_mcp/application/tools/productivity.py,sha256=2IMkNdZ-Kd1CFAO7geruAVjtf_BWoDdbnwkl76vhtC8,9973
12
12
  fenix_mcp/application/tools/user_config.py,sha256=8mPOZuwszO0TapxgrA7Foe15VQE874_mvfQYlGzyv4Y,6230
@@ -22,8 +22,8 @@ fenix_mcp/infrastructure/logging.py,sha256=bHrWlSi_0HshRe3--BK_5nzUszW-gh37q6jsd
22
22
  fenix_mcp/infrastructure/fenix_api/client.py,sha256=Navi7cGAOradghcbYkFIQQINpjFrdINlNhdfZ4iSSYQ,28338
23
23
  fenix_mcp/interface/mcp_server.py,sha256=5UM2NJuNbwHkmCEprIFataJ5nFZiO8efTtP_oW3_iX0,2331
24
24
  fenix_mcp/interface/transports.py,sha256=PxdhfjH8UMl03f7nuCLc-M6tMx6-Y-btVz_mSqXKrSI,8138
25
- fenix_mcp-0.5.7.dist-info/METADATA,sha256=fADlVEpBStpboe2N24s8MQzXhnnY_4Syen-sQJKrGg4,7260
26
- fenix_mcp-0.5.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
- fenix_mcp-0.5.7.dist-info/entry_points.txt,sha256=o52x_YHBupEd-1Z1GSfUjv3gJrx5_I-EkHhCgt1WBaE,49
28
- fenix_mcp-0.5.7.dist-info/top_level.txt,sha256=2G1UtKpwjaIGQyE7sRoHecxaGLeuexfjrOUjv9DDKh4,10
29
- fenix_mcp-0.5.7.dist-info/RECORD,,
25
+ fenix_mcp-0.5.9.dist-info/METADATA,sha256=uIe_ye61k3BveJgoREnhacWylYHZgQgoYVz3oBWqHT0,7260
26
+ fenix_mcp-0.5.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ fenix_mcp-0.5.9.dist-info/entry_points.txt,sha256=o52x_YHBupEd-1Z1GSfUjv3gJrx5_I-EkHhCgt1WBaE,49
28
+ fenix_mcp-0.5.9.dist-info/top_level.txt,sha256=2G1UtKpwjaIGQyE7sRoHecxaGLeuexfjrOUjv9DDKh4,10
29
+ fenix_mcp-0.5.9.dist-info/RECORD,,