Browse the blog

Expose a FrontMCP agent as an MCP tool

  • frontmcp
  • mcp
  • agents
  • multi-agent

Maintained guide. Example version: FrontMCP 1.10.10. Technical checks recorded: 2026-10-22. How checks work.

A research agent and a writing agent need different tools and instructions. To connect them, one needs a way to request work from the other and handle the result. FrontMCP exposes an agent through an MCP tool, so a client, or another authorized agent, can call it through the same interface as the rest of the server.

The generated tool is invoke_<name>. This revised example uses a scripted model to make the framework behavior repeatable. It does not test a hosted model's judgment.

For the maintained reference, see @Agent and the lessons in Delegating to Agents.

A small agent

Open
import { Agent, AgentContext, z, type AgentLlmAdapter } from "@frontmcp/sdk";

const model: AgentLlmAdapter = {
  async completion() {
    return { content: "Check the sign-in service.", finishReason: "stop" };
  },
};

@Agent({
  name: "triage",
  description: "Suggest the next support step for a ticket title",
  systemInstructions: "Suggest one next step. Do not change records.",
  inputSchema: { title: z.string() },
  llm: { adapter: model },
})
export class Triage extends AgentContext {}

Starting FrontMCP in your browser…

FrontMCP starts when this example comes into view.

In a local project, register Triage in an app's agents and register that app on the server. The Playground performs that registration for exported entries. Your First Agent includes the full server.

Real-world example: Weather summary agent

A weather assistant could call a weather tool and summarize its result. A model adapter, live weather API, network credentials and error handling are additional dependencies; the small fixture above does not supply them. Follow Giving an Agent Tools, then Connecting a Real Model.

Delegation has boundaries

Give each agent a limited tool set and a clear input contract. Choose timeouts, iteration limits and nesting limits for the workload. Client permissions, agent tool access and user approval solve different problems; a child agent does not automatically gain access to everything on the server.

Latency depends on model requests, backing tools, retries and delegation depth. Measure those separately rather than assuming a fixed speed for one agent or a hierarchy.

Read the agent reference for the exact options and Agents That Call Agents for delegation. When a direct tool already returns the needed result, start there.

Report a docs issue. Site usage and privacy.