feat: add MCP tool integration
This commit is contained in:
@@ -207,15 +207,55 @@ class AssistantModelBinding(Base):
|
||||
)
|
||||
|
||||
|
||||
class McpServer(Base):
|
||||
"""Workspace-level remote MCP connection used to discover executable tools."""
|
||||
|
||||
__tablename__ = "mcp_servers"
|
||||
|
||||
id: Mapped[str] = mapped_column(String(40), primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(128))
|
||||
description: Mapped[str] = mapped_column(String(2048), default="")
|
||||
transport: Mapped[str] = mapped_column(String(32), default="streamable_http")
|
||||
url: Mapped[str] = mapped_column(String(2048))
|
||||
config: Mapped[dict] = mapped_column(JSONB, default=dict)
|
||||
secrets: Mapped[dict] = mapped_column(JSONB, default=dict)
|
||||
status: Mapped[str] = mapped_column(String(16), index=True, default="active")
|
||||
last_synced_at: Mapped[datetime | None] = mapped_column(
|
||||
DateTime(timezone=True), nullable=True
|
||||
)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now()
|
||||
)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
|
||||
|
||||
class Tool(Base):
|
||||
"""Reusable LLM tool definition; supported types are executed at runtime."""
|
||||
|
||||
__tablename__ = "tools"
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"mcp_server_id",
|
||||
"remote_tool_name",
|
||||
name="uq_tools_mcp_server_remote_name",
|
||||
),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String(40), primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(128))
|
||||
function_name: Mapped[str] = mapped_column(String(64), unique=True, index=True)
|
||||
type: Mapped[str] = mapped_column(String(24), index=True)
|
||||
mcp_server_id: Mapped[str | None] = mapped_column(
|
||||
String(40),
|
||||
ForeignKey("mcp_servers.id", ondelete="CASCADE"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
remote_tool_name: Mapped[str | None] = mapped_column(
|
||||
String(255), nullable=True
|
||||
)
|
||||
description: Mapped[str] = mapped_column(String(2048), default="")
|
||||
definition: Mapped[dict] = mapped_column(JSONB, default=dict)
|
||||
secrets: Mapped[dict] = mapped_column(JSONB, default=dict)
|
||||
|
||||
Reference in New Issue
Block a user