> For the complete documentation index, see [llms.txt](https://docs.xplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xplatform.com/talon/operating-applications/analysis-and-troubleshooting/tools/discovery-tool.md).

# Discovery Tool

An interactive command-line tool for working with discovery caches and diagnosing discovery issues.

## Overview

The Discovery Tool assists in diagnosing issues with discovery by providing interactive access to discovery caches. It allows you to open discovery caches, inspect advertised entities, and monitor entity lifecycle events in real-time.

## Running the Discovery Tool

The Discovery Tool can be launched directly from an nvx-core-all jar or nvx-talon-all jar, so long as you also include the jars/classes required by the provider (such as message bus classes and the platform's default third party dependencies).

```bash
cd <path-to-logs-directory>
java -cp <your-app-classpath> com.neeve.tools.DiscoveryTool [-h] [initial-discovery-cache-descriptor]
```

**Usage:**

```
DiscoveryTool [-h] [<initialCacheDescriptor>]
    [<-h|--help> Displays this help message (default='false')]
    [initialCacheDescriptor: The initial discovery cache to open]
```

**Example:**

```bash
java -cp nvx-talon-all.jar com.neeve.tools.DiscoveryTool mcast://224.0.1.200:4090
```

## Properties

The following properties can be set in the tool to change its functionality:

| Property Name                 | Default Value | Description                                                                                                      |
| ----------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------- |
| `longCommandDisplayThreshold` | 5             | Commands that take longer than the given time in seconds will result in the tool outputting their execution time |
| `stacktraces`                 | false         | Whether or not command exception stacktraces should be dumped                                                    |

## Commands

### open

Opens a discovery cache.

**Usage:**

```
open [-h] [<cacheDescriptor>]
    [<-h|--help> Displays this help message (default='false')]
    [cacheDescriptor: The discovery cache descriptor to open. If not
        specified the default cache descriptor will be used.]
```

**Example:**

```
> open mcast://224.0.1.200:4090
```

### close

Closes the currently open discovery cache.

**Usage:**

```
close [-h] [<cacheDescriptor>]
    [<-h|--help> Displays this help message (default='false')]
    [cacheDescriptor: The discovery cache descriptor to open.]
```

### get

Looks up an entity in the discovery cache.

**Usage:**

```
get [-h] <type> <name>
    [<-h|--help> Displays this help message (default='false')]
    type: The type of entity to add
    name: The name of the entity to add
```

**Example:**

```
> get Server MyXVM
```

### add

Adds an entity to the discovery cache.

**Usage:**

```
add [-h] <type> <name> <descriptor>
    [<-h|--help> Displays this help message (default='false')]
    type: The type of entity to add
    name: The name of the entity to add
    descriptor: The connection descriptors to broadcast for the entity
```

**Example:**

```
> add Application TestApp tcp://localhost:9000
```

### set

Sets a configuration or environment property.

**Usage:**

```
set [-h] [<propName>] [<propValue>]
    [<-h|--help> Displays this help message (default='false')]
    [propName: The name of property to set, if no name is set config
        properties are listed]
    [propValue: The value of the property to set. If omitted clears the
        property]
```

**Example:**

```
> set stacktraces true
> set longCommandDisplayThreshold 10
```

### reset

Reset a configuration or environment property to its default value.

**Usage:**

```
reset [-h] <propName>
    [<-h|--help> Displays this help message (default='false')]
    propName: The name of property to reset. '*' resets all properties
        to their default value.
```

### stacktraces

Sets whether or not command exception stacktraces should be shown.

**Usage:**

```
stacktraces [-h] <enabled>
    [<-h|--help> Displays this help message (default='false')]
    enabled: <off|on|false|true> Indicates whether or not command
        exceptions should be displayed
```

### history

Displays command history.

**Usage:**

```
history [-h] [-c] [<n>]
    [<-h|--help> Displays this help message (default='false')]
    [<-c|--clear> Clears command history]
    [n: lists only the last 'n' lines default='1000']
```

### help

Displays help message.

**Usage:**

```
help [-h] [<command>]
    [<-h|--help> Displays this help message (default='false')]
    [command: When specified displays help for that command only]
```

### ansi

Enables or disables ANSI output.

**Usage:**

```
ansi [-h] [<value>]
    [<-h|--help> Displays this help message (default='false')]
    [value: <off|on> Turns ANSI on or off. With no argument display the
        current ANSI setting]
```

### echo

Displays a message or turns echo on or off.

**Usage:**

```
echo [-h] [<value>]
    [<-h|--help> Displays this help message (default='false')]
    [value: Displays a message or turns echo on or off. With no argument
        list the current echo setting]
    [message: A message to display default='']
```

### script

Runs a command script.

**Usage:**

```
script [-h] [<script>]
    [<-h|--help> Displays this help message (default='false')]
    [script: The script file to execute]
```

### bye | exit | quit

Exit the tool.

**Usage:**

```
bye [-h]
    [<-h|--help> Displays this help message (default='false')]
```

## Common Usage Patterns

### Inspecting Running XVMs

To see what XVMs are currently advertising themselves:

```bash
# Open the default multicast discovery cache
> open mcast://224.0.1.200:4090

# Look for Server entities
> get Server MyXVM
```

### Testing Discovery Configuration

To verify a specific discovery configuration is working:

```bash
# Open discovery cache with specific configuration
> open solace://solhost:55555&single_session=true

# The tool will show any entities it discovers
```

### Monitoring Entity Lifecycle

The Discovery Tool automatically displays events when entities join or leave the discovery cache, making it useful for monitoring entity lifecycle in real-time.

## Related Topics

* [Discovery Model](/talon/concepts-and-architecture/discovery-model.md) - Understanding discovery concepts
* [Discovery Configuration](/talon/developing-applications/configuring-the-runtime/discovery/discovery-configuration.md) - Configuring discovery providers
* [Admin Over SMA](/talon/operating-applications/administration/admin-over-sma.md) - Administrative discovery

## Next Steps

1. Launch Discovery Tool with your configured discovery provider
2. Use `get` to inspect specific entities
3. Monitor entity advertisements and age-out behavior
4. Verify XVMs and applications are advertising correctly
5. Test different discovery configurations
