Commit Graph

6 Commits

Author SHA1 Message Date
hanishkvc e9dbe21c67 SimpleSallap:SimpleMCP:Cleanup initial go by running and seeing
As expected dataclass field member mutable default values needing
default_factory.

Dont forget returning after sending error response.

TypeAlias type hinting flow seems to go beyond TYPE_CHECKING.
Also email.message.Message[str,str] not accepted, so keep things
simple wrt HttpHeaders for now.
2025-12-07 03:19:22 +05:30
hanishkvc fac947f9cd SimpleSallap:SimpleMCP:tools/list
Fix a oversight wrt ToolManager.meta, where I had created a dict
of name-keyed toolcall metas, instead of a simple list of toolcall
metas. Rather I blindly duplicated structure I used for storing the
tool calls in the tc_switch in the anveshika sallap client side
code.

Add dataclasses to mimic the MCP tools/list response. However wrt
the 2 odd differences between the MCP structure and OpenAi tools
handshake structure, for now I have retained the OpenAi tools hs
structure.

Add a common helper send_mcp to ProxyHandler given that both
mcp_toolscall and mcp_toolslist and even others like mcp_initialise
in future require a common response mechanism.

With above and bit more implement initial go at tools/list response.
2025-12-07 00:29:37 +05:30
hanishkvc 69be7f2029 SimpleSallap:SimpleMCP: Use ToolManager for some of needed logics
Build the list of tool calls

Trap some of the MCP post json based requests and map to related
handlers. Inturn implement the tool call execution handler.

Add some helper dataclasses wrt expected MCP response structure

TOTHINK: For now maintain id has a string and not int, with idea
to map it directly to callid wrt tool call handshake by ai model.

TOCHECK: For now suffle the order of fields wrt jsonrpc and type
wrt MCP response related structures, assuming the order shouldnt
matter. Need to cross check.
2025-12-06 23:48:58 +05:30
hanishkvc 8700d522a5 SimpleSallap:SimpleMCP:ToolCalls beyond initial go
Define a typealias for HttpHeaders and use it where ever needed.
Inturn map this to email.message.Message and dict for now.
If and when python evolves Http Headers type into better one,
need to replace in only one place.

Add a ToolManager class which
* maintains the list of tool calls and inturn allows any given
  tool call to be executed and response returned along with needed
  meta data
* generate the overall tool calls meta data
* add ToolCallResponseEx which maintains full TCOutResponse for
  use by tc_handle callers

Avoid duplicating handling of some of the basic needed http header
entries.

Move checking for any dependencies before enabling a tool call into
respective tc??? module.
* for now this also demotes the logic from the previous fine grained
  per tool call based dependency check to a more global dep check at
  the respective module level
2025-12-06 22:38:10 +05:30
hanishkvc 47bd2bbc90 SimpleSallap:SimpleMCP:Update toolcall to suite calls needed 2025-12-06 01:47:38 +05:30
hanishkvc 452e610095 SimpleSallap:SimpleMCP:Skeletons for a toolcall class 2025-12-06 00:48:48 +05:30