Runtime tool catalog
The runtime catalog#
No local tools are registered by default. When an agent needs your filesystem, a shell, or your network context, add the base catalog explicitly:
import { createAgent } from '@coresourceai/sdk';
const codingAgent = createAgent({ type: 'agent' });
codingAgent.registerRuntimeTools();
const result = await codingAgent.run('Find every TODO in src/ and list them.');
await codingAgent.close();The catalog contains:
| Tool | Does |
|---|---|
file_read | Read a file |
file_write | Write a file |
file_edit | Edit a file in place |
glob | Match paths by pattern |
grep | Search file contents |
execute | Run a command |
web_fetch | Fetch a URL |
Registering the catalog also makes the hosted web_search tool available.
Scoping the catalog#
registerRuntimeTools() takes options, and on anything but a throwaway script you should use them.
| Option | Type | Default | Notes |
|---|---|---|---|
cwd | string | process.cwd() | Workspace exposed to the catalog |
commandTimeoutMs | number | 120000 | Timeout for execute |
allowPrivateNetwork | boolean | false | Let web_fetch reach private and loopback addresses |
import { createAgent } from '@coresourceai/sdk';
const agent = createAgent({ type: 'agent' });
agent.registerRuntimeTools({
// Confine file tools to one directory rather than wherever the process started.
cwd: '/srv/workspaces/job-4417',
commandTimeoutMs: 30_000,
allowPrivateNetwork: false
});
await agent.close();cwd defaults to process.cwd(), which in a server process is usually your application root, including its .env and its source. Set it deliberately.
allowPrivateNetwork defaults to false so web_fetch cannot be steered into your internal network by something it read on a web page. Turn it on only when fetching internal URLs is the actual job.
Registration timing#
registerRuntimeTools() and registerMcpServer() must be called before the first run starts. Calling either afterwards throws. The tool set is fixed when the run begins.
import { createAgent } from '@coresourceai/sdk';
const agent = createAgent({ type: 'agent' });
agent.registerRuntimeTools(); // fine
const result = await agent.run('Go.'); // tool set is now fixed
// agent.registerRuntimeTools(); // throws
await agent.close();