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:
parent
00adebe208
commit
631aa7fb36
|
|
@ -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++
|
* 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.
|
* 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.
|
* 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
|
* Initial skeleton towards SimpleMCP, a mcpish server, which uses post and json rpcish based handshake flow,
|
||||||
through SimpleProxy can be exposed through a MCP standardish mechanism.
|
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 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.
|
* 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/list implemented and verified at a basic level
|
||||||
Mcp command tools/call implemented, need to verify and update the initial go version
|
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
|
## ToDo
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ async function mcpserver_toolslist(tag, chatId, tcs) {
|
||||||
body: JSON.stringify(ibody),
|
body: JSON.stringify(ibody),
|
||||||
});
|
});
|
||||||
if (resp.status != 200) {
|
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
|
return
|
||||||
}
|
}
|
||||||
let obody = await resp.json()
|
let obody = await resp.json()
|
||||||
|
|
@ -126,7 +126,7 @@ async function mcpserver_toolslist(tag, chatId, tcs) {
|
||||||
if (!tcmeta.function) {
|
if (!tcmeta.function) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
console.log`INFO:${tag}:ToolsList:${tcmeta.function.name}`
|
console.log(`INFO:${tag}:ToolsList:${tcmeta.function.name}`)
|
||||||
tcs[tcmeta.function.name] = {
|
tcs[tcmeta.function.name] = {
|
||||||
"handler": mcpserver_toolcall,
|
"handler": mcpserver_toolcall,
|
||||||
"meta": tcmeta,
|
"meta": tcmeta,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
import * as tjs from './tooljs.mjs'
|
import * as tjs from './tooljs.mjs'
|
||||||
import * as tweb from './toolweb.mjs'
|
import * as tweb from './toolweb.mjs'
|
||||||
|
import * as tmcp from './toolmcp.mjs'
|
||||||
import * as tdb from './tooldb.mjs'
|
import * as tdb from './tooldb.mjs'
|
||||||
import * as tai from './toolai.mjs'
|
import * as tai from './toolai.mjs'
|
||||||
import * as mChatMagic from './simplechat.js'
|
import * as mChatMagic from './simplechat.js'
|
||||||
|
|
@ -56,6 +57,7 @@ export class ToolsManager {
|
||||||
tcM.push(tdb.init(me))
|
tcM.push(tdb.init(me))
|
||||||
tcM.push(tai.init(me))
|
tcM.push(tai.init(me))
|
||||||
tcM.push(tweb.init(me))
|
tcM.push(tweb.init(me))
|
||||||
|
tcM.push(tmcp.init(me))
|
||||||
return Promise.all(tcM)
|
return Promise.all(tcM)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,6 +100,12 @@ export class ToolsManager {
|
||||||
chat.cfg.tools.toolNames.push(key)
|
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)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue