@ansvar/singapore-law-mcp
Version:
Complete Singapore law database — 523 Acts, 28K+ provisions from Singapore Statutes Online (sso.agc.gov.sg) with full-text search, definitions, and citation support
41 lines • 1.52 kB
JavaScript
/**
* list_sources — Return provenance metadata for all data sources.
*/
import { readDbMetadata } from '../capabilities.js';
import { generateResponseMetadata } from '../utils/metadata.js';
function safeCount(db, sql) {
try {
const row = db.prepare(sql).get();
return row ? Number(row.count) : 0;
}
catch {
return 0;
}
}
export async function listSources(db) {
const meta = readDbMetadata(db);
return {
results: {
sources: [
{
name: 'Singapore Statutes Online (SSO)',
authority: 'Attorney-General\'s Chambers of Singapore',
url: 'https://sso.agc.gov.sg/',
license: 'Singapore Open Data Licence',
coverage: 'All current Acts of Parliament (revised edition), subsidiary legislation, ' +
'revised editions, Bills, and the Constitution of the Republic of Singapore',
languages: ['en'],
},
],
database: {
tier: meta.tier,
schema_version: meta.schema_version,
built_at: meta.built_at,
document_count: safeCount(db, 'SELECT COUNT(*) as count FROM legal_documents'),
provision_count: safeCount(db, 'SELECT COUNT(*) as count FROM legal_provisions'),
},
},
_metadata: generateResponseMetadata(db),
};
}
//# sourceMappingURL=list-sources.js.map