• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
c15r

c15r

ContextualLite

Public
Like
ContextualLite
Home
Code
21
CHANGELOG.md
README.md
auth-manager.ts
claude-desktop-config.json
deploy.ts
example-s3-script.js
example.env
files-store.ts
H
index.ts
kv-store.ts
mcp-config.json
mcp-handler.ts
mcp-http-client.js
package.json
test-code-exec.ts
test-http.ts
test-mcp-jsonrpc.ts
H
test-simple.ts
test.ts
tools.ts
types.ts
Branches
2
Pull requests
Remixes
History
Environment variables
7
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
CHANGELOG.md
Code
/
CHANGELOG.md
Search
6/11/2025
Viewing readonly version of main branch: v197
View latest version
CHANGELOG.md

Changelog - Code-Exec Tool Enhancement

Summary

Updated the code-exec tool to accept either direct code strings or S3 object keys containing code, providing more flexibility for code execution workflows.

Changes Made

1. Enhanced handleCodeExec method in mcp-handler.ts

Before:

  • Only accepted code parameter (direct code string)
  • Required both code and input parameters

After:

  • Accepts either code (direct string) OR key (S3 object key)
  • Validates that only one of code or key is provided
  • Fetches code from S3 when key is specified
  • Improved error handling and logging

2. Updated Tool Definition

Before:

{ "name": "code-exec", "description": "Execute code javscript/ts (must define an async execute function which will recive input, and tools params)", "inputSchema": { "type": "object", "properties": { "code": { "type": "string", "description": "The code to execute" }, "input": { "type": "object", "description": "Input parameters for the skill" } }, "required": ["code", "input"] } }

After:

{ "name": "code-exec", "description": "Execute JavaScript/TypeScript code. The code must define an async execute function which will receive input and tools params. You can provide code either directly as a string or reference an S3 object key containing the code.", "inputSchema": { "type": "object", "properties": { "code": { "type": "string", "description": "The JavaScript/TypeScript code to execute directly (mutually exclusive with 'key')" }, "key": { "type": "string", "description": "S3 object key containing the code to execute (mutually exclusive with 'code')" }, "input": { "type": "object", "description": "Input parameters for the skill execution" } }, "required": ["input"], "oneOf": [ { "required": ["code", "input"] }, { "required": ["key", "input"] } ] } }

3. Updated Documentation

  • Added comprehensive documentation in README.md
  • Included examples for both execution modes
  • Added security considerations
  • Created example S3 script demonstrating best practices

4. Added Example Files

  • example-s3-script.js: Comprehensive example showing how to create reusable code modules
  • test-code-exec.ts: Test suite for the new functionality
  • test-simple.ts: Simple validation test

Usage Examples

Direct Code Execution

curl -X POST https://your-server/mcp \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-aws-secret" \ -d '{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "code-exec", "arguments": { "code": "async function execute(input, tools) { return {message: \"Hello\", input}; }", "input": {"userId": "user123"} } }, "id": 1 }'

S3 Code Execution

curl -X POST https://your-server/mcp \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-aws-secret" \ -d '{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "code-exec", "arguments": { "key": "scripts/data-processor.js", "input": {"userId": "user123", "operation": "analyze"} } }, "id": 1 }'

Benefits

  1. Reusability: Store commonly used scripts in S3 for reuse across multiple executions
  2. Version Control: Manage script versions by updating S3 objects
  3. Collaboration: Share scripts across different users and systems
  4. Maintainability: Separate complex logic into dedicated script files
  5. Flexibility: Choose between inline code for simple operations or S3 scripts for complex workflows

Validation

  • Ensures mutual exclusivity between code and key parameters
  • Validates that at least one code source is provided
  • Proper error handling for S3 fetch failures
  • Maintains backward compatibility with existing direct code usage

Security

  • Same sandboxed execution environment
  • No additional security risks introduced
  • S3 access uses existing AWS authentication
  • Code execution remains restricted to available MCP tools
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.