/**
* Resource: file:///schema/attio-workspace-schema-complete.json
*
* Provides complete schema for the Attio workspace including:
* - All objects (companies, people, custom objects, etc.)
* - All lists
* - All attributes with types and descriptions
* - Valid options for select fields (inline)
* - Valid statuses for status fields (inline)
*
* This resource exposes the FULL schema (all attributes, no filtering).
* For programmatic access with filtering options, use the get_workspace_schema tool.
*
* Note: Dynamically generated from Attio API with 1-hour cache (shared with tool).
*/
import { getWorkspaceSchema } from '../lib/schema-cache.js';
/**
* Get workspace schema content as JSON string (for MCP resource)
*/
export async function getWorkspaceSchemaContent(
apiKey: string
): Promise<string> {
// Get full schema from shared cache
const schema = await getWorkspaceSchema(apiKey, false);
// Add view metadata to indicate this is the full schema
const fullSchema = {
...schema,
view: 'full',
};
// Add showing: 'all' to each object
for (const obj of Object.values(fullSchema.objects)) {
obj.total_attributes = obj.attributes.length;
obj.showing = 'all';
}
// Return as compact JSON string
return JSON.stringify(fullSchema, null, 0);
}
/**
* Resource metadata
*/
export const workspaceSchemaResource = {
uri: 'file:///schema/attio-workspace-schema-complete.json',
name: 'Attio Workspace Schema (Complete)',
description:
'Complete schema for the Attio workspace including all objects, lists, fields, types, required flags, and valid options for select/status fields. This is the FULL schema with all attributes. For filtered views, use the get_workspace_schema tool.',
mimeType: 'application/json',
};