Tools
The Directus Content MCP Server provides a set of tools that allow AI assistants to interact with your Directus instance. These tools enable various operations like reading collections, managing content, working with files, and more.
This guide covers the available tools and how to configure them.
Available Tools
The MCP Server provides the following tools to interact with your Directus instance:
Tool | Description | Use Cases |
---|---|---|
system-prompt | Provides context about your role as an assistant | Start of a session to understand the system context |
users-me | Get current user information | Understanding permissions, personalizing responses |
read-collections | Retrieve the schema of all collections | Exploring database structure, understanding relationships |
read-items | Fetch items from any collection | Retrieving content, searching for data, displaying information |
create-item | Create new items in collections | Adding new content, records, or entries |
update-item | Modify existing items | Editing content, updating statuses, correcting information |
delete-item | Remove items from collections | Cleaning up outdated content |
read-files | Access file metadata or raw content | Finding images, documents, or media assets |
import-file | Import files from URLs | Adding external media to your Directus instance |
update-files | Update file metadata | Organizing media, adding descriptions, tagging |
read-fields | Get field definitions for collections | Understanding data structure, field types and validation |
read-field | Get specific field information | Detailed field configuration |
create-field | Add new fields to collections | Extending data models |
update-field | Modify existing fields | Changing field configuration, interface options |
read-flows | List available automation flows | Finding automation opportunities |
trigger-flow | Execute automation flows | Bulk operations, publishing, status changes |
read-comments | View comments on items | Retrieving feedback, viewing discussion threads |
upsert-comment | Add or update comments | Providing feedback, documenting decisions |
markdown-tool | Convert between markdown and HTML | Content formatting for WYSIWYG fields |
get-prompts | List available prompts | Discovering pre-configured prompt templates |
get-prompt | Execute a stored prompt | Using prompt templates for consistent AI interactions |
Disabling Tools
You can disable specific tools to restrict the capabilities of the MCP server. This is useful for limiting destructive actions or focusing the AI assistant on specific tasks.
To disable tools, add the DISABLE_TOOLS
environment variable to your MCP server configuration:
{
"mcpServers": {
"directus": {
"command": "npx",
"args": ["@directus/content-mcp@latest"],
"env": {
"DIRECTUS_URL": "https://your-directus-instance.com",
"DIRECTUS_TOKEN": "your_directus_token",
"DISABLE_TOOLS": ["delete-item", "update-field", "create-field"]
}
}
}
}
In this example, the delete-item
, update-field
, and create-field
tools are disabled, preventing the AI assistant from deleting content or modifying the data structure.
System Prompt Tool
The system-prompt
tool is special - it provides context to the AI assistant about its role and capabilities when working with your Directus instance. This tool is typically called at the beginning of a conversation session.
You can customize the system prompt by setting the MCP_SYSTEM_PROMPT
environment variable:
{
"env": {
"MCP_SYSTEM_PROMPT": "You are an assistant specialized in managing content for our marketing website."
}
}
You can also disable the system prompt entirely by setting MCP_SYSTEM_PROMPT_ENABLED
to false
.
Best Practices
When working with the Directus Content MCP tools:
- Always call the
system-prompt
tool at the beginning of a session to establish context. - Use the
read-collections
tool to understand the data structure before performing operations. - Keep destructive tools disabled in production environments to prevent accidental data loss.