Skip to content

Allow APIs to be exposed as MCP tools #735

@Kaliumhexacyanoferrat

Description

@Kaliumhexacyanoferrat

As a developer of an API, I would like to plug the functionality provided by my services into a LLM, so that I can use the functionality within chat bots.

Example

As we have a model to define and execute operations, we could automatically discover the endpoints provided by a service and expose them as tools. This will skip the handler chain for those methods, allowing us to provide tools with another authentication mechanism as we use for the API itself.

var api = Layout.Create()
                .AddService<...>()
                .Add("other", Inline.Create());

var app = Layout.Create()
                .Add("api", api)
                .AddTools();

Maybe we can also pass a ToolsBuilder as proposed in #719.

Image

Challenging part will be to make all this work with code generation (see #732).

Acceptance criteria

  • The feature is implemented in a new GenHTTP module (or within Tools if something like Tools.Discovery() feels good)
  • Discovery features are extracted from the OpenApi package and generalized where needed
  • The functionality relies on the Tools capabilities and does not implement this functionality itself
  • Users can opt-out (or opt-in?) for specific methods to be available as tools
  • Users can add descriptions for tools so they can be better utilized by LLMs (and this description is then also used by the Open API module)
  • The feature is documented on the GenHTTP website
  • The feature is covered by acceptance tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions