LearnNewsExamplesServices
Frontmatter
id8327
title[Neural Link] Feature: Tool find_instances
stateClosed
labels
developer-experienceaifeature
assigneestobiu
createdAtJan 4, 2026, 8:47 PM
updatedAtJan 5, 2026, 12:06 PM
githubUrlhttps://github.com/neomjs/neo/issues/8327
authortobiu
commentsCount1
parentIssue8169
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 5, 2026, 12:06 PM

[Neural Link] Feature: Tool find_instances

Closed v11.18.0 developer-experienceaifeature
tobiu
tobiu commented on Jan 4, 2026, 8:47 PM

Goal: Enable discovery of any Neo instance (StateProviders, Stores, Managers, etc.) by property matching using the global Instance Manager.

Specification:

  1. Tool Name: find_instances
  2. Service: src/ai/client/InstanceService.mjs
  3. Logic:
    • Use Neo.manager.Instance.find(selector) to retrieve matches.
    • This leverages the existing Neo.collection.Base finding logic (exact match on properties).
  4. Parameters:
    • selector (Required, Object): Key-value pairs to match (e.g., { className: 'Neo.state.Provider' }).
    • returnProperties (Optional, Array): List of specific properties to extract.
  5. Return Format:
    • Default: Returns instance.toJSON() for each match.
    • With returnProperties: Returns a lean summary object:
              {
        "instances": [
          {
            "id": "neo-provider-1",
            "className": "Neo.state.Provider",
            "properties": {
              "someProp": "someValue"
            }
          }
        ]
      }
  6. Implementation Details:
    • Reuse this.safeSerialize() from the base Service class for property values.
    • Unlike query_component, this tool is flat (global search) and does not support rootId or hierarchical down() lookups.

Comparison with query_component:

  • query_component: Focused on UI hierarchy, supports rootId, traverses down(), returns components.
  • find_instances: Focused on abstract architecture (Stores, Providers), global scope, returns instances.
tobiu added the developer-experience label on Jan 4, 2026, 8:47 PM
tobiu added the ai label on Jan 4, 2026, 8:47 PM
tobiu added the feature label on Jan 4, 2026, 8:47 PM
tobiu added parent issue #8169 on Jan 4, 2026, 8:48 PM
tobiu cross-referenced by #8326 on Jan 4, 2026, 9:09 PM
tobiu assigned to @tobiu on Jan 5, 2026, 11:53 AM
tobiu referenced in commit 2d91c80 - "[Neural Link] Feature: Tool find_instances #8327" on Jan 5, 2026, 12:05 PM
tobiu
tobiu Jan 5, 2026, 12:06 PM

Input from Gemini 3 Pro:

✦ I have implemented the find_instances tool.

Changes:

  1. src/ai/client/InstanceService.mjs: Added findInstances method.
    • Optimized logic to leverage Neo.collection.Base.find directly.
    • Simplified parameter validation and variable usage.
  2. ai/mcp/server/neural-link/services/toolService.mjs: Registered the tool mapping.
  3. ai/mcp/server/neural-link/openapi.yaml: Defined the API endpoint and schema.

The tool uses Neo.manager.Instance.find() for global instance discovery and supports the returnProperties parameter for lean responses.

tobiu closed this issue on Jan 5, 2026, 12:06 PM