Description
Currently the generated tool schema only includes input parameters. When a tool returns a typed object (e.g., a record), the LLM has no way to know the return shape unless the developer manually describes it in the method's [Description]. This is redundant when the type already exists and can drift out of sync.
record WeatherResult(int Temperature, string Description);
[Description("Returns weather data for a given city.")]
static WeatherResult GetWeather(
[Description("The city to get the weather for.")] string city)
{
return new WeatherResult(18, "Rainy");
}
Inspecting the generated tool:
var weatherTool = AIFunctionFactory.Create(GetWeather);
Console.WriteLine($"Description: {weatherTool.Description}");
Console.WriteLine($"JsonSchema: {weatherTool.JsonSchema}");
Generated Description and schema today:
Description:
Returns weather data for a given city.
JsonSchema:
{
"type": "object",
"properties": {
"city": {
"description": "The city to get the weather for.",
"type": "string"
}
},
"required": [
"city"
]
}
No mention of WeatherResult, Temperature, or Description.
Code Sample
Ability to be fully explicit:
record WeatherResult(
[property: Description("Temperature in Celsius.")] int Temperature,
[property: Description("Weather description.")] string Description);
[Description("Returns weather data for a given city.")]
static WeatherResult GetWeather(
[Description("The city to get the weather for.")] string city)
{
return new WeatherResult(18, "Rainy");
}
Would generate,
{
"type": "object",
"properties": {
"city": {
"description": "The city to get the weather for.",
"type": "string"
}
},
"required": [
"city"
],
"returns": {
"type": "object",
"properties": {
"temperature": {
"description": "Temperature in Celsius.",
"type": "integer"
},
"description": {
"description": "Weather description.",
"type": "string"
}
}
}
}
Or simply by property names,
record WeatherResult(int Temperature, string Description);
[Description("Returns weather data for a given city.")]
static WeatherResult GetWeather(
[Description("The city to get the weather for.")] string city)
{
return new WeatherResult(18, "Rainy");
}
Would generate,
{
"type": "object",
"properties": {
"city": {
"description": "The city to get the weather for.",
"type": "string"
}
},
"required": [
"city"
],
"returns": {
"type": "object",
"properties": {
"temperature": {
"type": "integer"
},
"description": {
"type": "string"
}
}
}
}
Language/SDK
.NET
Description
Currently the generated tool schema only includes input parameters. When a tool returns a typed object (e.g., a record), the LLM has no way to know the return shape unless the developer manually describes it in the method's
[Description]. This is redundant when the type already exists and can drift out of sync.Inspecting the generated tool:
Generated Description and schema today:
Description:
JsonSchema:
{ "type": "object", "properties": { "city": { "description": "The city to get the weather for.", "type": "string" } }, "required": [ "city" ] }No mention of
WeatherResult,Temperature, orDescription.Code Sample
Ability to be fully explicit:
Would generate,
{ "type": "object", "properties": { "city": { "description": "The city to get the weather for.", "type": "string" } }, "required": [ "city" ], "returns": { "type": "object", "properties": { "temperature": { "description": "Temperature in Celsius.", "type": "integer" }, "description": { "description": "Weather description.", "type": "string" } } } }Or simply by property names,
Would generate,
{ "type": "object", "properties": { "city": { "description": "The city to get the weather for.", "type": "string" } }, "required": [ "city" ], "returns": { "type": "object", "properties": { "temperature": { "type": "integer" }, "description": { "type": "string" } } } }Language/SDK
.NET