Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteES modules can make a clean foundation for an AI assistant’s tools, but importing a file is not a complete plugin system. The host still needs a contract for discovery, input validation, execution, permissions and errors. Keep tools as local modules when code and deployment are trusted and controlled together; use a service boundary when authentication, independent updates, controlled access or operational visibility matter.
What “every tool is an ES module” does—and does not—mean
Node.js describes ECMAScript modules as the official standard format for packaging JavaScript code for reuse. A host can use modules to separate tools into files and load their exported functions. Node supports ES modules through markers such as the .mjs extension or "type": "module" in a package configuration, and it also supports interoperability with CommonJS. Node.js documentation: ECMAScript modules
As an Amazon Associate I earn from qualifying purchases.
That solves code packaging and loading, not the assistant-specific questions. Node does not define how an assistant advertises tools to a model, checks arguments, supplies context, handles initialization failures or limits a tool’s permissions. Those are responsibilities of the host’s plugin contract and runtime.
Define a small, explicit tool contract
A practical starting design is for each module to export a description, an input schema and an execute function. This is a proposed contract, not a feature imposed by Node.js. A registry can associate each tool’s name with its validated metadata and callable function.
#1 Best Overall
Before execution, the host should discover only modules it intends to load, check that each module exports the required fields, and reject malformed definitions. When a model requests a tool, validate its arguments against that tool’s schema before calling it. Pass only the context the tool needs, validate or normalize the result, and convert failures into a controlled response the assistant can handle. Keep initialization errors distinct from errors during a particular call so one broken module does not silently appear to be a successful tool.
Node’s module-resolution details matter when building such a loader: relative and absolute import specifiers require explicit file extensions, including directory index files. Node resolves and caches ES modules as URLs, so code that constructs file URLs from filesystem paths must convert them carefully. Dynamic import() works in both ESM and CommonJS contexts, but CommonJS named-export detection is heuristic; test interoperability against the actual packages the assistant supports. Node.js ECMAScript modules documentation
Rank #2
Choose local modules or a service boundary
Local modules are a good fit when the assistant’s team controls the code, tools ship with the assistant, and in-process execution matches the trust model. A server-backed tool is more suitable when an integration needs its own authentication, permission checks, deployment cadence or operational monitoring.
| Design question | Local ES modules | Service-backed tools |
|---|---|---|
| Trust and isolation | Appropriate for trusted code running under the host’s process and permission model. | Creates a service boundary, but still requires careful authentication and authorization. |
| Deployment and updates | Usually released with the assistant or its package. | Behavior can be updated independently of the assistant. |
| Discovery | The host can use a static registry or manifest. | A service protocol can support runtime discovery, depending on the platform. |
| Input and output | The host must define and enforce exported-function conventions and schemas. | Protocols such as MCP define tools, input/output schemas and structured results. |
| Authentication and authorization | The host decides what context and capabilities to pass. | The service can define authentication and authorization requirements for external systems. |
| Operations | Failures are handled within the host’s runtime and release process. | The operator must account for network availability and service ownership; infrastructure requests can be observed. |
These are trade-offs, not a rule that every tool belongs on a server. OpenAI’s plugin documentation describes packages that may contain skills, an MCP server exposing tools and connecting to external systems, both, and optional lifecycle hooks; it recommends starting with the smallest shape that serves the use case. An MCP server can define tool schemas, authentication and authorization requirements, and structured results, while allowing an operator to update behavior independently and observe requests to its infrastructure. OpenAI Developers: Plugin architecture
Rank #3
Make discovery and user consent explicit
Tool discovery can be fixed at startup or resolved dynamically. A fixed registry is easier to reason about when the host controls the available modules. Runtime discovery can help when tools change independently, but it makes the source of tool definitions and the timing of changes part of the design.
Microsoft documents both patterns in its Copilot platform: MCP plugins can resolve tool definitions dynamically at runtime, while developers can pin a fixed tool set in a manifest; REST API plugins use manifest-defined tools. Its described invocation flow includes data-sharing confirmation, credentials when required, a call to a service hosted outside Microsoft 365, and a response returned to the agent. These are Microsoft platform behaviors, not universal properties of MCP or all assistant systems. Microsoft Learn: MCP and API plugins for declarative agents
For any assistant, decide who may install or update a tool, when its definition becomes available to the model, and whether the user must approve access or data sharing. A module being present in a registry should not, by itself, mean every user or every conversation is authorized to invoke it.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchDo not treat module loading as a security sandbox
import() loads code; it does not isolate it. A plugin running in the host’s privileged process may be able to use the APIs available to that process. If tools are not equally trusted, the host needs an intentional permission and isolation strategy rather than relying on the module boundary.
- Restrict which files can be installed or loaded, for example with an allowlist or a bundled registry.
- Decide explicitly whether tools can access files, networks, credentials or process APIs.
- Pass narrow capabilities rather than a broad host object when a tool needs only a specific operation.
- For untrusted code, evaluate process, worker or container isolation appropriate to the threat model.
- Review who can distribute updates and how those updates are approved.
A 2024 paper examining access-control vulnerabilities in plugin development discusses capability-based systems as one mitigation, while noting that managing and controlling capabilities becomes complex in larger ecosystems. Capability design can help constrain access, but it is not a substitute for deciding who receives capabilities and how they are governed. Evaluating the Language-Based Security for Plugin Development (2024)
A practical decision rule
Start with local ES modules when tools are trusted, shipped alongside the assistant and do not need independent operation. Add a service boundary when an integration needs separately managed credentials, explicit external-system authorization, independent updates or request observability. In either architecture, the assistant still needs a defined contract, validated arguments and results, deliberate user authorization, and a failure path the model can understand.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




