Skip to content

Code mode / bulk tool execution #222

Description

@swissspidy

Code mode or code execution with MCP is a concept that was more broadly shared late last year:

https://www.anthropic.com/engineering/code-execution-with-mcp
https://blog.cloudflare.com/code-mode/

I was wondering how this concept could be applied to WebMCP so I was tinkering with it over at GoogleChromeLabs/webmcp-tools#287

The idea is simple: instead of (or in addition to) exposing every single WebMCP tool to an agent, there's a single execute_tools tool that allows the agent to execute N tools in one go.

Let's take this Pizza Maker demo as an example. To create a pizza, you'd normally call tools such as set_pizza_size, set_pizza_style, and add_topping one after the other. That's a lot of roundtrips and a lot of tokens. The same task with execute_batch could be accomplished with a single tool call execute_tools([set_pizza_size, set_pizza_style, add_topping]).

Early testing shows greatly reduced number of roundtrips, token usage, and increased speed. Which is why I think this could be really interesting for both website developers as well as the agent developers. Such an execute_tools function could be implemented on either side.

Of course this works best for more deterministic scenarios that don't involve dynamic tool additions or page navigations. So it made me wonder how the WebMCP spec could help in this case. For example with a new ToolAnnotation to mark tools suitable for this kind of batching. (See also #176). Or a way to define meta tools such as make_pizza, which under the hood would be execute_tools([set_pizza_size, set_pizza_style, add_topping])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions