Skip to content

Updated: McpJsonSchemaGenerator supports schema document generation for methods containing only one POJO parameter#6092

Closed
290044632 wants to merge 1 commit into
spring-projects:mainfrom
290044632:main
Closed

Updated: McpJsonSchemaGenerator supports schema document generation for methods containing only one POJO parameter#6092
290044632 wants to merge 1 commit into
spring-projects:mainfrom
290044632:main

Conversation

@290044632
Copy link
Copy Markdown

[Description]

  • Updated: McpJsonSchemaGenerator supports schema document generation for methods containing only one POJO parameter
  • Add: Increase McpJsonSchemaGeneratorTests for testing McpJsonSchemaGenerator changes

[Example]

	public  class Param {

		@Schema(name = "name", description = "???", requiredMode = Schema.RequiredMode.REQUIRED)
		private String name;

		@Schema(name = "type", description = "????", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
		private String type;

             // Omit getters and setters
	}
	public  class Executor {

		public void execute(Param param) {
		}
     }
	@Test
	void mcpJsonSchemaGeneratorSinglePojo() throws Exception {
		String schema = McpJsonSchemaGenerator.generateForMethodInput(Executor.class.getMethod("execute", Param.class));
		System.out.println(schema);
	}

[Result]

{
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "type" : "object",
  "properties" : {
    "name" : {
      "type" : "string",
      "description" : "参数名"
    },
    "type" : {
      "type" : "string",
      "description" : "参数类型"
    }
  },
  "required" : [ "name" ]
}

…or methods containing only one POJO parameter

Add: Increase McpJsonSchemaGeneratorTests for testing McpJsonSchemaGenerator changes

Signed-off-by: 290044632@qq.com <290044632@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant