kensho-kfinance 3.2.2__py3-none-any.whl → 3.2.3__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.

Potentially problematic release.


This version of kensho-kfinance might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kensho-kfinance
3
- Version: 3.2.2
3
+ Version: 3.2.3
4
4
  Summary: Python CLI for kFinance
5
5
  Author-email: Luke Brown <luke.brown@kensho.com>, Michelle Keoy <michelle.keoy@kensho.com>, Keith Page <keith.page@kensho.com>, Matthew Rosen <matthew.rosen@kensho.com>, Nick Roshdieh <nick.roshdieh@kensho.com>
6
6
  Project-URL: source, https://github.com/kensho-technologies/kfinance
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  License-File: AUTHORS.md
15
15
  Requires-Dist: cachetools<6,>=5.5
16
16
  Requires-Dist: click<=9,>=8.2.1
17
- Requires-Dist: fastmcp<2.10,>=2.9
17
+ Requires-Dist: fastmcp>=2.11
18
18
  Requires-Dist: langchain-core>=0.3.15
19
19
  Requires-Dist: langchain-google-genai<3,>=2.1.5
20
20
  Requires-Dist: numpy>=1.22.4
@@ -1,11 +1,11 @@
1
- kensho_kfinance-3.2.2.dist-info/licenses/AUTHORS.md,sha256=0h9ClbI0pu1oKj1M28ROUsaxrbZg-6ukQGl6X4y9noI,68
2
- kensho_kfinance-3.2.2.dist-info/licenses/LICENSE,sha256=bsY4blvSgq6o0FMQ3RXa2NCgco--nHCCchLXzxr6kms,83
3
- kfinance/CHANGELOG.md,sha256=_D8_h3638ZDOFte4LFE7HlksVYzfrZh6ejCDOYPvYSM,2780
1
+ kensho_kfinance-3.2.3.dist-info/licenses/AUTHORS.md,sha256=0h9ClbI0pu1oKj1M28ROUsaxrbZg-6ukQGl6X4y9noI,68
2
+ kensho_kfinance-3.2.3.dist-info/licenses/LICENSE,sha256=bsY4blvSgq6o0FMQ3RXa2NCgco--nHCCchLXzxr6kms,83
3
+ kfinance/CHANGELOG.md,sha256=DVWdxUssDxF0aqYQZwHmHEuG03gLFCJ4MVQU5JSbaMc,2836
4
4
  kfinance/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
5
5
  kfinance/conftest.py,sha256=O9e1ddyTfqnZ1T-9ehnkXwK8PfxPdCHAI7-fke52Ouk,3281
6
6
  kfinance/mcp.py,sha256=LTzCIlqsDKRD-0Xcpa_P99-JmJ8duAneO_-GzM43kjw,424
7
7
  kfinance/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- kfinance/version.py,sha256=VfQFwh2Vyb8ry8WT1y6VfXFKIN0E2GC1aed16irkCFQ,511
8
+ kfinance/version.py,sha256=TNj-kvOWGvYoPhrgqpaiE88yQqMnl_5-Khjy6DXZyxo,704
9
9
  kfinance/client/README.md,sha256=DA5vg4uz1JmJNiqvYywrj46YNhOr584WO8L83Ysx_Mk,372
10
10
  kfinance/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  kfinance/client/batch_request_handling.py,sha256=opwJJAU2JtqH-s4vt8wRqhH34MiU4tQP6Ng7K6b3upA,6561
@@ -89,7 +89,8 @@ kfinance/domains/statements/tests/test_statement_tools.py,sha256=E-wIgnCF1946odD
89
89
  kfinance/integrations/README.md,sha256=GalSN11UHzbLfcNzKAlObNbw5XqMKVXSVzzGlryM3zc,320
90
90
  kfinance/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
91
  kfinance/integrations/local_mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
- kfinance/integrations/local_mcp/local_mcp.py,sha256=9Wja-FvXZ-zK9iNRJmma3nGZ1r2VhRU1cVTxZ6BGLeE,3729
92
+ kfinance/integrations/local_mcp/kfinance_mcp.py,sha256=UxnRq5f7PF-dVZrUyH2TpBxVdKb7RbLP64AuD1kcy-E,1099
93
+ kfinance/integrations/local_mcp/local_mcp.py,sha256=x2pCV7kFaEJZCHTlbudrByYb8RQX2gjGTD5UPzvhdmA,3778
93
94
  kfinance/integrations/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
95
  kfinance/integrations/tests/test_example_notebook.py,sha256=NrqYFn_XyOn0YlV9QYEnNMBB7LEkg70pP1eqiLGxcBE,6529
95
96
  kfinance/integrations/tool_calling/README.md,sha256=TSk-AJddoEctzc0HXQvGNac2CckbnWxHcRDtEifSe1w,2029
@@ -107,7 +108,7 @@ kfinance/integrations/tool_calling/static_tools/tests/test_get_n_quarters_ago.py
107
108
  kfinance/integrations/tool_calling/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
109
  kfinance/integrations/tool_calling/tests/test_tool_calling_models.py,sha256=Ts1pvaYjq9BTR71dMZ73X__bQ7gQynPkQjy-9x2CuyQ,2605
109
110
  kfinance/models/permission_models.py,sha256=G0so8ZOsD1YDsCM4he0z5R9M_shUbSRwD3hUDJdqZl0,635
110
- kensho_kfinance-3.2.2.dist-info/METADATA,sha256=kibQ6NGUyWbI-kiZl7qQgn-XIfTYdmZPy8MoKV6og_o,6202
111
- kensho_kfinance-3.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
112
- kensho_kfinance-3.2.2.dist-info/top_level.txt,sha256=kT_kNwVhfQoOAecY8W7uYah5xaHMoHoAdBIvXh6DaKM,9
113
- kensho_kfinance-3.2.2.dist-info/RECORD,,
111
+ kensho_kfinance-3.2.3.dist-info/METADATA,sha256=xovbKJI3SJnJUr_Us2zsKJ3bUDo3rgiMHOG8zJUQrhY,6197
112
+ kensho_kfinance-3.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
113
+ kensho_kfinance-3.2.3.dist-info/top_level.txt,sha256=kT_kNwVhfQoOAecY8W7uYah5xaHMoHoAdBIvXh6DaKM,9
114
+ kensho_kfinance-3.2.3.dist-info/RECORD,,
kfinance/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.2.3
4
+ - Disable low level MCP SDK input validation
5
+
3
6
  ## v3.2.2
4
7
  - Use ValidQuarter for statement and line item tools
5
8
 
@@ -0,0 +1,22 @@
1
+ from fastmcp import FastMCP
2
+
3
+
4
+ class KfinanceMcp(FastMCP):
5
+ """FastMCP subclass with some kfinance specific adaptations."""
6
+
7
+ def _setup_handlers(self) -> None:
8
+ """Skip low level input validation for tool calls.
9
+
10
+ We do validate inputs as part of KfinanceTool.run_without_langchain.
11
+ However, the mcp python sdk recently added its own low-level validation:
12
+ github.com/modelcontextprotocol/python-sdk/commit/c8bbfc034d5cb876d6b91185cf02da2af6fb8b44
13
+ This causes problems because claude always returns integer values as strings if
14
+ they are part of a field that allows multiple types. e.g. `start_year: int | None`
15
+ -> Claude will always return strings. This is fine for pydantic, it automatically
16
+ converts the strings to integers.
17
+ However, the mcp sdk validation is stricter and disallows strings where ints are
18
+ required.
19
+ call_tool(validate_input=False) turns off the mcp sdk validation.
20
+ """
21
+ super()._setup_handlers()
22
+ self._mcp_server.call_tool(validate_input=False)(self._mcp_call_tool)
@@ -1,12 +1,12 @@
1
1
  from typing import Literal, Optional
2
2
 
3
3
  import click
4
- from fastmcp import FastMCP
5
4
  from fastmcp.tools import FunctionTool
6
5
  from fastmcp.utilities.logging import get_logger
7
6
  from langchain_core.utils.function_calling import convert_to_openai_tool
8
7
 
9
8
  from kfinance.client.kfinance import Client
9
+ from kfinance.integrations.local_mcp.kfinance_mcp import KfinanceMcp
10
10
  from kfinance.integrations.tool_calling.tool_calling_models import KfinanceTool
11
11
 
12
12
 
@@ -76,7 +76,7 @@ def run_mcp(
76
76
  logger.info("The client will be authenticated using a browser")
77
77
  kfinance_client = Client()
78
78
 
79
- kfinance_mcp: FastMCP = FastMCP("Kfinance")
79
+ kfinance_mcp: KfinanceMcp = KfinanceMcp("Kfinance")
80
80
  for langchain_tool in kfinance_client.langchain_tools:
81
81
  logger.info("Adding %s to server", langchain_tool.name)
82
82
  kfinance_mcp.add_tool(build_mcp_tool_from_kfinance_tool(langchain_tool))
kfinance/version.py CHANGED
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '3.2.2'
21
- __version_tuple__ = version_tuple = (3, 2, 2)
31
+ __version__ = version = '3.2.3'
32
+ __version_tuple__ = version_tuple = (3, 2, 3)
33
+
34
+ __commit_id__ = commit_id = None