Skip to content

JSON error when creating agent #108

@jegelstaff

Description

@jegelstaff

Hello, tremendous work here, thank you!

I've made an MCP server, works in Claude (if you had a nickel for every time you hear that, eh?). But the complex JSON schema for a certain tool seems to be tripping up something in mcphost. Here's the error when I run the command: mcphost -m ollama:mistral --config "path\to\formulize-mcp.json"

Warning: Failed to load MCP server 'julian_formulize_net': conv mcp tool input schema fail(unmarshal): json: cannot unmarshal array into Go struct field SchemaBis.properties.type of type string, tool name: get_entries_from_form
Error: failed to create agent: failed to create agent: failed to load MCP tools: all MCP servers failed to load: server julian_formulize_net: conv mcp tool input schema fail(unmarshal): json: cannot unmarshal array into Go struct field SchemaBis.properties.type of type string, tool name: get_entries_from_form

The schema for the tool in question is complex, it is below. I tried truncating the long description strings, thinking it might be related to line breaks or something, but that didn't help, same error. So it's probably related to the complex multi level input schema? Just some stuff in there you're not expecting and the translation of that to Go is failing?

Any ideas?

Thank you!

'get_entries_from_form' => [
  'name' => 'get_entries_from_form',
  		'description' =>
  'Retrieve entries from a form with optional filtering, sorting, and pagination. Supports both simple entry ID lookup and complex multi-condition filtering. Returns data in a structured format suitable for analysis or display.
  
  Examples:
  - Get specific entry: {"form_id": 5, "filter": 526}
  - Search by name: {"form_id": 5, "filter": [{"element": "name", "operator": "LIKE", "value": "John"}]}
  - Multiple conditions: {"form_id": 5, "filter": [{"element": "age", "operator": ">=", "value": "18"}, {"element": "status", "operator": "=", "value": "active"}], "and_or": "AND"}',
  'inputSchema' => [
  	'type' => 'object',
  	'properties' => [
  		'form_id' => [
  			'type' => 'integer',
  			'description' => 'Required. The ID of the form to query. Use list_forms tool to find form IDs.'
  		],
  		'filter' => [
  			'oneOf' => [
  				[
  					'type' => 'integer',
  					'description' => 'Simple filter: Entry ID to retrieve a specific entry'
  				],
  				[
  					'type' => 'array',
  					'description' =>
  'Advanced filter: Array of condition objects. Each condition has: element (field name), operator (=, >, <, >=, <=, !=, LIKE), and value (search term). Multiple conditions are combined using and_or parameter.
  Examples:
  - [ { "element": "age", "operator": "=", "value": "18" } ]
  - [ { "element": "fruit_name", "operator": "LIKE", "value": "berry" }, { "element": "fruit_price", "operator": ">", "value": "5.25" } ]',
  					'items' => [
  						'type' => 'object',
  						'properties' => [
  							'element' => [
  								'type' => 'string',
  								'description' => 'Element handle to filter on (get from get_form_details)'
  							],
  							'operator' => [
  								'type' => 'string',
  								'enum' => ['=', '>', '<', '>=', '<=', '!=', 'LIKE'],
  								'description' => 'Comparison operator. Use LIKE for partial text matches.'
  							],
  							'value' => [
  								'type' => 'string',
  								'description' => 'Value to compare against. For dates use YYYY-mm-dd format. For times, use hh:mm format.'
  							]
  						],
  						'required' => ['element', 'operator', 'value']
  					]
  				]
  			]
  		],
  		'and_or' => [
  			'type' => 'string',
  			'enum' => ['AND', 'OR'],
  			'description' => 'Logical operator between multiple filter conditions. Default: AND'
  		],
  		'limitSize' => [
  			'type' => ['integer', 'null'],
  			'description' => 'Maximum number of entries to return. Default: 100. Use null for no limit (caution: may return large datasets).'
  		],
  		'limitStart' => [
  			'type' => ['integer', 'null'],
  			'description' => 'Starting offset for pagination. Use with limitSize for paging through large datasets.'
  		],
  		'sortField' => [
  			'type' => 'string',
  			'description' => 'Element handle to sort by. Get valid handles from get_form_details tool.'
  		],
  		'sortOrder' => [
  			'type' => 'string',
  			'enum' => ['ASC', 'DESC'],
  			'description' => 'Sort direction. Default: ASC (ascending)'
  		],
  		'elements' => [
  			'type' => 'array',
  			'items' => ['type' => 'string'],
  			'description' => 'Optional. Specific element handles to include in results. If omitted, all elements are returned.'
  		]
  	],
  	'required' => ['form_id']
  ]
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions