Skip to content

Consider summary for operation if description is empty#71

Open
nougad wants to merge 3 commits into
ivo-toby:mainfrom
nougad:patch-1
Open

Consider summary for operation if description is empty#71
nougad wants to merge 3 commits into
ivo-toby:mainfrom
nougad:patch-1

Conversation

@nougad

@nougad nougad commented Dec 26, 2025

Copy link
Copy Markdown

Some openapi definitions are unfortunately bit brief and only specify the summary field and not description. But there should be no harm to use summary if no description is found.

Example file: https://intervals.icu/api/v1/docs

Some openapi definitions are unfortunately bit brief and only specify the `summary` field and not `description`. But there should be no harm to use `summary` if no `description` is found.

Example file: https://intervals.icu/api/v1/docs
Some APIs give an overview in summary and further notes in description. But just having description is not conveying the full picture. Using both should work best.

@ivo-toby ivo-toby left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I have a minor suggestion that aligns closer with OpenAPI spec

Comment thread src/openapi-loader.ts

const nameSource = op.operationId || op.summary || `${method.toUpperCase()} ${path}`
const name = this.abbreviateOperationId(nameSource)
const description = [op.summary, op.description].filter(x => x).join("\n");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concatenating might create overly verbose tool descriptions.

Suggested change
const description = [op.summary, op.description].filter(x => x).join("\n");
const description = op.description || op.summary || `Make a ${method.toUpperCase()} request to ${path}`;

this matches OpenAPI conventions where description is the primary documentation field and summary is the brief version

Comment thread src/openapi-loader.ts
const tool: ExtendedTool = {
name,
description: op.description || `Make a ${method.toUpperCase()} request to ${path}`,
description: description || `Make a ${method.toUpperCase()} request to ${path}`,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After previous change this can be simplified to:

Suggested change
description: description || `Make a ${method.toUpperCase()} request to ${path}`,
description,

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.

2 participants