Skip to content

fix(agents): accept server route tools in agent files - #680

Merged
netanelgilad merged 1 commit into
mainfrom
claude/agent-server-route-tools
Oct 25, 2026
Merged

netanelgilad merged 1 commit into
mainfrom
claude/agent-server-route-tools

Conversation

@claude

@claude claude Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Yarden Danan · Slack thread

Description

Before: Pulling an agent that has a Server route tool ({tool_name, route_path, method, description}, added to the backend in apper #28281) writes it to base44/agents/<name>.jsonc verbatim, but the agent file schema only knew entity and backend-function tools. Every later CLI command that reads the project refuses the file with Invalid agent file ... at tool_configs[N], so agents push, deploy, and most other project commands fail until the file is hand-edited (and removing the tool then deletes it server-side on push).

After: Agent files accept server route tools. A pulled route tool round-trips into the agents push PUT body unchanged, and method / description get the same defaults the server uses ("post", "agent server route"). Malformed route tools are still rejected locally, with the same rules the server applies.

How: Adds a ServerRouteToolConfigSchema variant to the ToolConfigSchema union in packages/cli/src/core/resources/agent/schema.ts, mirroring apper's ServerRouteToolConfig (backend/app/user_apps/app_agents/server_route_tools.py) and validated_route_path (backend/app/fullstack_hosting/route_path.py): tool_name matches ^[A-Za-z0-9_-]{1,64}$; route_path is trimmed, at most 2000 characters, and must fully match /(?!/)[A-Za-z0-9\-._~!$&'()*+,;=:@%/]* (single leading /, no //, backslash, ? or #); method is one of get/post/put/patch/delete.

Related Issue

BUG-1059: https://issue-tracker.base44.app/issue/BUG-1059

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Changes Made

  • schema.ts: new ServerRouteToolConfigSchema in the tool-config union.
  • tests/core/agents-schema.spec.ts: route tool parse round-trip (deep-equal), defaults when method/description are omitted, and rejection of a bad tool_name (space, >64 chars), blank / //evil.example/x / non-relative / ?query / >2000-char route_path, and method: "head".
  • tests/cli/agents_pull.spec.ts: mocked GET returning an agent with an entity tool and a route tool → agents pull → agents push --yes; asserts the PUT body equals the GET payload.
  • CHANGELOG.md: Unreleased › Fixed entry.

No other place in the CLI enumerates tool types (type generation only uses agent names; templates and fixtures use entity tools only).

Testing

  • bun run typecheck - clean
  • bun run lint - clean (the one "info" is pre-existing on main)
  • bun run build && bun run test (packages/cli) - 1119 passed, 19 skipped, 2 failed: both in tests/cli/dev.spec.ts (Deno fallback runtime / frontend process stop), which fail identically on unmodified main in this environment (no Deno installed)
  • The new schema and pull→push tests fail without the schema change and pass with it

Additional Notes

Possible follow-up (deliberately not in this PR): the tool variants are plain z.object, so the CLI hard-fails on any tool type the server adds later and silently strips unknown keys from known shapes before a push. Making the variants z.looseObject (and/or adding a final pass-through fallback to the union, leaving validation of unknown tool types to the server) would stop this class of bug recurring.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FH6Ycrnejz2JBWgXbshcnr

`agents pull` writes the server's tool_configs verbatim, including the
server route tools the backend added (tool_name, route_path, method,
description), but the agent file schema only knew entity and backend
function tools, so every later command that reads the project failed at
tool_configs[N]. Add a ServerRouteToolConfigSchema variant mirroring the
backend's ServerRouteToolConfig and validated_route_path.

BUG-1059

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FH6Ycrnejz2JBWgXbshcnr
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.2.2-pr.680.e01ae1e

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.2.2-pr.680.e01ae1e"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.2.2-pr.680.e01ae1e"
  }
}

Preview published to npm registry — try new features instantly!

@netanelgilad
netanelgilad merged commit 5388221 into main Oct 25, 2026
18 checks passed
@netanelgilad
netanelgilad deleted the claude/agent-server-route-tools branch October 25, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants