README.md•3.85 kB
# Universal Tool Runner Container
A single container that handles multiple tool operations. All tools share the same container image, keeping the deployment simple.
This demonstrates the power of "Bring Your Own Binary" - we've added git, jq, and Node.js all in one container!
## Supported Operations
The container determines which operation to run based on the input fields provided.
### 1. Echo Message
Echoes back any message provided.
**Input field:** `message`
**Request:**
```json
{
"message": "Hello world"
}
```
**Response:**
```json
{
"tool": "echo_message",
"message": "Hello world",
"input": { "message": "Hello world" },
"timestamp": "2025-10-28T12:00:00.000Z",
"instanceId": "abc123"
}
```
### 2. Why Are We Yelling (Uppercase)
Converts text to uppercase. Perfect for when you need to EMPHASIZE something!
**Input field:** `text`
**Request:**
```json
{
"text": "why are we yelling"
}
```
**Response:**
```json
{
"tool": "why_are_we_yelling",
"originalText": "why are we yelling",
"yelledText": "WHY ARE WE YELLING",
"timestamp": "2025-10-28T12:00:00.000Z",
"instanceId": "abc123"
}
```
### 3. Query JSON (jq)
Process JSON data using jq filter syntax.
**Input fields:** `filter` and `data`
**Request:**
```json
{
"filter": ".users[] | select(.age > 25)",
"data": {
"users": [
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 20}
]
}
}
```
**Response:**
```json
{
"tool": "query_json",
"filter": ".users[] | select(.age > 25)",
"result": {"name": "Alice", "age": 30},
"timestamp": "2025-10-28T12:00:00.000Z",
"instanceId": "abc123"
}
```
### 4. Summarize Repository README
Clones a GitHub repository and returns the README content with summary statistics.
**Input field:** `repo_url`
**Request:**
```json
{
"repo_url": "https://github.com/fiberplane/mcp-lite"
}
```
**Response:**
```json
{
"tool": "summarize_repo_readme",
"repo": "mcp-lite",
"repoUrl": "https://github.com/fiberplane/mcp-lite",
"readmeFile": "README.md",
"title": "mcp-lite",
"preview": "# mcp-lite\n\nA minimal implementation...",
"stats": {
"totalLines": 245,
"totalChars": 8942,
"previewLines": 50
},
"timestamp": "2025-10-28T12:00:00.000Z",
"instanceId": "abc123"
}
```
## API
**POST /execute**
The container automatically determines the operation based on input fields:
- `repo_url` → git clone + README summary
- `filter` + `data` → jq JSON processing
- `text` → uppercase operation
- `message` → echo operation
## Local Testing
```bash
# Build the container
docker build -t tool-runner .
# Run it
docker run -p 8080:8080 tool-runner
# Test echo
curl -X POST http://localhost:8080/execute \
-H "Content-Type: application/json" \
-d '{"message": "Hello!"}'
# Test uppercase
curl -X POST http://localhost:8080/execute \
-H "Content-Type: application/json" \
-d '{"text": "this will be loud"}'
# Test jq
curl -X POST http://localhost:8080/execute \
-H "Content-Type: application/json" \
-d '{"filter": ".name", "data": {"name": "Alice", "age": 30}}'
# Test git clone + summarize
curl -X POST http://localhost:8080/execute \
-H "Content-Type: application/json" \
-d '{"repo_url": "https://github.com/fiberplane/mcp-lite"}'
```
## Why One Container?
Using a single universal container simplifies the demo:
- Only one Docker image to build and deploy
- Faster deployment times
- Easier to understand architecture
- All tools share the same runtime environment
- **Shows BYOB concept**: git + jq + Node.js all in one place!
In production, you might split these into separate containers for:
- Independent scaling
- Different resource requirements
- Isolation of dependencies
## Tools Included
- **Node.js 20** - Runtime for the HTTP server
- **jq** - JSON processor
- **git** - Version control for cloning repos