Metadata-Version: 2.4
Name: utcp-gql
Version: 1.0.2
Summary: UTCP communication protocol plugin for GraphQL. (Work in progress)
Author: UTCP Contributors
License-Expression: MPL-2.0
Project-URL: Homepage, https://utcp.io
Project-URL: Source, https://github.com/universal-tool-calling-protocol/python-utcp
Project-URL: Issues, https://github.com/universal-tool-calling-protocol/python-utcp/issues
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.0
Requires-Dist: gql>=3.0
Requires-Dist: utcp>=1.0
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Requires-Dist: twine; extra == "dev"


# UTCP GraphQL Communication Protocol Plugin

This plugin integrates GraphQL as a UTCP 1.0 communication protocol and call template. It supports discovery via schema introspection, authenticated calls, and header handling.

## Getting Started

### Installation

```bash
pip install gql
```

### Registration

```python
import utcp_gql
utcp_gql.register()
```

## How To Use

- Ensure the plugin is imported and registered: `import utcp_gql; utcp_gql.register()`.
- Add a manual in your client config:
  ```json
  {
    "name": "my_graph",
    "call_template_type": "graphql",
    "url": "https://your.graphql/endpoint",
    "operation_type": "query",
    "headers": { "x-client": "utcp" },
    "header_fields": ["x-session-id"]
  }
  ```
- Call a tool:
  ```python
  await client.call_tool("my_graph.someQuery", {"id": "123", "x-session-id": "abc"})
  ```

## Notes

- Tool names are prefixed by the manual name (e.g., `my_graph.someQuery`).
- Headers merge static `headers` plus whitelisted dynamic fields from `header_fields`.
- Supported auth: API key, Basic auth, OAuth2 (client-credentials).
- Security: only `https://` or `http://localhost`/`http://127.0.0.1` endpoints.

For UTCP core docs, see https://github.com/universal-tool-calling-protocol/python-utcp.
