Skip to content

feat: add GraphQL schema introspection tools - #17

Merged
sweden-snow merged 2 commits into
mainfrom
feat/schema-introspection
Apr 10, 2026
Merged

feat: add GraphQL schema introspection tools#17
sweden-snow merged 2 commits into
mainfrom
feat/schema-introspection

Conversation

@sweden-snow

Copy link
Copy Markdown
Contributor
  • fetch_catalogue_schema, fetch_discovery_schema, fetch_core_schema, fetch_shop_cart_schema
  • Compact SDL output strips built-in types and descriptions
  • Auto-summary mode for large schemas (>50k chars)
  • Core schema supports domain filter (order, customer, item, etc.)
  • Discovery and Core accept optional summary param

 - fetch_catalogue_schema, fetch_discovery_schema, fetch_core_schema, fetch_shop_cart_schema
 - Compact SDL output strips built-in types and descriptions
 - Auto-summary mode for large schemas (>50k chars)
 - Core schema supports domain filter (order, customer, item, etc.)
 - Discovery and Core accept optional summary param

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new set of MCP tools to introspect and present Crystallize GraphQL schemas (Catalogue, Discovery, Core, Shop Cart) in a compact, AI-friendly format, with optional summarization for large schemas.

Changes:

  • Introduces schemaTools() with 4 new fetch_*_schema tools backed by a shared introspection + compaction pipeline.
  • Adds optional summary parameter (Discovery/Core) and a Core domain filter.
  • Registers the new tools in the MCP server and adds unit tests for basic behavior and error handling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/tools/schema.ts Implements introspection query execution, compact SDL-ish rendering, summary mode, auto-summary thresholding, and 4 new tool definitions.
src/index.ts Registers schemaTools() in the MCP server’s tool list.
tests/schema.test.ts Adds tests validating tool metadata, compact output behavior, error handling, and basic Core domain filtering.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/schema.ts
Comment on lines +414 to +419
description:
'Fetch the GraphQL schema of the Crystallize Core API (admin API). ' +
'The Core API is large, so provide a domain to filter the schema (e.g. "order", "customer", "item"). ' +
'Common domains: order, customer, subscription, subscriptionPlan, pricelist, pipeline, flow, app, user, webhook, stockLocation. ' +
'Omit domain to get a summary of available types. Set summary to true for a compact overview.',
schema: {

Copilot AI Apr 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Core tool description says "Omit domain to get a summary of available types", but the current handler defaults to returning the full compacted schema unless summary: true (or the auto-summary threshold is exceeded). This mismatch will confuse tool users; either change the description or adjust the handler to default to summary when domain is omitted.

Copilot uses AI. Check for mistakes.
Comment thread src/tools/schema.ts
Comment thread src/tools/schema.ts Outdated
Comment thread src/tools/schema.ts Outdated
Comment thread src/tools/schema.ts
 - Remove redundant `summary` parameter from Discovery and Core tools
   (auto-summary at 50k threshold is sufficient)
 - Show filtered type count with domain filter (e.g. "2 of 3 types")
 - Add auto-summary threshold test

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools/schema.ts
Comment thread src/tools/schema.ts
Comment thread src/tools/schema.ts
@sweden-snow
sweden-snow merged commit f4775bd into main Apr 10, 2026
5 checks passed
istonejoeljonsson added a commit that referenced this pull request Apr 12, 2026
* 'main' of github.com:HayoDev/crystallize-mcp:
  chore(main): release crystallize-mcp 0.1.8 (#19)
  feat: add GraphQL schema introspection tools (#17)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants