Skip to main content
Glama

optimize_code

Optimize code for large datasets by analyzing R, Stata, or Python scripts and suggesting performance improvements based on data size specifications.

Instructions

대용량 데이터용 코드 최적화 제안

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes최적화할 코드
data_sizeNo데이터 크기 (행 수, GB)
languageYes언어

Implementation Reference

  • Registration of the 'optimize_code' tool in the exported tools array, including name, description, and input schema definition.
    name: "optimize_code", description: "대용량 데이터용 코드 최적화 제안", inputSchema: { type: "object", properties: { code: { type: "string", description: "최적화할 코드" }, data_size: { type: "string", description: "데이터 크기 (행 수, GB)" }, language: { type: "string", enum: ["r", "stata", "python"], description: "언어" }, }, required: ["code", "language"], }, },
  • The implementation of the 'optimize_code' tool handler. It returns language-specific recommendations for optimizing code for large datasets, ignoring the provided code snippet.
    function handleOptimizeCode(args: Record<string, unknown>) { return { language: args.language, data_size: args.data_size, recommendations: { r: ["Use data.table instead of data.frame", "Use fst for file I/O", "Consider collapse package"], stata: ["Use gtools (gisid, gegen)", "Use ftools (reghdfe)", "Compress data"], python: ["Use pandas with chunking", "Consider dask or polars", "Use parquet format"] } }; }
  • The switch case in the main handleToolCall function that routes calls to the 'optimize_code' handler.
    case "optimize_code": return handleOptimizeCode(args);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/seanshin0214/quantmaster-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server