Skip to main content
Glama
fasterv410

logflare-mcp

by fasterv410

Get source schema

get_source_schema

Retrieve the inferred schema of a Logflare source, including field names and data types, to understand its structure.

Instructions

Return the inferred schema (field names and types) for a source.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_tokenNoSource token. Falls back to LOGFLARE_DEFAULT_SOURCE_TOKEN if omitted.

Implementation Reference

  • src/index.ts:74-93 (registration)
    Tool registration for 'get_source_schema' on the MCP server. Defines metadata (title, description) and input schema (optional source_token string), and delegates to client.getSourceSchema().
    server.registerTool(
    	'get_source_schema',
    	{
    		title: 'Get source schema',
    		description: 'Return the inferred schema (field names and types) for a source.',
    		inputSchema: {
    			source_token: z
    				.string()
    				.optional()
    				.describe('Source token. Falls back to LOGFLARE_DEFAULT_SOURCE_TOKEN if omitted.'),
    		},
    	},
    	async ({ source_token }) => {
    		try {
    			return text(await client.getSourceSchema(client.resolveSourceToken(source_token)))
    		} catch (err) {
    			return errorText(err)
    		}
    	},
    )
  • Actual handler/implementation of getSourceSchema(). Makes an HTTP GET request to /api/sources/{token}/schema via the generic request() helper.
    getSourceSchema(token: string) {
    	return this.request<unknown>(`/api/sources/${encodeURIComponent(token)}/schema`)
    }
  • resolveSourceToken() helper used by the tool handler; resolves an optional token to a concrete source token, falling back to LOGFLARE_DEFAULT_SOURCE_TOKEN from config.
    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
    }
  • Zod input schema for the tool: optional source_token string.
    inputSchema: {
    	source_token: z
    		.string()
    		.optional()
    		.describe('Source token. Falls back to LOGFLARE_DEFAULT_SOURCE_TOKEN if omitted.'),
    },
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It implies a read-only operation by stating 'Return', but does not disclose potential issues like schema unavailability or required permissions. It is adequate for a simple retrieval tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no wasted words. It is front-loaded with the purpose. However, it could benefit from a bit more context about what 'inferred' means.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one optional parameter and no output schema, the description is minimally complete. It lacks mention of return format or conditions like source not existing, but is sufficient for an agent to understand the basic functionality.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with a clear description for source_token explaining fallback behavior. The tool description does not add additional meaning beyond the schema, so baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it returns the inferred schema (field names and types) for a source, using a specific verb and resource. It distinguishes well from siblings like execute_query or list_sources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives, such as before executing a query with execute_query. No when-not-to-use or prerequisite conditions are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fasterv410/logflare-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server