mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-26 08:56:21 +02:00
Feature/react call mcp (#428)
Key Features - MCP Tool Integration: Added core MCP tool support with ToolClientSpec and ToolClient classes - API Enhancement: New mcp_tool method for flow-specific tool invocation - CLI Tooling: New tg-invoke-mcp-tool command for testing MCP integration - React Agent Enhancement: Fixed and improved multi-tool invocation capabilities - Tool Management: Enhanced CLI for tool configuration and management Changes - Added MCP tool invocation to API with flow-specific integration - Implemented ToolClientSpec and ToolClient for tool call handling - Updated agent-manager-react to invoke MCP tools with configurable types - Enhanced CLI with new commands and improved help text - Added comprehensive documentation for new CLI commands - Improved tool configuration management Testing - Added tg-invoke-mcp-tool CLI command for isolated MCP integration testing - Enhanced agent capability to invoke multiple tools simultaneously
This commit is contained in:
parent
e56186054a
commit
9c7a070681
22 changed files with 2718 additions and 9 deletions
|
|
@ -49,6 +49,19 @@ class Config:
|
|||
|
||||
self.request(input)
|
||||
|
||||
def delete(self, keys):
|
||||
|
||||
# The input consists of system and prompt strings
|
||||
input = {
|
||||
"operation": "delete",
|
||||
"keys": [
|
||||
{ "type": v.type, "key": v.key }
|
||||
for v in keys
|
||||
]
|
||||
}
|
||||
|
||||
self.request(input)
|
||||
|
||||
def list(self, type):
|
||||
|
||||
# The input consists of system and prompt strings
|
||||
|
|
@ -67,7 +80,7 @@ class Config:
|
|||
"type": type,
|
||||
}
|
||||
|
||||
object = self.request(input)["directory"]
|
||||
object = self.request(input)
|
||||
|
||||
try:
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import base64
|
|||
|
||||
from .. knowledge import hash, Uri, Literal
|
||||
from . types import Triple
|
||||
from . exceptions import ProtocolException
|
||||
|
||||
def to_value(x):
|
||||
if x["e"]: return Uri(x["v"])
|
||||
|
|
@ -197,7 +198,6 @@ class FlowInstance:
|
|||
|
||||
def prompt(self, id, variables):
|
||||
|
||||
# The input consists of system and prompt strings
|
||||
input = {
|
||||
"id": id,
|
||||
"variables": variables
|
||||
|
|
@ -221,12 +221,37 @@ class FlowInstance:
|
|||
|
||||
raise ProtocolException("Response not formatted correctly")
|
||||
|
||||
def mcp_tool(self, name, parameters={}):
|
||||
|
||||
# The input consists of name and parameters
|
||||
input = {
|
||||
"name": name,
|
||||
"parameters": parameters,
|
||||
}
|
||||
|
||||
object = self.request(
|
||||
"service/mcp-tool",
|
||||
input
|
||||
)
|
||||
|
||||
if "text" in object:
|
||||
return object["text"]
|
||||
|
||||
if "object" in object:
|
||||
try:
|
||||
return object["object"]
|
||||
except Exception as e:
|
||||
raise ProtocolException(
|
||||
"Returned object not well-formed JSON"
|
||||
)
|
||||
|
||||
raise ProtocolException("Response not formatted correctly")
|
||||
|
||||
def triples_query(
|
||||
self, s=None, p=None, o=None,
|
||||
user=None, collection=None, limit=10000
|
||||
):
|
||||
|
||||
# The input consists of system and prompt strings
|
||||
input = {
|
||||
"limit": limit
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue