Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Misc. bug: Complex tool calling schema causes an "Unrecognized Schema" exception #14227

Open
@em-3

Description

@em-3

Name and Version

./llama-cli --version
ggml_cuda_init: GGML_CUDA_FORCE_MMQ:    no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
  Device 0: NVIDIA GeForce RTX 4070, compute capability 8.9, VMM: yes
load_backend: loaded CUDA backend from llama.cpp\ggml-cuda.dll
load_backend: loaded RPC backend from llama.cpp\ggml-rpc.dll
load_backend: loaded CPU backend from llama.cpp\ggml-cpu-alderlake.dll
version: 5684 (6adc3c3e)
built with clang version 18.1.8 for x86_64-pc-windows-msvc

Operating systems

Windows

Which llama.cpp modules do you know to be affected?

llama-server

Command line

llama-server --port 5001 --no-webui --flash-attn --threads 8 --model models/unsloth/qwen-3/Qwen3-14B-UD-Q6_K_XL.gguf --jinja --n-gpu-layers 27 --ctx-size 8192 --temp 0.6 --top_k 20 --top_p 0.8 --min_p 0.01 --verbose

Problem description & steps to reproduce

When llama-server encounters complex JSON schemas for tool calling, particularly those including the not and anyOf options, it causes an Unrecognized Schema exception which results in the generation failing.

In my case, this occurred while trying to use MCP with LibreChat and MarkusPfundstein's mcp-obsidian MCP server. The cause of the problem appears to be LibreChat's verbose tool calling JSON schemas, which other inference providers such as TabbyAPI and Gemini are capable of parsing.

To reproduce:

  1. Start llama-server with any tool-calling capable model such as Qwen3
  2. Using a frontend like LibreChat, attempt to run an MCP-enabled generation with mcp-obsidian or mcp-filesystem
  3. The server should emit an Unrecognized Schema error

First Bad Commit

No response

Relevant log output

srv  log_server_r: request: POST /v1/chat/completions 127.0.0.1 500
srv  log_server_r: request:  {
  "model": "default-model",
  "stream": true,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "obsidian_list_files_in_dir_mcp_mcp-obsidian",
        "description": "Lists all files and directories that exist in a specific Obsidian directory.",
        "parameters": {
          "type": "object",
          "properties": {
            "dirpath": {
              "type": "string",
              "description": "Path to list files from (relative to your vault root). Note that empty directories will not be returned."
            }
          },
          "required": [
            "dirpath"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_list_files_in_vault_mcp_mcp-obsidian",
        "description": "Lists all files and directories in the root directory of your Obsidian vault.",
        "parameters": {
          "type": "object",
          "properties": {},
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_get_file_contents_mcp_mcp-obsidian",
        "description": "Return the content of a single file in your vault.",
        "parameters": {
          "type": "object",
          "properties": {
            "filepath": {
              "type": "string",
              "description": "Path to the relevant file (relative to your vault root)."
            }
          },
          "required": [
            "filepath"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_simple_search_mcp_mcp-obsidian",
        "description": "Simple search for documents matching a specified text query across all files in the vault. \n            Use this tool when you want to do a simple text search",
        "parameters": {
          "type": "object",
          "properties": {
            "query": {
              "type": "string",
              "description": "Text to a simple search for in the vault."
            },
            "context_length": {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "not": {}
                    },
                    {
                      "description": "How much context to return around the matching string (default: 100)"
                    }
                  ],
                  "description": "How much context to return around the matching string (default: 100)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "How much context to return around the matching string (default: 100)"
            }
          },
          "required": [
            "query"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_patch_content_mcp_mcp-obsidian",
        "description": "Insert content into an existing note relative to a heading, block reference, or frontmatter field.",
        "parameters": {
          "type": "object",
          "properties": {
            "filepath": {
              "type": "string",
              "description": "Path to the file (relative to vault root)"
            },
            "operation": {
              "type": "string",
              "enum": [
                "append",
                "prepend",
                "replace"
              ],
              "description": "Operation to perform (append, prepend, or replace)"
            },
            "target_type": {
              "type": "string",
              "enum": [
                "heading",
                "block",
                "frontmatter"
              ],
              "description": "Type of target to patch"
            },
            "target": {
              "type": "string",
              "description": "Target identifier (heading path, block reference, or frontmatter field)"
            },
            "content": {
              "type": "string",
              "description": "Content to insert"
            }
          },
          "required": [
            "filepath",
            "operation",
            "target_type",
            "target",
            "content"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_append_content_mcp_mcp-obsidian",
        "description": "Append content to a new or existing file in the vault.",
        "parameters": {
          "type": "object",
          "properties": {
            "filepath": {
              "type": "string",
              "description": "Path to the file (relative to vault root)"
            },
            "content": {
              "type": "string",
              "description": "Content to append to the file"
            }
          },
          "required": [
            "filepath",
            "content"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_delete_file_mcp_mcp-obsidian",
        "description": "Delete a file or directory from the vault.",
        "parameters": {
          "type": "object",
          "properties": {
            "filepath": {
              "type": "string",
              "description": "Path to the file or directory to delete (relative to vault root)"
            },
            "confirm": {
              "type": "boolean",
              "description": "Confirmation to delete the file (must be true)"
            }
          },
          "required": [
            "filepath",
            "confirm"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_complex_search_mcp_mcp-obsidian",
        "description": "Complex search for documents using a JsonLogic query. \n           Supports standard JsonLogic operators plus 'glob' and 'regexp' for pattern matching. Results must be non-falsy.\n\n           Use this tool when you want to do a complex search, e.g. for all documents with certain tags etc.\n           ",
        "parameters": {
          "type": "object",
          "properties": {
            "query": {
              "type": "object",
              "properties": {},
              "additionalProperties": false,
              "description": "JsonLogic query object. Example: {\"glob\": [\"*.md\", {\"var\": \"path\"}]} matches all markdown files"
            }
          },
          "required": [
            "query"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_batch_get_file_contents_mcp_mcp-obsidian",
        "description": "Return the contents of multiple files in your vault, concatenated with headers.",
        "parameters": {
          "type": "object",
          "properties": {
            "filepaths": {
              "type": "array",
              "items": {
                "type": "string",
                "description": "Path to a file (relative to your vault root)"
              },
              "description": "List of file paths to read"
            }
          },
          "required": [
            "filepaths"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_get_periodic_note_mcp_mcp-obsidian",
        "description": "Get current periodic note for the specified period.",
        "parameters": {
          "type": "object",
          "properties": {
            "period": {
              "type": "string",
              "enum": [
                "daily",
                "weekly",
                "monthly",
                "quarterly",
                "yearly"
              ],
              "description": "The period type (daily, weekly, monthly, quarterly, yearly)"
            }
          },
          "required": [
            "period"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_get_recent_periodic_notes_mcp_mcp-obsidian",
        "description": "Get most recent periodic notes for the specified period type.",
        "parameters": {
          "type": "object",
          "properties": {
            "period": {
              "type": "string",
              "enum": [
                "daily",
                "weekly",
                "monthly",
                "quarterly",
                "yearly"
              ],
              "description": "The period type (daily, weekly, monthly, quarterly, yearly)"
            },
            "limit": {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "not": {}
                    },
                    {
                      "description": "Maximum number of notes to return (default: 5)"
                    }
                  ],
                  "description": "Maximum number of notes to return (default: 5)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of notes to return (default: 5)"
            },
            "include_content": {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "not": {}
                    },
                    {
                      "type": "boolean",
                      "description": "Whether to include note content (default: false)"
                    }
                  ],
                  "description": "Whether to include note content (default: false)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Whether to include note content (default: false)"
            }
          },
          "required": [
            "period"
          ],
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "obsidian_get_recent_changes_mcp_mcp-obsidian",
        "description": "Get recently modified files in the vault.",
        "parameters": {
          "type": "object",
          "properties": {
            "limit": {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "not": {}
                    },
                    {
                      "description": "Maximum number of files to return (default: 10)"
                    }
                  ],
                  "description": "Maximum number of files to return (default: 10)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Maximum number of files to return (default: 10)"
            },
            "days": {
              "anyOf": [
                {
                  "anyOf": [
                    {
                      "not": {}
                    },
                    {
                      "description": "Only include files modified within this many days (default: 90)"
                    }
                  ],
                  "description": "Only include files modified within this many days (default: 90)"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Only include files modified within this many days (default: 90)"
            }
          },
          "additionalProperties": false,
          "$schema": "http://json-schema.org/draft-07/schema#"
        }
      }
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "List the notes in my vault, please"
        }
      ]
    }
  ]
}
srv  log_server_r: response: {"error":{"code":500,"message":"JSON schema conversion failed:\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"description\":\"How much context to return around the matching string (default: 100)\"}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"description\":\"How much context to return around the matching string (default: 100)\"}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"description\":\"Maximum number of notes to return (default: 5)\"}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"description\":\"Maximum number of notes to return (default: 5)\"}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"description\":\"Maximum number of files to return (default: 10)\"}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"description\":\"Only include files modified within this many days (default: 90)\"}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"description\":\"Maximum number of files to return (default: 10)\"}\nUnrecognized schema: {\"not\":{}}\nUnrecognized schema: {\"description\":\"Only include files modified within this many days (default: 90)\"}","type":"server_error"}}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions