Watsonx.data intelligence includes a
preconfigured MCP server with built-in tools that work seamlessly with the product. You can extend
the set of tools by uploading custom MCP tools.
These tools are then made available along with the built-in tools and users can access all of
them from a single interface.
- Who needs to complete this task?
-
Instance administrator To add custom MCP tools to
the MCP server in watsonx.data
intelligence, you must be an instance administrator.
To add custom MCP tools:
-
In your local file system, create a directory structure that is similar to the
app/services directory structures in the https://github.com/IBM/data-intelligence-mcp-server
repository.
Create a new directory with at least one subdirectory and 3 files:
- An __init__.py file in the new directory
- A tools subdirectory
- An __init__.py file in the tools subdirectory
cat << EOF > __init__.py
EOF
mkdir tools
cat << EOF > tools/__init__.py
EOF
- For each new MCP tool, create a new .py file in the
tools subdirectory.
The tool configuration must include the
custom tag like in the following
example:
cat << EOF >> ./tools/example_tool.py
from typing import Any
from app.core.registry import service_registry
from app.shared.logging import LOGGER
@service_registry.tool(
name="test_tool",
description="Example custom tool. This demonstrates the structure for custom tools.",
tags={"custom"}
)
async def test_tool(
resource_id: str,
action: str = "query"
) -> dict[str, Any]:
"""
Example custom tool
Args:
resource_id: The ID of the resource to operate on
action: The action to perform (query, update, delete, etc.)
Returns:
Dictionary containing the operation result
"""
LOGGER.info(f"Executing custom tool for resource: {resource_id}, action: {action}")
result = {
"status": "success",
"resource_id": resource_id,
"action": action,
"message": "This is an example custom tool. Replace with actual implementation."
}
LOGGER.info(f"Custom tool completed successfully for resource: {resource_id}")
return result
EOF
- Synchronize the files with the
semantic-agent-service pod and disable
tool filtering.
- Copy the files:
POD_NAME=`oc get pods | grep semantic-agent | awk '{print $1}'`
oc rsync ./ $POD_NAME:/sal/custom-tools
- Verify that all files were copied:
oc rsh deploy/semantic-agent-service ls -R /sal/custom-tools
- Disable tool filtering so that custom tools can be loaded:
oc set env deploy/semantic-agent-service enable_mcp_tool_filtering=false
What to do next
Check in your MCP client that the new tools are visible.