-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Description
Attempting to develop a python https://mcp.run plugin, after extism.input(CallToolRequest) did not work as method is not optional due to the bindgen not supporting required: dylibso/xtp-python-bindgen#16 (comment), I decided to abandon strong typing and load input into a dict.
I switched the code of call in __init__.py to.
data = extism.input_json()
res = plugin.call(data)Unfortunately this fails:
gavin@Gavins-MacBook-Pro obsidian % EXTISM_ENABLE_WASI_OUTPUT=1 xtp plugin call plugin.wasm call --input='{
"params": {
"name": "greet",
"arguments":{}
}
}' --wasi
2024/12/18 17:34:50 beginning of call
thread '<unnamed>' panicked at src/lib.rs:58:6:
called `Result::unwrap()` on an `Err` value: PyErr { type: <class 'TypeError'>, value: TypeError('issubclass() arg 1 must be a class'), traceback: Some(<traceback object at 0x68d0a8>) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: wasm error: unreachable
wasm stack trace:
.$10486(i32,i32,i32,i32,i32)
.$10772(i32,i32)
.$10792(i32,i32,i32,i32,i32)
.$10827(i32,i32) i32
.$10846() i32
returned non-zero exit code: 1
Log file: /Users/gavin/Library/Caches/xtp/xtp-1734561289-6311.log
I am able to work around this with import json and data = json.loads(extism.input_str()) instead of using extism's function.