# 4D MCP for AI Agents AI Agent Connect

> 4D MCP connects your 4D database to AI agents using the ORDA model. It lets your agent explore data structures, run complex queries, and manage records using plain language. Instead of writing manual REST calls, you can let your agent handle the heavy lifting of CRUD operations and catalog audits directly.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_D1Grnbj5YYTUrRV7JM7mu8HcpMzBi59V8AcgtrDo/ai-agent-connect
- **Tags:** database-management, orda, rest-api, data-querying, entity-management, application-development

## Description

Most 4D developers spend hours building custom REST endpoints just so an external system can talk to their data. You end up jumping between your 4D management console, a code editor to write the API, and a browser to test the JSON responses. It's a fragmented workflow that slows down every new feature. This Connector changes that by creating a direct bridge between your 4D environment and your AI client. It uses the Object Relational Data Architecture to turn your database into a queryable knowledge base. You can ask your agent to find specific records, update customer info, or even audit your entire data catalog without touching a single line of code. It handles the translation from your natural language to the specific ORDA syntax required by the database. This is one of the high-quality integrations you can find in the Vinkius catalog to make your data actually useful in a chat interface. Instead of wrestling with documentation, you just tell your agent what you need, and it goes and gets it. It's about making your 4D data actionable in seconds rather than hours of development.

## Tools

### list_entities
Query records from a table using filters and ordering. You can use this to find specific rows based on complex criteria.

### get_entity
Fetch a single record by its primary key. Use this when you need the full details of a specific item quickly.

### create_entity
Add a new record to a DataClass using a JSON payload. This allows your agent to populate your database on the fly.

### update_entity
Modify an existing record in your database. It takes a JSON payload to change specific fields without affecting the rest.

### delete_entity
Remove a specific record from your database. This is useful for cleaning up old data or removing user accounts.

### get_catalog
Retrieve the full definition of your database catalog. Use this to let your agent understand your tables and fields.

## Prompt Examples

**Prompt:** 
```
Can you show me the last 5 orders from the database?
```

**Response:** 
```
I've pulled the most recent orders from your 4D database. Here is the summary:

| Order ID | Customer | Total | Date |
| :--- | :--- | :--- | :--- |
| #8821 | Jane Doe | $142.50 | Oct 24 |
| #8820 | John Smith | $89.00 | Oct 23 |
| #8819 | Alice Wong | $210.00 | Oct 22 |
| #8818 | Bob Vance | $55.20 | Oct 21 |
| #8817 | Sarah Lee | $312.10 | Oct 20 |
```

**Prompt:** 
```
I need to add a new customer named Sarah Jenkins with the email sarah@example.com.
```

**Response:** 
```
I've added Sarah Jenkins to your 4D database. 

**New Record Created:**
- **Name:** Sarah Jenkins
- **Email:** sarah@example.com
- **Status:** Active
- **ID:** 1042
```

**Prompt:** 
```
What tables are available in my 4D catalog?
```

**Response:** 
```
I've scanned your 4D catalog. You have access to the following DataClasses:

- **Customers** (Profiles and contact info)
- **Orders** (Transaction history)
- **Invoices** (Billing details)
- **Products** (Inventory list)

Which one would you like to explore further?
```

## Capabilities

### Query specific records
Use filters and ordering to find exactly what you need in a table.

### Create new entries
Add new records to your database by providing a simple data payload.

### Update existing data
Modify any record in your database using a JSON representation of the changes.

### Audit database structure
View your full catalog of DataClasses and their attributes at any time.

### Delete records
Remove specific entries from your database when they are no longer needed.

### Fetch individual records
Get the full details of a single record using its primary key.

## Use Cases

### Customer Support
An agent looks up a customer's order history using get_entity and list_entities to answer a caller's questions instantly.

### Inventory Management
A warehouse manager asks the agent to update the stock for item X, and the agent uses update_entity to change the count.

### Data Migration
A developer uses get_catalog to see the schema and then has the agent help them map out new records using create_entity.

### Audit Logging
A business admin asks the agent to find all invoices from last month to generate a quick summary of sales.

## Benefits

- Stop writing manual REST calls. You can use get_catalog to let your agent understand your database structure automatically instead of building custom endpoints for every single request.
- Perform complex queries instantly. Use list_entities with filters to find specific data points without writing SQL or complex filter logic yourself.
- Handle data entry faster. Your agent can use create_entity and update_entity to manage records, saving you from manual data entry in the 4D interface.
- Audit your data structure in seconds. Use get_catalog to see every DataClass and attribute, making it easy to verify your database integrity with a simple question.
- Simplify record management. Use get_entity and delete_entity to perform quick lookups and cleanups through a chat interface instead of a management console.

## How It Works

The bottom line is you get a natural language interface for your 4D database without writing custom API code.

1. Subscribe to the 4D MCP and provide your 4D Server base URL and credentials.
2. Connect your AI client to the Connector to give it permission to see your 4D environment.
3. Ask your agent to perform tasks like finding invoices or adding new customer records.

## Frequently Asked Questions

**Can the 4D MCP help me manage my records without writing code?**
Yes. This Connector allows you to use natural language to create, update, and delete records in your 4D database without ever writing a custom API or script.

**Does the 4D MCP support searching for specific data using filters?**
Yes, it supports advanced lookups. Your AI agent can use filters and ordering to find specific subsets of data, like finding all orders from a specific date range.

**How does the 4D MCP handle updating information in my database?**
When you ask your agent to change a piece of information, it identifies the correct record and uses the ORDA model to update the specific fields for you.

**Can I use the 4D MCP to see my database structure?**
Absolutely. The Connector can retrieve your full catalog definition, allowing your agent to understand your tables, fields, and attributes on the fly.

**Is the 4D MCP suitable for business admins who aren't developers?**
Yes, it's perfect for non-technical users. It turns your database into a chat interface where you can manage records and look up info just by asking questions.

**How do I find which tables are available?**
Use the `get_catalog` tool. It will return a list of all DataClasses (tables) exposed through the REST API in your 4D Server.

**Can I filter data based on specific conditions?**
Yes. Use the `list_entities` tool and provide an ORDA-style filter string in the `$filter` parameter (e.g., "status = 'active' AND price > 100").

**Does this support creating new records?**
Absolutely. Use the `create_entity` tool by providing the DataClass name and a JSON string containing the field data for the new record.