From 631aa7fb36d58e154c59e93c437be285fcc28afb Mon Sep 17 00:00:00 2001 From: hanishkvc Date: Sun, 7 Dec 2025 22:39:21 +0530 Subject: [PATCH] SimpleSallap:SimpleMCP/ToolMCP: bring in wrt tools manager Setup to test initial go of the mcpish server and client logics --- tools/server/public_simplechat/docs/changelog.md | 13 +++++++++++-- tools/server/public_simplechat/toolmcp.mjs | 4 ++-- tools/server/public_simplechat/tools.mjs | 8 ++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tools/server/public_simplechat/docs/changelog.md b/tools/server/public_simplechat/docs/changelog.md index 8cd4e121eb..805c76a21d 100644 --- a/tools/server/public_simplechat/docs/changelog.md +++ b/tools/server/public_simplechat/docs/changelog.md @@ -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 diff --git a/tools/server/public_simplechat/toolmcp.mjs b/tools/server/public_simplechat/toolmcp.mjs index b034d03c4b..689bab457f 100644 --- a/tools/server/public_simplechat/toolmcp.mjs +++ b/tools/server/public_simplechat/toolmcp.mjs @@ -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, diff --git a/tools/server/public_simplechat/tools.mjs b/tools/server/public_simplechat/tools.mjs index bee4561e2c..2786807194 100644 --- a/tools/server/public_simplechat/tools.mjs +++ b/tools/server/public_simplechat/tools.mjs @@ -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) + } + }) } /**