MCP Tools with Dependent Types: A Defold Editor Experiment
This post details an experiment using a Large Language Model (LLM) within the Defold game editor. The author initially attempted to use Claude to directly manipulate Lua code, but faced low accuracy. The proposed solution involved using JSON Schemas to define tool inputs, but this ran into a limitation: the inability to implement dependent types within the Model-Code-Prompt (MCP) framework. This means the structure of tool input depends on runtime information. For example, editing 3D models requires different properties depending on the chosen material. The solution is a two-step process: the LLM selects a resource, the program looks up its data structure and constructs a JSON Schema; then, the LLM uses this schema to generate edits. The author suggests MCP should support dependent types to handle complex data more effectively.