fix: ensure inputSchema always includes properties key for OpenAI-compatible clients#70
Conversation
…patible clients
Clients like LM Studio and Claude Code require `properties` to always be
present in a tool's `inputSchema`, even when empty. Without it they throw:
request.tools.[n].input_schema.properties: Required
Two changes:
- ToolRegistry.ts: normalize `inputSchema` in `list()` by falling back to
`{}` when ArkType's toJsonSchema() omits the `properties` key (e.g. for
`Record<string, unknown>` schemas that emit `additionalProperties` only)
- plugin-templater.ts: change value imports from `obsidian` to `import type`
so the shared package can be bundled by bun compile (obsidian has no JS
entry point, only type declarations)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
✅ Deploy Preview for superb-starlight-b5acb5 canceled.
|
|
Hi @asandres-eng — heads-up that this PR will likely sit unmerged on the unmaintained upstream (per #79, declared 2026-04-24). The equivalent fix shipped in the community fork If you're consuming MCP-for-Obsidian from a strict-schema client (OpenAI Codex, Letta, etc.), |
Summary
ToolRegistry.ts: In thelist()method, normalize each tool'sinputSchemato always include apropertieskey (falling back to{}). OpenAI-compatible clients (LM Studio, Claude Code) requirepropertiesto be present even when empty — without it they throwrequest.tools.[n].input_schema.properties: Required. Root cause: ArkType'stoJsonSchema()forRecord<string, unknown>emits{"type":"object","additionalProperties":{}}with nopropertieskey.plugin-templater.ts: Change value imports from theobsidianpackage toimport type. Theobsidianpackage has"main": ""(types only, no JS entry point), so bun compile was failing to resolve it at build time. All usages were type annotations only — no runtime impact.Test plan
bun run check— no type errorsbun test— existing tests pass (4 pre-existing failures inparseTemplateParametersunrelated to these changes)bun run buildinpackages/mcp-server— binary compiles successfullylist_toolsvia MCP inspector — verify everyinputSchemahas apropertieskey, especiallyget_server_infoanddelete_active_file🤖 Generated with Claude Code