Skip to content

Conversation

@Skeftical
Copy link
Member

Description

This PR adds support for a Schema Retrieval tool in the MySQL MCP server. It also makes changes to the project structure to be in-line with the Best Practises

Fixes #73

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Signed-off-by: fsavva <fotis.savva@oracle.com>
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 21, 2025
return json.dumps({"error": f"Error with NL_SQL: {set_response}"})

if db_connection.database is not None:
call_nl_sql = f"CALL sys.NL_SQL(%s, @response, JSON_OBJECT('schemas', JSON_ARRAY(\"{db_connection.database}\"), 'execute', FALSE, 'model_id', 'meta.llama-4-maverick-17b-128e-instruct-fp8'))"
Copy link
Member

Choose a reason for hiding this comment

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

should we put the llama4-maverick into constants, also?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is now removed. The SP in the backend automatically identifies the right model to use

Copy link
Member

@ay0407 ay0407 left a comment

Choose a reason for hiding this comment

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

Please take a look at the hard-coded model name. Other than that, looks good to me. Thank you!

- Modified the ask_nl_sql tool and added test cases
- Modified the retrieve_relevant_schema_information to use new SP and
added test cases
- Adapted README.md to highlight issue with uv in Windows environments
Resolution:
1) If MYSQL_MCP_CONFIG is set, load that absolute path.
2) Otherwise, load <module_dir>/local_config.json.
Copy link
Member

Choose a reason for hiding this comment

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

it was intentional to not pin the config file to a specific path. this makes it easier if someone wants to simultaneously use multiple MCP servers for MySQL that use different configs, e.g., one for one customer and another for a different customer

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep this behavior is still honored through the use of MYSQL_MCP_CONFIG . I removed config_path as an input parameter as it was not being used.

This tool analyzes the input question and, from the provided list of schema and/or table names,
identifies only those that are relevant with respect to the question.
It can optionally consider table and column comments for improved semantic matching. The results contain only the relevant schemas and tables in a JSON object.
Copy link
Member

Choose a reason for hiding this comment

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

nit: length of this row looks off

- Added NL_SQL and ML_RETRIEVE_SCHEMA tools to dbtools MCP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Schema Retrieval to MySQL MCP server

3 participants