Skip to content

feat(web): improve agent performance, MCP tools, and much more#1014

Merged
brendan-kellam merged 48 commits intomainfrom
bkellam/agent-improvements
Mar 23, 2026
Merged

feat(web): improve agent performance, MCP tools, and much more#1014
brendan-kellam merged 48 commits intomainfrom
bkellam/agent-improvements

Conversation

@brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Mar 18, 2026

This PR is effectively a re-work of the tools we ship in our MCP server & ask agent. There are many details & changes in this PR, most of which are covered in the changelog. In terms of the impact of this PR:

  • Tool outputs have been optimized to minimize the amount of tokens. Impact: thread will use significantly less tokens (~95% reduction in the brief tests I ran)
  • Changed search_code to look like grep (also renamed it to grep). Agents have a much easier time using understanding and using the grep syntax over our custom search syntax. Impact: The agent will be able to search and find things much more effectively and efficiently.
  • Added groupByRepo to grep (prev. search_code) to allow agents to get compact responses that aggregate search results by repo. Impact: Agents are able to get a high-level overview of what terms exist in which repositories without blowing up their context window. This is really helpful when searching over a large number of repos since it gives the agent the ability to narrow down it's search to only repositories that are relevant.
  • Added glob, and listTree tools. Impact: the agent has additional mechanisms for exploring repositories.
  • Removed the constraint on the search scope selector that required at least one repository to be selected. Impact: it's much easier to search across everything.

Fixes #911
Fixes #848

Summary

  • Introduces a shared ToolDefinition<TName, TShape, TMetadata> abstraction in features/tools/ with a unified execute(input, context) signature and ToolResult<TMetadata> return shape
  • All tools (read_file, list_commits, list_repos, search_code, find_symbol_references, find_symbol_definitions, list_tree) are now defined once and registered with both the Vercel AI agent and the MCP server via toVercelAITool and registerMcpTool adapters
  • Adapters inject call-site context (source: 'agent' or source: 'mcp') into every tool execution
  • isReadOnly and isIdempotent hints are declared on each tool definition and forwarded to MCP annotations via registerMcpTool
  • Tool names normalized to snake_case throughout; toolNames constant eliminated in favour of xDefinition.name
  • Added list_tree tool to the Vercel AI agent with a UI component in the details card
  • Tool metadata fields normalized (repositoryrepo); webUrl added to search_code output
  • Shared logger.ts for tools; debug logging added to all tools using consistent snake_case names
  • Tool descriptions updated with usage guidance (retry on repo-not-found errors, list_repos discovery, webUrl linking)
  • Copy-to-clipboard button moved into ToolHeader so all tool components get it for free

Loading
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.

[bug] Ask can throw "prompt is too long: x tokens > y maximum" [FR] Improve support for asking questions over a large number of repositories

1 participant