Skip to content

Commit b34fe8c

Browse files
committed
fix: review update
1 parent c13062a commit b34fe8c

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/resource.patternFlyDocsTemplate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const resourceCallback = async (passedUri: URL, variables: Record<string, string
166166
contents: byEntry.filter(entry => entry.uriSchemasId).map(entry => ({
167167
uri: entry.uriId,
168168
mimeType: 'text/markdown',
169-
text: `# ${entry.displayName}\n\nNo documentation is available for this component, but you can find its [JSON Schema](${entry.uriSchemasId}).`
169+
text: `# ${entry.displayName}\n\nNo documentation is available for this component. But a [JSON schema is available](${entry.uriSchemasId}).`
170170
}))
171171
};
172172
}

src/tool.searchPatternFly.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ErrorCode } from '@modelcontextprotocol/sdk/types.js';
22
import { z } from 'zod';
33
import { type McpTool } from './mcpSdk';
4-
import { stringJoin, buildSearchString } from './server.helpers';
4+
import { stringJoin } from './server.helpers';
55
import { assertInput, assertInputStringLength, assertInputStringNumberEnumLike } from './server.assertions';
66
import { findClosest } from './server.search';
77
import { getOptions } from './options.context';
@@ -106,11 +106,9 @@ const searchPatternFlyTool = (options = getOptions()): McpTool => {
106106
numberRecords += 1;
107107
recordNames.add(record.displayName);
108108

109-
const recordUri = `${record.uriId}${buildSearchString({ version: record.version }, { prefix: true })}`;
110-
111-
results.set(recordUri, {
109+
results.set(record.uriId, {
112110
type: 'resource_link',
113-
uri: recordUri,
111+
uri: record.uriId,
114112
name: `${record.displayName} - ${record.displayCategory} (${record.version})`,
115113
description: record.description,
116114
mimeType: 'text/markdown',
@@ -122,11 +120,9 @@ const searchPatternFlyTool = (options = getOptions()): McpTool => {
122120
numberRecords += 1;
123121
recordNames.add(record.displayName);
124122

125-
const schemaUri = `${record.uriSchemasId}${buildSearchString({ version: record.version }, { prefix: true })}`;
126-
127-
results.set(schemaUri, {
123+
results.set(record.uriSchemasId, {
128124
type: 'resource_link',
129-
uri: schemaUri,
125+
uri: record.uriSchemasId,
130126
name: `${record.displayName} - JSON Schema (${record.version})`,
131127
description: `Component JSON schema with property definitions for ${record.displayName}.`,
132128
mimeType: 'text/markdown',
@@ -135,7 +131,15 @@ const searchPatternFlyTool = (options = getOptions()): McpTool => {
135131
}
136132
});
137133

138-
if (!result.entries.length) {
134+
/**
135+
* FIXME: Schemas are intended to be part of collections. We're temporarily expanding our limit condition
136+
* to include `!result.entries.some(entry => Boolean(entry.path)` to make sure if a collection only has JSON
137+
* schemas available, the "collection" doesn't appear; this is specfically to work with the current MCP
138+
* resource structure. In the future when we've focused our MCP resources down to "collections" and
139+
* "records" we would review dropping this part of the check and allow a "collection" grouping to appear
140+
* if all it had were JSON schemas.
141+
*/
142+
if (!result.entries.length || !result.entries.some(entry => Boolean(entry.path))) {
139143
return;
140144
}
141145

@@ -146,14 +150,10 @@ const searchPatternFlyTool = (options = getOptions()): McpTool => {
146150
// Track the name used for sorting this entire group
147151
groupSortNames.set(result.groupId, collectionName.toLowerCase());
148152

149-
const hasDocs = result.entries.some(entry => Boolean(entry.path));
150-
const versionQuery = buildSearchString({ version: updatedVersion }, { prefix: true });
151-
const collectionUri = `patternfly://${hasDocs ? 'docs' : 'schemas'}/${result.groupId}${versionQuery}`;
152-
153153
results.set(result.groupId, {
154154
type: 'resource_link',
155-
uri: collectionUri,
156-
name: `${collectionName} (${hasDocs ? 'Collection' : 'Schema Collection'})`,
155+
uri: `patternfly://docs/${result.groupId}`,
156+
name: `${collectionName} (Collection)`,
157157
description: `A resource collection series for ${collectionNames}`,
158158
mimeType: 'text/markdown',
159159
groupId: result.groupId

0 commit comments

Comments
 (0)