Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

chore: add description in connector form (#275)

sayan-truefoundryfa81267e9ef3
diff --git a/packages/trueforge-ui-sdk/example/src/App.tsx b/packages/trueforge-ui-sdk/example/src/App.tsx
index d961a844c..433e7708f 100644
--- a/packages/trueforge-ui-sdk/example/src/App.tsx
+++ b/packages/trueforge-ui-sdk/example/src/App.tsx
@@ -147,10 +147,13 @@ const emptyCatalog: CatalogServer = {
getToolsByConnectorId: async () => [],
createConnector: async req => {
const catalogEntry = exampleConnectorCatalog.find(entry => entry.url === req.url);
+ const requestDescription =
+ 'description' in req && typeof req.description === 'string' ? req.description.trim() : '';
const connector: ConnectorBase = {
id: catalogEntry?.id ?? `connector-${Date.now()}`,
name: req.name,
- description: catalogEntry?.description ?? 'Custom MCP server.',
+ description:
+ requestDescription !== '' ? requestDescription : (catalogEntry?.description ?? 'Custom MCP server.'),
url: req.url,
auth: toPublicAuth(req.auth),
requiresAuth: req.auth.type === 'dcr',
diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/AddMcpServerForm.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/AddMcpServerForm.tsx
index 90589b874..f4dafbf3b 100644
--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/AddMcpServerForm.tsx
+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/AddMcpServerForm.tsx
@@ -13,6 +13,7 @@ export type McpAuthType = ConnectorAuthType;
export type AddMcpServerDraft = {
name: string;
url: string;
+ description: string;
auth: ConnectorAuth;
};
@@ -41,6 +42,7 @@ const RequiredMark = () => (
const AddMcpServerForm = ({ open, onOpenChange, onAdd, busy = false, error }: AddMcpServerFormProps) => {
const [name, setName] = useState('');
const [url, setUrl] = useState('');
+ const [description, setDescription] = useState('');
const [authType, setAuthType] = useState<McpAuthType>('dcr');
const [apiKey, setApiKey] = useState('');
const [headerName, setHeaderName] = useState('');
@@ -48,6 +50,7 @@ const AddMcpServerForm = ({ open, onOpenChange, onAdd, busy = false, error }: Ad
const resetForm = () => {
setName('');
setUrl('');
+ setDescription('');
setAuthType('dcr');
setApiKey('');
setHeaderName('');
@@ -58,7 +61,7 @@ const AddMcpServerForm = ({ open, onOpenChange, onAdd, busy = false, error }: Ad
onOpenChange(nextOpen);
};
- const isValid = !!name.trim() && !!url.trim() && (authType !== 'header' || !!apiKey.trim());
+ const isValid = !!name.trim() && !!description.trim() && !!url.trim() && (authType !== 'header' || !!apiKey.trim());
const handleSubmit = async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
@@ -77,6 +80,7 @@ const AddMcpServerForm = ({ open, onOpenChange, onAdd, busy = false, error }: Ad
await onAdd({
name: name.trim(),
url: url.trim(),
+ description: description.trim(),
auth,
});
resetForm();
@@ -123,6 +127,24 @@ const AddMcpServerForm = ({ open, onOpenChange, onAdd, busy = false, error }: Ad
/>
</div>
+ <div>
+ <label htmlFor="mcp-server-description" className="mb-1.5 block text-sm font-medium text-text-primary">
+ Description
+ <RequiredMark />
+ </label>
+ <textarea
+ id="mcp-server-description"
+ value={description}
+ onChange={event => {
+ setDescription(event.target.value);
+ }}
+ placeholder="Query analytics from Postgres"
+ required
+ rows={3}
+ className={auiInputClass('resize-y py-2.5 shadow-sm')}
+ />
+ </div>
+
<div>
<label htmlFor="mcp-server-url" className="mb-1.5 block text-sm font-medium text-text-primary">
URL
diff --git a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConnectorSettings.tsx b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConnectorSettings.tsx
index 8e2a0a4dc..9bd2529c4 100644
--- a/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConnectorSettings.tsx
+++ b/packages/trueforge-ui-sdk/src/containers/SettingsBuilder/ConnectorSettings.tsx
@@ -203,7 +203,9 @@ const ConnectorSettings = () => {
}
closeApiKeyModal();
setTimeout(() => {
- toaster?.showSuccess({ title: `${entry.name} ${existingConnector ? 'updated' : 'connected'}` });
+ toaster?.showSuccess({
+ title: `${entry.name} ${existingConnector ? 'updated' : 'connected'}`,
+ });
}, 100);
}, setFormError).catch(() => {});
};
@@ -211,12 +213,7 @@ const ConnectorSettings = () => {
const handleAddMcpServer = async (draft: AddMcpServerDraft) => {
setFormError(null);
await runMutation(async () => {
- await connectorCatalog.createConnector({
- name: draft.name,
- description: draft.url,
- url: draft.url,
- auth: draft.auth,
- });
+ await connectorCatalog.createConnector({ ...draft });
}, setFormError);
setTimeout(() => {
toaster?.showSuccess({ title: `${draft.name} added` });
diff --git a/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/AddMcpServerForm.test.tsx b/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/AddMcpServerForm.test.tsx
new file mode 100644
index 000000000..8b9440051
--- /dev/null
+++ b/packages/trueforge-ui-sdk/test/containers/SettingsBuilder/AddMcpServerForm.test.tsx
@@ -0,0 +1,65 @@
+// @vitest-environment jsdom
+import { fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { beforeAll, describe, expect, it, vi } from 'vitest';
+
+import AddMcpServerForm from '@/containers/SettingsBuilder/AddMcpServerForm.js';
+
+beforeAll(() => {
+ HTMLDialogElement.prototype.showModal = function showModal() {
+ this.setAttribute('open', '');
+ };
+ HTMLDialogElement.prototype.close = function close() {
+ this.removeAttribute('open');
+ this.dispatchEvent(new Event('close'));
+ };
+});
+
+describe('AddMcpServerForm', () => {
+ it('submits name, url, auth, and trimmed description', async () => {
+ const onAdd = vi.fn(async () => undefined);
+
+ render(<AddMcpServerForm open onOpenChange={() => undefined} onAdd={onAdd} />);
+
+ fireEvent.change(screen.getByPlaceholderText('analytics-postgres-mcp'), {
+ target: { value: ' analytics-postgres-mcp ' },
+ });
+ fireEvent.change(screen.getByPlaceholderText('Query analytics from Postgres'), {
+ target: { value: ' Query analytics from Postgres ' },
+ });
+ fireEvent.change(screen.getByPlaceholderText('https://mcp.example.com/mcp'), {
+ target: { value: ' https://mcp.example.com/mcp ' },
+ });
+ fireEvent.click(screen.getByRole('button', { name: 'Add' }));
+
+ await waitFor(() => {
+ expect(onAdd).toHaveBeenCalledWith({
+ name: 'analytics-postgres-mcp',
+ url: 'https://mcp.example.com/mcp',
+ description: 'Query analytics from Postgres',
+ auth: { type: 'dcr' },
+ });
+ });
+ });
+
+ it('disables submit until description is filled', () => {
+ const onAdd = vi.fn(async () => undefined);
+
+ render(<AddMcpServerForm open onOpenChange={() => undefined} onAdd={onAdd} />);
+
+ fireEvent.change(screen.getByPlaceholderText('analytics-postgres-mcp'), {
+ target: { value: 'custom-mcp' },
+ });
+ fireEvent.change(screen.getByPlaceholderText('https://mcp.example.com/mcp'), {
+ target: { value: 'https://mcp.example.com/mcp' },
+ });
+
+ expect(screen.getByRole('button', { name: 'Add' })).toBeDisabled();
+ expect(onAdd).not.toHaveBeenCalled();
+
+ fireEvent.change(screen.getByPlaceholderText('Query analytics from Postgres'), {
+ target: { value: 'Custom MCP tools' },
+ });
+
+ expect(screen.getByRole('button', { name: 'Add' })).toBeEnabled();
+ });
+});