34 lines
955 B
Python
34 lines
955 B
Python
import json
|
|
|
|
def simulate_lisp_to_schema(fn_name, params, docstring):
|
|
"""
|
|
Simulates the transformation of a Lisp signature to Gemini JSON Tool Schema.
|
|
"""
|
|
schema = {
|
|
"name": fn_name.lower().replace("-", "_"),
|
|
"description": docstring,
|
|
"parameters": {
|
|
"type": "object",
|
|
"properties": {
|
|
p: {"type": "string"} for p in params
|
|
},
|
|
"required": params
|
|
}
|
|
}
|
|
return schema
|
|
|
|
if __name__ == "__main__":
|
|
print("--- Test: Lisp to Gemini Schema ---")
|
|
|
|
fn = "scaffold-project"
|
|
params = ["name", "type"]
|
|
doc = "Physically creates the material PSF project."
|
|
|
|
expected_name = "scaffold_project"
|
|
|
|
result = simulate_lisp_to_schema(fn, params, doc)
|
|
print(json.dumps(result, indent=2))
|
|
|
|
status = "PASS" if result["name"] == expected_name and "parameters" in result else "FAIL"
|
|
print(f"\nStatus: {status}")
|