| name | glean-hello-world |
| description | Index documents into Glean and search them back using the Indexing and Client APIs.
Use when starting a new Glean custom connector, testing search quality,
or learning the index/search pattern.
Trigger: "glean hello world", "glean example", "glean index document", "glean search".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(curl:*) |
| version | 1.8.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","enterprise-search","glean"] |
| compatibility | Designed for Claude Code |
Glean Hello World
Overview
Index documents into Glean and search them. Two steps: set up a custom datasource with the Indexing API, then query with the Client API.
Instructions
Step 1: Set Up Custom Datasource
const GLEAN = `https://${process.env.GLEAN_DOMAIN}/api`;
const idxHeaders = {
'Authorization': `Bearer ${process.env.GLEAN_INDEXING_TOKEN}`,
'Content-Type': 'application/json',
};
await fetch(`${GLEAN}/index/v1/adddatasource`, {
method: 'POST', headers: idxHeaders,
body: JSON.stringify({
name: 'my_wiki',
displayName: 'Internal Wiki',
datasourceCategory: 'PUBLISHED_CONTENT',
urlRegex: 'https://wiki.company.com/.*',
iconUrl: 'https://wiki.company.com/favicon.ico',
}),
});
Step 2: Index Documents
await fetch(`${GLEAN}/index/v1/indexdocuments`, {
method: 'POST', headers: idxHeaders,
body: JSON.stringify({
datasource: ,
: [{
: ,
: ,
: ,
: { : , : },
: { : },
: ().(),
: { : },
}],
}),
});
.();