Skip to content

Revisit tools approach #58

@swissspidy

Description

@swissspidy

In the hackathon, we built a solution to automatically expose any REST API route as an MCP tool for function calling. This enabled us to quickly unlock a lot of use cases without any repetition. However, this also has some drawbacks:

  1. We add a lot of tools out of the box, polluting the LLM's context
  2. The input schemas for the tools are way too complex. Is the AI agent really ever going to construct a complex meta query? Probably not.
  3. We send tools for every route, even if the user doesn't have the capability to access the data
  4. The auto-generated descriptions are very generic (and not translatable), making it difficult for the LLM to understand the tool
    • At the hackathon we discussed that theoretically every route should have its proper description in core, but this ship has sailed

We should revisit this. An approach more similar to https://github.com/Automattic/wp-feature-api might make sense, where we manually define the tools for specific use cases. Still covering most CRUD operations, but with better quality.

See https://github.com/Automattic/wp-feature-api/blob/7d837ca7bbe40abbe7d7e4eed446e840fa90003c/includes/default-wp-features.php#L42-L79 and https://github.com/Automattic/wp-feature-api/blob/7d837ca7bbe40abbe7d7e4eed446e840fa90003c/includes/class-wp-feature.php#L730-L766 for inspiration.

What's still needed there is of course permissions checks for exposing the tool in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions