SimpleSallap:SimpleMCP/ToolMCP: bring in wrt tools manager

Setup to test initial go of the mcpish server and client logics
This commit is contained in:
hanishkvc 2025-12-07 22:39:21 +05:30
parent 00adebe208
commit 631aa7fb36
3 changed files with 21 additions and 4 deletions

View File

@ -319,12 +319,21 @@ Chat Session specific settings
* switch to a Dicty DataClass based Config with better type validation and usage, instead of literal dict++
* ToolCall, ToolManager and related classes based flow wrt the tool calls.
* all existing tool calls duplicated and updated to support and build on this new flow.
* Initial skeleton towards SimpleMCP, a post and json rpcish based handshake flow, so that tool calls supported
through SimpleProxy can be exposed through a MCP standardish mechanism.
* Initial skeleton towards SimpleMCP, a mcpish server, which uses post and json rpcish based handshake flow,
so that tool calls supported through SimpleProxy can be exposed through a MCP standardish mechanism.
* can allow others beyond AnveshikaSallap client to use the corresponding tool calls
* can allow AnveshikaSallap client to support other MCP servers and their exposed tool calls in future.
Mcp command tools/list implemented and verified at a basic level
Mcp command tools/call implemented, need to verify and update the initial go version
* Initial skeleton towards ToolMCP, a mcpish client logic
Mcp command tools/list handshake implemented, need to verify and update this initial go
Mcp command tools/call handshake implemented, need to verify and update this initial go
* MCPish and not full fledged MCP currently
* no initialise command handshake
* use seconds since unix epoch or toolcall id, as the case maybe, as the id wrt json-rpc calls
* the tools/list response mirrors the openai rest api convention rather than mcp convention
* uses the additional type: function wrapper wrt tool call meta
* uses the keyword parameters instead of inputschema or so
## ToDo

View File

@ -117,7 +117,7 @@ async function mcpserver_toolslist(tag, chatId, tcs) {
body: JSON.stringify(ibody),
});
if (resp.status != 200) {
console.log`WARN:${tag}:ToolsList:MCP server says:${resp.status}:${resp.statusText}`
console.log(`WARN:${tag}:ToolsList:MCP server says:${resp.status}:${resp.statusText}`)
return
}
let obody = await resp.json()
@ -126,7 +126,7 @@ async function mcpserver_toolslist(tag, chatId, tcs) {
if (!tcmeta.function) {
continue
}
console.log`INFO:${tag}:ToolsList:${tcmeta.function.name}`
console.log(`INFO:${tag}:ToolsList:${tcmeta.function.name}`)
tcs[tcmeta.function.name] = {
"handler": mcpserver_toolcall,
"meta": tcmeta,

View File

@ -7,6 +7,7 @@
import * as tjs from './tooljs.mjs'
import * as tweb from './toolweb.mjs'
import * as tmcp from './toolmcp.mjs'
import * as tdb from './tooldb.mjs'
import * as tai from './toolai.mjs'
import * as mChatMagic from './simplechat.js'
@ -56,6 +57,7 @@ export class ToolsManager {
tcM.push(tdb.init(me))
tcM.push(tai.init(me))
tcM.push(tweb.init(me))
tcM.push(tmcp.init(me))
return Promise.all(tcM)
}
@ -98,6 +100,12 @@ export class ToolsManager {
chat.cfg.tools.toolNames.push(key)
}
})
await tmcp.setup(chatId).then((tcs)=>{
for (const key in tcs) {
this.tc_switchs[chatId][key] = tcs[key]
chat.cfg.tools.toolNames.push(key)
}
})
}
/**