Fetch a single source
get_sourceRetrieve a Logflare log source by its token to view its details and configuration.
Instructions
Get a single source by its token.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source_token | Yes | Source token (UUID). |
Implementation Reference
- src/index.ts:56-72 (registration)Registration of the 'get_source' tool with the MCP server, including its input schema and top-level handler that delegates to LogflareClient.getSource()
server.registerTool( 'get_source', { title: 'Fetch a single source', description: 'Get a single source by its token.', inputSchema: { source_token: z.string().describe('Source token (UUID).'), }, }, async ({ source_token }) => { try { return text(await client.getSource(client.resolveSourceToken(source_token))) } catch (err) { return errorText(err) } }, ) - src/index.ts:61-63 (schema)Input schema for 'get_source' tool: expects a single 'source_token' string parameter (a UUID)
inputSchema: { source_token: z.string().describe('Source token (UUID).'), }, - src/logflare.ts:82-84 (handler)Core handler method in LogflareClient that makes a GET request to /api/sources/{token} to fetch a single source
getSource(token: string) { return this.request<{ data: unknown }>(`/api/sources/${encodeURIComponent(token)}`) } - src/logflare.ts:119-127 (helper)Helper method that resolves a source token, falling back to LOGFLARE_DEFAULT_SOURCE_TOKEN environment variable if the argument is undefined
resolveSourceToken(token: string | undefined): string { const resolved = token || this.cfg.defaultSourceToken if (!resolved) { throw new Error( 'source_token is required (pass it to the tool, or set LOGFLARE_DEFAULT_SOURCE_TOKEN).', ) } return resolved }