Tool Registration Testing Guide
This guide explains how to test the tool registration system for OpenRegister agents.
Prerequisites
- OpenRegister app installed and enabled
- At least one other app with a registered tool (e.g., OpenCatalogi)
- Admin or user access to create agents
- Docker environment running (if applicable)
Testing the Built-in Tools
Step 1: Verify OpenRegister Tools are Available
- Navigate to OpenRegister app
- Go to Agents section
- Click Create Agent or edit an existing agent
- Navigate to the Tools tab
You should see three built-in tools:
- Register Tool - Manage registers
- Schema Tool - Manage schemas
- Objects Tool - Manage objects
Each tool should display:
- Icon
- Name
- Description
- App badge ('openregister')
Step 2: Enable Tools for an Agent
-
Create a test agent with the following settings:
- Name: 'Test Tool Agent'
- Type: 'Chat'
- Prompt: 'You are a helpful assistant that can manage data'
- Enable RAG: false (for simplicity)
-
Go to the Tools tab
-
Enable all three built-in tools
-
Save the agent
Step 3: Test Tool Function Calling
- Start a chat with your test agent
- Ask it to perform actions:
Test Register Tool:
Create a new register called 'Test Register' with description 'A test register'
Expected: The agent should use the register_create function and return success.
Test Schema Tool:
List all schemas in the system
Expected: The agent should use the schema_list function and return a list of schemas.
Test Objects Tool:
Search for objects with title containing 'test'
Expected: The agent should use the object_search function and return matching objects.
Step 4: Verify RBAC and Organization Limits
- Create two users in different organizations
- Create an agent in Organization A
- Try to access Organization B's data through the agent
Expected: The agent should only have access to Organization A's data.
Testing External App Tools (OpenCatalogi Example)
Step 1: Install and Enable OpenCatalogi
docker exec -u 33 master-nextcloud-1 php occ app:enable opencatalogi
Step 2: Verify CMS Tool is Registered
- Navigate to OpenRegister > Agents
- Edit an agent and go to Tools tab
- You should now see CMS Tool with:
- Icon: 'icon-category-office'
- Name: 'CMS Tool'
- Description: 'Manage website content: create pages, menus, and menu items'
- App badge: 'opencatalogi'
Step 3: Enable CMS Tool
- Enable the CMS Tool for your test agent
- Save the agent
Step 4: Test CMS Functions
Start a chat and test the following:
Create a Page:
Create a new page titled 'Welcome' with content 'This is a welcome page'
Expected: Agent uses cms_create_page and returns page UUID.
List Pages:
Show me all pages
Expected: Agent uses cms_list_pages and displays all pages.
Create a Menu:
Create a menu called 'Main Menu'
Expected: Agent uses cms_create_menu and returns menu UUID.
Add Menu Item:
Add a menu item to the Main Menu that links to the Welcome page
Expected: Agent uses cms_add_menu_item and creates the link.
API Testing
Test Tool Registry API
# Get all available tools
docker exec -u 33 master-nextcloud-1 curl -s -u 'admin:admin' \
-H 'Content-Type: application/json' \
http://localhost/apps/openregister/api/agents/tools
# Expected response:
{
"results": {
"openregister.register": {
"name": "Register Tool",
"description": "Manage registers...",
"icon": "icon-category-office",
"app": "openregister"
},
"openregister.schema": { ... },
"openregister.objects": { ... },
"opencatalogi.cms": { ... }
}
}
Test Agent with Tools
# Create agent with tools enabled
docker exec -u 33 master-nextcloud-1 curl -s -u 'admin:admin' \
-H 'Content-Type: application/json' \
-X POST http://localhost/apps/openregister/api/agents \
-d '{
"name": "API Test Agent",
"type": "chat",
"tools": ["openregister.objects", "opencatalogi.cms"]
}'
# Start a conversation and test tool calls
# ... (similar to chat testing above)
Debugging
Check Tool Registration
# View OpenRegister logs
docker logs master-nextcloud-1 | grep '\[ToolRegistry\]'
# Expected output:
# [ToolRegistry] Loading tools from all apps
# [ToolRegistry] Tool registered: openregister.register
# [ToolRegistry] Tool registered: openregister.schema
# [ToolRegistry] Tool registered: openregister.objects
# [ToolRegistry] Tool registered: opencatalogi.cms
# [ToolRegistry] Loaded tools: count=4
Check Tool Execution
# View ChatService logs
docker logs master-nextcloud-1 | grep '\[ChatService\]'
# Expected output when agent uses a tool:
# [ChatService] Loaded tool: openregister.objects
# [ChatService] Function call requested: object_search
# [ChatService] Function call result: success
Check Tool-Specific Logs
# View CMSTool logs
docker logs master-nextcloud-1 | grep '\[CMSTool\]'
# Expected output:
# [CMSTool] Executing function: cms_create_page
# [CMSTool] Function execution completed
Common Issues
Tool Not Appearing in Agent Editor
Problem: Tool doesn't show up in the Tools tab.
Solutions:
- Check app is enabled:
php occ app:enable myapp - Verify event listener is registered in
Application.php - Check logs for registration errors
- Clear Nextcloud cache:
php occ maintenance:repair
Tool Function Not Being Called
Problem: Agent doesn't use the tool when asked.
Solutions:
- Check function descriptions are clear and detailed
- Verify agent has the tool enabled
- Try explicit instructions: 'Use the CMS tool to create a page'
- Check LLM temperature (lower = more predictable)
Tool Function Fails
Problem: Function executes but returns an error.
Solutions:
- Check user permissions
- Verify organization boundaries
- Check required parameters are provided
- Review tool logs for exceptions
Agent Uses Wrong Tool
Problem: Agent uses a different tool than expected.
Solutions:
- Improve function descriptions
- Make function names more specific
- Reduce number of enabled tools
- Provide more context in the prompt
Performance Testing
Load Testing Tool Registry
# Test registry performance with multiple concurrent requests
for i in {1..100}; do
docker exec -u 33 master-nextcloud-1 curl -s -u 'admin:admin' \
http://localhost/apps/openregister/api/agents/tools &
done
wait
Expected: All requests should complete in < 100ms.
Load Testing Tool Execution
# Test tool execution under load
# Create 10 agents with tools enabled
# Send 10 concurrent chat messages that trigger tool calls
# Monitor response times and error rates
Expected: Response times should remain reasonable (< 5s for simple operations).
Security Testing
Test RBAC Enforcement
- Create user A in Org 1
- Create user B in Org 2
- Create agent in Org 1 with tools enabled
- User B should NOT be able to:
- Access the agent
- See Org 1's data through any tool
Test Input Validation
Try these malicious inputs:
# SQL Injection attempt
"Create a page with title: '; DROP TABLE pages; --"
# XSS attempt
"Create a page with content: <script>alert('xss')</script>"
# Path traversal
"Create a page with slug: ../../../../etc/passwd"
Expected: All should be safely handled/sanitized.
Test Rate Limiting
Configure agent with rate limits:
- Request quota: 10 per hour
- Token quota: 1000 per hour
Send 15 requests rapidly.
Expected: Requests 11-15 should be rejected with rate limit error.
Automated Tests
Unit Tests
Run PHPUnit tests for tool components:
cd openregister
vendor/bin/phpunit tests/Unit/ToolRegistryTest.php
vendor/bin/phpunit tests/Unit/CMSToolTest.php
Integration Tests
Run integration tests that verify end-to-end tool execution:
vendor/bin/phpunit tests/Integration/ToolExecutionTest.php
Success Criteria
All tests should pass with:
- ✅ Tools appear in agent editor
- ✅ Tools can be enabled/disabled
- ✅ Agent correctly calls tool functions
- ✅ RBAC is enforced
- ✅ Organization boundaries are respected
- ✅ Input validation works
- ✅ Error handling is graceful
- ✅ Logging provides adequate debugging info
- ✅ Performance is acceptable under load
- ✅ Security vulnerabilities are not present
Reporting Issues
If you find issues during testing:
- Check logs for detailed error messages
- Note exact reproduction steps
- Include agent configuration (tools, prompt, settings)
- Include sample input that caused the issue
- Report to the development team with all details
Next Steps
After successful testing:
- Enable tools for production agents
- Monitor usage and performance
- Create additional tools as needed
- Update documentation based on user feedback