@stackmemoryai/stackmemory
Version:
Project-scoped memory for AI coding tools. Durable context across sessions with MCP integration, frames, smart retrieval, Claude Code skills, and automatic hooks.
126 lines (116 loc) • 3.07 kB
JavaScript
import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
const codeExecutionTools = [
{
name: "code.execute",
description: "Execute Python, JavaScript, or TypeScript code in a sandboxed environment",
inputSchema: {
type: "object",
properties: {
language: {
type: "string",
enum: ["python", "javascript", "typescript"],
description: "Programming language to execute"
},
code: {
type: "string",
description: "Code to execute"
},
workingDirectory: {
type: "string",
description: "Optional working directory for execution"
},
timeout: {
type: "number",
description: "Execution timeout in milliseconds (default: 30000)"
},
force: {
type: "boolean",
description: "Force execution even if code validation fails"
}
},
required: ["language", "code"]
}
},
{
name: "code.validate",
description: "Validate code for potential security issues",
inputSchema: {
type: "object",
properties: {
code: {
type: "string",
description: "Code to validate"
}
},
required: ["code"]
}
},
{
name: "code.sandbox_status",
description: "Get status of the code execution sandbox",
inputSchema: {
type: "object",
properties: {}
}
},
{
name: "code.clean_sandbox",
description: "Clean temporary files from the sandbox",
inputSchema: {
type: "object",
properties: {}
}
}
];
const codeOnlyModeExample = `
\`\`\`python
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.plot(x, y)
plt.title('Sine Wave')
plt.xlabel('X')
plt.ylabel('Y')
mean_y = np.mean(y)
std_y = np.std(y)
print(f"Mean: {mean_y:.4f}")
print(f"Std: {std_y:.4f}")
\`\`\`
\`\`\`javascript
// Process data
const data = Array.from({length: 10}, (_, i) => i ** 2);
// Calculate sum
const sum = data.reduce((a, b) => a + b, 0);
console.log('Sum of squares:', sum);
// Async operation
async function fetchData() {
// Simulate API call
await new Promise(resolve => setTimeout(resolve, 100));
return { status: 'success', data: [1, 2, 3] };
}
fetchData().then(result => {
console.log('Async result:', result);
});
\`\`\`
1. Safe computational environment
2. No file system modifications
3. No network access
4. Pure problem-solving focus
5. Ideal for algorithms, data analysis, and mathematical computations
`;
export {
codeExecutionTools,
codeOnlyModeExample
};
//# sourceMappingURL=tool-definitions-code.js.map