Installation
Running the Server
STDIO Transport Mode
HTTP Streaming Transport Mode
Available Tools
The server provides the following tool for resource discovery:| Tool Name | Description |
|---|---|
search_resources | Search for resources in the tenancy |
Usage Examples
Search All Resources
Search by Resource Type
Search by Compartment
Search by Name
Search by Tag
Complex Queries
Understanding Resource Search
What is Resource Search?
OCI Resource Search is a powerful service that enables:- Cross-Service Search - Find resources across all OCI services
- Cross-Compartment Search - Search entire tenancy or specific compartments
- Structured Queries - Use Resource Query Language (RQL)
- Tag-Based Discovery - Find resources by tags and metadata
- Real-Time Results - Query live resource inventory
Resource Query Language (RQL)
RQL is a SQL-like language for searching resources: Basic Syntax:Searchable Resource Types
Resource Search supports searching across many OCI resource types: Compute & Storage- Instance (compute instances)
- Image
- BootVolume
- Volume
- VolumeBackup
- BootVolumeBackup
- Vcn (Virtual Cloud Networks)
- Subnet
- SecurityList
- NetworkSecurityGroup
- InternetGateway
- NatGateway
- ServiceGateway
- RouteTable
- DRG (Dynamic Routing Gateway)
- AutonomousDatabase
- DbSystem
- Database
- DbHome
- LoadBalancer
- NetworkLoadBalancer
- Compartment
- User
- Group
- Policy
- Bucket
Search Attributes
Common attributes available for searching:displayName- Resource namelifecycleState- Resource state (RUNNING, STOPPED, etc.)compartmentId- Compartment OCIDtimeCreated- Creation timestampdefinedTags- Defined tag namespaces and keysfreeformTags- Freeform tagsidentifier- Resource OCID- Resource-specific attributes
Authentication
The server uses OCI CLI configuration from~/.oci/config:
Required Permissions
Your OCI user or instance principal needs these IAM permissions: Basic Search:Common Use Cases
Resource Inventory
- Catalog all resources in tenancy
- Count resources by type
- Identify resource distribution across compartments
- Track resource growth over time
Cost Management
- Find all resources with specific cost tags
- Identify untagged resources
- Locate resources for showback/chargeback
- Find resources for cost optimization
Compliance & Governance
- Verify tagging compliance
- Find resources missing required tags
- Audit resource configurations
- Identify non-compliant resources
Operations & Troubleshooting
- Locate resources by name
- Find resources in specific states
- Identify orphaned resources
- Discover dependencies
Migration & Cleanup
- Find all resources in old compartments
- Identify resources for migration
- Locate unused or idle resources
- Plan resource consolidation
Security Auditing
- Find public-facing resources
- Identify resources without encryption
- Locate resources with specific configurations
- Audit access patterns
Query Examples
Find Running Instances
Find Resources by Tag
Find Resources Created Recently
Find Untagged Resources
Find Resources in Specific Compartment
Best Practices
Effective Searching
- Use specific resource types when possible (faster results)
- Combine conditions to narrow results
- Use pagination for large result sets
- Cache frequent queries
- Leverage tags for better organization
Tagging Strategy
- Implement consistent tagging policies
- Use defined tags for controlled vocabularies
- Tag resources at creation
- Use tag defaults for automation
- Regular tag compliance audits
Performance
- Limit search scope to specific compartments when possible
- Use specific resource types instead of “all”
- Implement result caching for dashboards
- Avoid overly complex queries
Organization
- Document common search queries
- Create saved queries for frequent searches
- Share useful queries with team
- Build automation around searches
Advanced Patterns
Resource Dependency Mapping
- Find VCN
- Search for subnets in that VCN
- Search for instances in those subnets
- Map complete architecture
Cost Allocation
- Search by cost center tag
- Group resources by type
- Calculate resource counts
- Generate cost reports
Compliance Scanning
- Search for resource type
- Check required attributes
- Identify non-compliant resources
- Generate compliance report
Cleanup Automation
- Search for idle resources
- Check last activity
- Identify candidates for deletion
- Generate cleanup recommendations
Troubleshooting
No Results Returned
Possible causes:- No resources match query
- Insufficient permissions to view resources
- Incorrect query syntax
- Wrong compartment specified
- Verify resources exist via console
- Check IAM permissions
- Validate query syntax
- Try broader search criteria
Permission Denied
Error: NotAuthorizedOrNotFound- Verify
use search-resourcespermission - Check read permissions on resource types
- Ensure searching in accessible compartments
- Validate tenancy access
Query Syntax Errors
- Check RQL syntax documentation
- Verify attribute names are correct
- Ensure proper quoting of values
- Test simple queries first
Incomplete Results
- Check pagination - may need to fetch additional pages
- Verify all compartments are searched
- Ensure resources are in expected state
- Confirm no permission gaps
Integration Ideas
CMDB Integration
- Export resource inventory
- Update configuration management database
- Track resource changes
- Maintain accurate asset records
Cost Reporting
- Search by cost tags
- Aggregate resource counts
- Generate cost allocation reports
- Track resource usage trends
Security Scanning
- Find resources with security issues
- Identify configuration gaps
- Generate security reports
- Automate remediation
Automation
- Scheduled resource audits
- Automated tagging compliance
- Resource lifecycle management
- Dynamic inventory for Ansible/Terraform
Related Services
- Identity - Manage compartments and access
- Monitoring - Monitor found resources
- Cloud Guard - Security scanning
- Compute - Manage found instances
