Bash Mode + Flexible Tool Descriptions + Registry-Based Tool Management#56
Merged
Bash Mode + Flexible Tool Descriptions + Registry-Based Tool Management#56
Conversation
Signed-off-by: Elias Posen <elias@posen.ch>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a comprehensive system for organizing, customizing, and managing pctx tool descriptions across all AI frameworks (LangChain, CrewAI, OpenAI Agents SDK, Pydantic AI). It adds filesystem-based SDK exploration as a first-class workflow alongside the traditional discovery tools, making tool descriptions fully customizable and enabling arbitrary tool combinations.
What's New
1. Filesystem Mode for SDK Exploration
Added
execute_bashandexecute_typescripttools that present the TypeScript SDK as an in-memory filesystem, enabling exploration using familiar bash commands:Workflow:
execute_bashto explore:cat README.md,ls Tools/,grep -r "functionName"cat Tools/functionName.d.tsexecute_typescriptusing the discovered functionsThis provides an alternative to the traditional
list_functions→get_function_details→executeworkflow, particularly useful for developers who prefer command-line exploration.2. Organized Tool Description System
Tool descriptions are now organized into styles that users can choose between:
Users can swap styles:
3. Tool Registry Pattern (Maintainability)
Refactored tool registration from 24 scattered if-statements across 4 framework adapters to a single registry with exhaustive validation.
4. Mix-and-Match Tool Configurations
Users can create arbitrary tool combinations for custom workflows:
5. Workflow Guidance System
Added contextual prompts that help AI agents understand tool combinations:
Examples: Before & After
Example 1: Filesystem Exploration
Before: Only one workflow (
list→get_details→execute)After:
Example 2: Description Styles
Before: Descriptions hardcoded, no alternatives
After:
Example 3: Single-Tool Use Case
Before: Had to include full preset mode
After:
Technical Details
Files Changed
New:
pctx-py/src/pctx_client/_tool_registry.py- Central tool registry with validationpctx-py/src/pctx_client/tools.py-ToolConfigdataclass, mode definitionspctx-py/src/pctx_client/tool_descriptions/- Organized description stylesprescriptive/*.py- Detailed descriptions (default)terminal/*.py- Concise descriptionsworkflows.py- Workflow guidance generatorModified:
pctx-py/src/pctx_client/_client.py- Refactored 4 framework adapters to use registrypctx-py/tests/test_tool_converters.py- Added 14 new tests (66 total)Test Coverage
New test classes:
TestToolRegistry(3 tests) - Registry validationTestToolConfigMixAndMatch(11 tests) - Custom combinationsCoverage includes: single tool configs across all frameworks, filesystem mode (
execute_bash+execute_typescript), custom tool combinations, custom descriptions withToolConfig, all 6 tools simultaneously, cross-framework consistency, and edge cases (empty lists, duplicates, ordering).Result: 66 tests passing (up from 52)
Migration Guide
This is 100% backward compatible:
New capabilities:
Benefits Summary
For Users:
For Maintainers:
ToolNameliterals