Skip to main content
Glama

neuroverse_route

Route tasks to downstream agents via HTTP by specifying target agent, task description, and payload for execution.

Instructions

Route a task to a registered downstream agent via HTTP.

Args:

  • target_agent (string): Name of the agent

  • task (string): Task description

  • payload (object): Arbitrary payload

Returns: JSON with the agent's response or a fallback error

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
target_agentYesName of the registered agent
taskYesTask description to send
payloadNoArbitrary payload for the target

Implementation Reference

  • Tool registration and handler for 'neuroverse_route' in the MCP server.
    server.registerTool(
      "neuroverse_route",
      {
        title: "Route to Agent",
        description: `Route a task to a registered downstream agent via HTTP.
    
    Args:
      - target_agent (string): Name of the agent
      - task (string): Task description
      - payload (object): Arbitrary payload
    
    Returns:
      JSON with the agent's response or a fallback error`,
        inputSchema: RouteAgentSchema,
        annotations: {
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: false,
          openWorldHint: true,
        },
      },
      async (params) => {
        const result = await routeToAgent({
          targetAgent: params.target_agent,
          task: params.task,
          payload: params.payload as Record<string, unknown>,
        });
    
        return {
          content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }],
        };
      }
    );
  • The core implementation of the routing logic that the 'neuroverse_route' tool calls.
    export async function routeToAgent(
      request: AgentRoutingRequest
    ): Promise<Record<string, unknown>> {
      const agent = getAgent(request.targetAgent);
      if (!agent) {
        return { success: false, error: `Agent '${request.targetAgent}' is not registered.`, fallback: true };
      }
    
      try {
        const resp = await axios.post(
          agent.endpoint,
          { task: request.task, payload: request.payload },
          { headers: { "Content-Type": "application/json" }, timeout: 30000 }
        );
        return { success: true, agent: request.targetAgent, response: resp.data };
      } catch (e) {
        const msg = e instanceof Error ? e.message : String(e);
        return { success: false, error: `Agent unreachable: ${msg}`, fallback: true };
      }
    }
  • Input schema definition for the 'neuroverse_route' tool.
    const RouteAgentSchema = z
      .object({
        target_agent: z.string().min(1).describe("Name of the registered agent"),
        task: z.string().min(1).describe("Task description to send"),
        payload: z
          .record(z.unknown())
          .default({})
          .describe("Arbitrary payload for the target"),
      })
      .strict();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/joshua400/neuroverse'

If you have feedback or need assistance with the MCP directory API, please join our Discord server