Code-Mode MCP

Typed integration access
for AI agents

Standard MCP can load thousands of tool schemas upfront.

Code Mode keeps the initial surface to 3 tools, then loads typed APIs on demand.

Standard MCP does not scale

Add 10 integrations to an MCP server in TOOLS mode. That is 200+ tool definitions, each with full JSON Schema, loaded before the agent sends its first message. Most of those tokens are wasted.

Standard TOOLS Mode

// MCP tools/list response:
{
  "tools": [
    // Slack (15 tools)
    "slack__send_channel_message",
    "slack__send_direct_message",
    "slack__list_channels",       // helper
    "slack__list_users",          // helper
    "slack__update_message",
    // ... 10 more Slack tools

    // Google Sheets (12 tools)
    "google_sheets__append_row",
    "google_sheets__get_rows",
    // ... 10 more

    // GitHub, Gmail, Salesforce...
    // 500+ more integrations

    // Total: 3,700+ tool definitions
    // Each with full JSON Schema
    // = a large context load before the agent starts
  ]
}
  • 3,700+ tool definitions loaded upfront
  • Tool schemas consume context before the agent does anything
  • Agent wastes turns scanning irrelevant tools
  • Each tool call = 1 action, no multi-step composition

Weavz CODE Mode

Recommended
// MCP tools/list response in CODE mode:
{
  "tools": [
    "weavz_search",    // Discover integrations & actions
    "weavz_read_api",  // Get TypeScript declarations
    "weavz_execute"    // Run code
  ]
}

// That's it. 3 tools.
// The agent loads API details on demand.
  • 3 meta-tools replace 3,700+ definitions
  • Small initial context with API details loaded on demand
  • Agent explores only the APIs it needs
  • Multi-step workflows in a single code execution

Search. Read. Execute. That is the entire API surface.

The agent discovers integrations, fetches TypeScript declarations for the ones it needs, then writes and runs code in a managed execution environment. No upfront loading.

1

weavz_search

Discover

Returns a compact list of matching integrations and their action names. Costs a few hundred tokens, not thousands.

// "I need to send a Slack message"
await mcp.callTool("weavz_search", {
  query: "slack"
});

// Returns:
// Slack (slack) — 6 actions
//   send_channel_message, send_direct_message,
//   update_message, add_reaction,
//   create_channel, get_channel_history
2

weavz_read_api

Learn

Returns TypeScript declarations with function signatures, parameter types, and JSDoc descriptions. The agent knows exactly what to call.

await mcp.callTool("weavz_read_api", {
  integration: "slack"
});

// Returns TypeScript declarations:
// declare namespace weavz.slack {
//   function send_channel_message(input: {
//     channel: string; // Use $options()
//     text: string;
//     thread_ts?: string;
//   }): Promise<Result>;
// }
3

weavz_execute

Execute

The agent writes JavaScript, it runs in a managed execution environment, and you get back the return value plus an action trace with timing. Multiple integrations in one call.

await mcp.callTool("weavz_execute", {
  code: `
    const channels = await weavz.$options(
      "slack", "send_channel_message", "channel"
    );
    const general = channels.options
      .find(c => c.label === "general");
    await weavz.slack.send_channel_message({
      channel: general.value,
      text: "Deployed successfully!"
    });
  `
});

// Returns: result + console logs
//        + action trace with timing

Real example: Sheets data to Slack summary

One weavz_execute call. The agent fetches channels via $options, pulls rows from Google Sheets, filters and formats, then posts to Slack. Four API calls, one code execution.

weavz_execute
// Step 1: List Slack channels to find #general
const channels = await weavz.$options(
  "slack", "send_channel_message", "channel"
);
const general = channels.options.find(c => c.label === "general");

// Step 2: Fetch data from Google Sheets
const rows = await weavz.google_sheets.get_rows({
  spreadsheet_id: "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms",
  sheet_name: "Orders",
  range: "A:E"
});

// Step 3: Filter and transform
const recent = rows.values
  .filter(row => new Date(row[4]) > new Date("2025-01-01"))
  .map(r => `  ${r[0]}: ${r[1]} — $${r[2]}`);

// Step 4: Send formatted summary to Slack
await weavz.slack.send_channel_message({
  channel: general.value,
  text: [
    `${recent.length} orders since Jan 2025:`,
    ...recent,
    `Total: $${recent.reduce((sum, _, i) =>
      sum + parseFloat(rows.values[i][2]), 0).toFixed(2)}`
  ].join("\n")
});

return { sent: recent.length };

Depends on catalog size

0

Initial MCP tools

Search, read API, and execute

0+

Tools behind the catalog

Callable after on-demand discovery

0

Call for multi-step workflows

Google Sheets + Slack in one weavz_execute

0

Persistence scopes

End-user, workspace, or external ID

Why this works better than tool-per-action

Less context noise. Fewer wasted turns. Multi-step composition in a single call. Here is what changes concretely.

Matches how agents think

Agents explore, then understand, then act. Code-Mode maps directly to that: search for integrations, read the API, execute code.

Multi-step in one call

Read rows from Google Sheets, filter them, post a summary to Slack. One weavz_execute call instead of 3 separate tool calls with intermediate parsing.

TypeScript declarations, not JSON Schema

The agent sees weavz.slack.send_channel_message({ channel: string, text: string }) with JSDoc. Clearer than reverse-engineering a JSON Schema blob.

Fewer wasted turns

With TOOLS mode, the agent scans 200+ tool definitions to find the right one. With Code-Mode, it searches by keyword and loads only what it needs.

Persistent state across executions

Storage and KV Store integrations let agents save results between runs. Build workflows that accumulate data over multiple executions.

Transform data inline

Filter arrays, format strings, compute totals -- in JavaScript, inside the execution. No separate data transformation tools needed.

3 tools. 3,000+ actions. Try it now.

Code-Mode is on every plan, including Free. 20,000 actions/month, 25 MCP servers. No credit card.