(sourceId: string)
| 170 | * @returns Tool name, description, and annotations |
| 171 | */ |
| 172 | export function getSearchObjectsMetadata(sourceId: string): { name: string; description: string; title: string } { |
| 173 | const sourceIds = ConnectorManager.getAvailableSourceIds(); |
| 174 | const sourceConfig = ConnectorManager.getSourceConfig(sourceId)!; |
| 175 | const dbType = sourceConfig.type; |
| 176 | const isSingleSource = sourceIds.length === 1; |
| 177 | |
| 178 | const toolName = isSingleSource ? "search_objects" : `search_objects_${normalizeSourceId(sourceId)}`; |
| 179 | const title = isSingleSource |
| 180 | ? `Search Database Objects (${dbType})` |
| 181 | : `Search Database Objects on ${sourceId} (${dbType})`; |
| 182 | // Prepend the user-provided `description` from the source config (if set) |
| 183 | // so AI clients reading the MCP tool list see the source's purpose first. |
| 184 | const userDescPrefix = buildSourceDescriptionPrefix(sourceConfig.description); |
| 185 | const description = isSingleSource |
| 186 | ? `${userDescPrefix}Search and list database objects on the ${dbType} database` |
| 187 | : `${userDescPrefix}Search and list database objects on the '${sourceId}' ${dbType} database`; |
| 188 | |
| 189 | return { |
| 190 | name: toolName, |
| 191 | description, |
| 192 | title, |
| 193 | }; |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Convert custom tool parameter configs to Tool parameter format |
no test coverage detected