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:

TypeScript
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:

ToolDoes
file_readRead a file
file_writeWrite a file
file_editEdit a file in place
globMatch paths by pattern
grepSearch file contents
executeRun a command
web_fetchFetch 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.

OptionTypeDefaultNotes
cwdstringprocess.cwd()Workspace exposed to the catalog
commandTimeoutMsnumber120000Timeout for execute
allowPrivateNetworkbooleanfalseLet web_fetch reach private and loopback addresses
TypeScript
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.

TypeScript
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();