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:
cybermaggedon 2025-07-08 16:19:19 +01:00 committed by GitHub
parent e56186054a
commit 9c7a070681
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 2718 additions and 9 deletions

View file

@ -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 [

View file

@ -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
}