all-mdapi-sync-calls-must-wrap-asyncio-to-thread
All simple-salesforce mdapi.* calls (mdapi.deploy, mdapi.retrieve, mdapi.CustomObject.create, mdapi.read_metadata, etc.) are synchronous blocking operations. Calling them directly inside async MCP tool functions blocks the event loop. Every mdapi.* invocation must be wrapped in await asyncio.to_thread(conn.mdapi.method, *args, **kwargs). asyncio.to_thread supports kwargs natively.
Related
- mdapi-sync-calls-in-async-context-require-asyncio-to-thread
- salesforce
- simple-salesforce-mdapi-sync-must-wrap-asyncio-to-thread
- mdapi-deploy-blocking-requires-asyncio-to-thread
- simple-salesforce-mdapi-sync-calls-need-asyncio-to-thread
- salesforce-restful-supports-both-data-and-json-kwargs
- all-simple-salesforce-mdapi-sync-calls-must-use-asyncio-to-t
- sfdc-mdapi-async-wrapping-law3-requirement
- sf-read-metadata-does-not-support-flow-type