cs0lar
MCP Servercs0larpublic

treelang

LLM function calling on steroids using Abstract Syntax Trees.

Repository Info

4
Stars
0
Forks
4
Watchers
4
Issues
Python
Language
MIT License
License

About This Server

LLM function calling on steroids using Abstract Syntax Trees.

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

🌲 treelang

!PyPI - Version PyPI Downloads License: MIT

Abstract Syntax Trees (ASTs) for advanced function calling with Large Language Models (LLMs), i.e. function-calling on steroids!

Why treelang

  • Complex worflows: Primarily treelang was created as a practical way to support arbitrarily complex function composition and conditionals, where the answer to a question may involve multiple steps each with its own multiple dependencies.

  • Cost-Saving and Green: With treelang you avoid the typical function-calling loop whereby the LLM outputs a function call, your program evaluates it and returns the result back to the LLM for this cycle to repeat until the final result is computed. treelang generates the AST for the full solution using a single call to the underlying LLM!

  • Security: treelang deals with ASTs which means it never needs to know the result from any node in the tree, which may be sensitive (e.g. "my patients email addresses"). The developer can focus on the reliability and security of the underlying tools that will be used to evaluate the AST.

  • Portability: treelang "packages" solutions into ASTs which means that solutions can be easily reused, shared, cached and interpreted.

  • Automated solutions generator: coming soon...

Features

  • Abstract Syntax Tree Representation: treelang speaks Trees.
  • MCP Client: treelang is an MCP client out of the box but any other method of tool provision can be used via the ToolProvider abstraction.
  • LLM Integration: Use LLMs (e.g., OpenAI models) to generate ASTs.
  • Tool Selection: Dynamically select tools (functions) available in the system.
  • Asynchronous Execution: Fully asynchronous design for efficient computation.
  • Higher Order Functions: Support for functional patterns using lambda, map, filter and reduce nodes.
  • Tool generation from Trees: Convert treelang ASTs into Tools that can be added dynamically to MCP servers.

Installation

 pip install treelang

Resources

  • Cookbooks: Play with the Jupiter Notebooks in the cookbook directory to learn more about treelang.

Quick Start

1

Clone the repository

git clone https://github.com/cs0lar/treelang
2

Install dependencies

cd treelang
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownercs0lar
Repotreelang
LanguagePython
LicenseMIT License
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation