Build a News Radar Workflow

Use A3S Code v3.1.0 MCP stdio registration, direct tools, and streaming with clear live-source boundaries.

Build a News Radar Workflow

This tutorial shows the A3S Code side of a news workflow: register a stdio MCP server, call a tool directly, and stream a short briefing from the returned content.

Third-party fetch servers, JavaScript-heavy scraping, RSS semantics, and search freshness are application concerns. Test those live sources before treating them as production inputs.

Building Blocks

  • session.toolNames() includes web_search and web_fetch.
  • session.addMcpServer() can start a stdio MCP server.
  • session.mcpStatus() reports registered MCP servers.
  • session.tool('mcp__server__tool', args) can call a registered MCP tool.
  • session.stream() can synthesize a report; consume it with .next().

Session

import { Agent } from '@a3s-lab/code';
const agent = await Agent.create('agent.acl');
const session = agent.session(process.cwd(), {
builtinSkills: true,
planningMode: 'enabled',
});
console.log(session.toolNames());

Register a Stdio MCP Server

This example uses a minimal local stdio MCP server and calls mcp__echo__echo and mcp__echo__get_secret. The example below assumes your workspace contains tools/mcp_echo_server.mjs; replace it with your own stdio MCP server only after testing that server.

await session.addMcpServer('echo', 'stdio', process.execPath, [
'tools/mcp_echo_server.mjs',
'secret',
]);
console.log(await session.mcpStatus());
const echo = await session.tool('mcp__echo__echo', {
message: 'news-radar check',
});
console.log(echo.output);

Live Fetch Boundary

web_search and web_fetch are in the tool registry. This page does not assert live network results, freshness, or source quality. Test the exact live sources you plan to use before wiring them into a production news-fetching pipeline.

Stream the Briefing

const stream = await session.stream(`
Create a concise news briefing from these source excerpts.
Separate confirmed facts from uncertain or missing data.
Source excerpt:
${echo.output}
`);
while (true) {
const { value: event, done } = await stream.next();
if (done) break;
if (event?.text) process.stdout.write(event.text);
}

Remove the MCP Server

await session.removeMcpServer('echo');
console.log(await session.mcpStatus());

Do not treat a third-party fetch server, browser automation server, or scheduled production crawl as part of this workflow until that integration has been tested in your environment.