Tool: generate_schema
Generates a GraphQL schema based on a natural language prompt or data description.
When to use it:
- Use this tool to scaffold new GraphQL schema types and tables using natural language prompts.
How to use it:
- Call
generate_schemawithprojectId,location, andprompt. - Use
list_locationsto find a valid location forlocation(any location works; choosing a closer region reduces latency).
JSON Example:
{
"projectId": "my-project",
"location": "us-central1",
"prompt": "Create a blog schema with Users, Posts, and Comments"
}
The following code sample shows how to use curl to call the generate_schema MCP tool.
| Curl Request |
|---|
curl --location 'https://firebasedataconnect.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "generate_schema", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for GenerateSchema facade.
GenerateSchemaRequest
| JSON representation |
|---|
{ "projectId": string, "location": string, "prompt": string } |
| Fields | |
|---|---|
projectId |
Required. The project ID or number. |
location |
Required. The location of the service. |
prompt |
Required. The natural language description of the data model to generate. |
Output Schema
Output for streaming generate schema requests
GenerateSchemaResponse
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field output_chunk. The streamed output chunk from the generation process. output_chunk can be only one of the following: |
|
status |
Essential for providing responsive UI feedback (e.g., a spinner or "Analyzing schema..." step). |
part |
The content from the current conversational turn. |
GenerationStatus
| JSON representation |
|---|
{
"state": enum ( |
| Fields | |
|---|---|
state |
Output only. The state of generation. |
message |
Output only. A message providing more details about the state. |
Part
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field data. The content from the current conversational turn. data can be only one of the following: |
|
textChunk |
Optional. A chunk of text. |
codeChunk |
Optional. A chunk of code. |
TextChunk
| JSON representation |
|---|
{ "text": string } |
| Fields | |
|---|---|
text |
Required. The text content string. |
CodeChunk
| JSON representation |
|---|
{ "code": string, "languageCode": string } |
| Fields | |
|---|---|
code |
Required. The code content string. |
languageCode |
Optional. Specifies the language if we expand support beyond GraphQL (e.g., SQL or JSON) The standard is BCP-47 language code. |
State
Represents the state of generation.
| Enums | |
|---|---|
STATE_UNSPECIFIED |
Unspecified state. |
ANALYZING_CODE |
The agent is analyzing schema or operations. |
GENERATING_CODE |
The agent is generating code |
COMPLETED |
Generation is complete. |
Tool Annotations
Tool annotations are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.
Along with the title string, the following boolean hints are defined as follows:
readOnlyHint: If true, the tool doesn't modify its environment. Default: false.destructiveHint: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.idempotentHint: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.openWorldHint: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ✅ | Open World Hint: ❌