Skip to content

[Enhancement]: Support Programmatic Tool Calling in standard/default endpoint chats #15872

Description

@jacksonriding

What features would you like to see added?

Add support for Programmatic Tool Calling (PTC) outside of the Agents runtime, so it can be enabled for normal/default LibreChat endpoint chats such as OpenAI, Anthropic, Bedrock, and compatible custom endpoints.

Today, PTC is effectively tied to Agents-backed flows with Code Interpreter / programmatic_tools. This means an administrator who wants PTC available as part of the normal company-wide chat experience has to route users through Agents or hide that plumbing behind an Agents-backed Model Spec.

It would be useful to support PTC as a first-class endpoint capability that administrators can enable centrally for standard chats.

Why this matters

For enterprise deployments, we often want a simple default experience:

User opens LibreChat
  -> selects an approved model
  -> asks a question
  -> LibreChat can automatically use MCP tools programmatically when appropriate

without requiring users to:

  • create/select an Agent
  • understand the Agent Builder
  • manually enable Code Interpreter / programmatic tools
  • use a separate Agents-backed model entry just to gain PTC

PTC is particularly valuable in internal tooling because it can reduce model cost and latency for multi-step MCP workflows. Instead of repeatedly returning each intermediate tool result to the model, code can orchestrate, filter, aggregate, paginate, and loop over MCP calls before returning a compact result.

Example:

Current native tool loop:
Model -> MCP A -> Model -> MCP B -> Model -> MCP C -> Model

PTC:
Model -> code execution -> MCP A/B/C + filtering/aggregation -> Model

For organisations with many internal MCP integrations, making this available in ordinary chats would make PTC much easier to deploy as a default optimisation rather than an Agent-specific feature.

Suggested configuration

Something along these lines would be ideal:

endpoints:
  anthropic:
    programmaticTools: true
    executeCode: true

  openAI:
    programmaticTools: true
    executeCode: true

or a global capability configuration such as:

interface:
  programmaticTools: true

The exact configuration is not important; the main request is that PTC should not require the conversation to use the agents endpoint.

It would also be useful if administrators could control which MCP servers/tools are eligible for programmatic execution globally or per Model Spec, e.g.:

programmaticTools:
  enabled: true
  mcpServers:
    - internal-search
    - github
    - servicenow

Expected behaviour

When enabled for a standard endpoint chat:

  1. The model can use ordinary native tool calling as it does today.
  2. Eligible MCP tools are also available through the PTC / Code Interpreter execution path.
  3. LibreChat can broker those MCP calls through the existing Tool Call Server rather than granting the sandbox unrestricted network access.
  4. Administrators retain control over which MCP tools can be called programmatically.
  5. Existing endpoint chats behave exactly as they do today when PTC is disabled.

Potential implementation direction

If the existing PTC implementation is strongly coupled to the Agents runtime, this could potentially be implemented by extracting the relevant PTC capability into reusable endpoint-level middleware/runtime functionality rather than duplicating the implementation.

The same underlying pieces already appear to exist:

  • Code Interpreter
  • Tool Call Server
  • MCP tool registration
  • programmatic execution wrappers
  • request-scoped MCP tooling

The enhancement would primarily expose that capability to ordinary endpoint conversations rather than only Agents-backed conversations.

Acceptance criteria

  • PTC can be enabled for at least the standard OpenAI and Anthropic endpoint chat flows without using the agents endpoint.
  • Existing MCP tools can be explicitly marked/allowed for programmatic use in those chats.
  • Programmatic MCP calls continue to use LibreChat's brokered Tool Call Server / security model.
  • Administrators can enable/disable the capability globally or per endpoint / Model Spec.
  • Users do not need to create or select an Agent to use PTC.
  • Existing behaviour is unchanged when the capability is disabled.
  • Documentation explains how PTC differs between ordinary native tool calling and programmatic execution.

Which components are impacted by your request?

  • Endpoints
  • MCP
  • Code Interpreter
  • Programmatic Tool Calling
  • Model Specs / configuration
  • Enterprise / administrator configuration

Additional context

Agents-backed Model Specs are a workable current workaround, but they still require the deployment to use the Agents runtime underneath. The goal of this request is to make PTC a reusable LibreChat capability rather than an Agent-only capability.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions